TTS默认的音频流是什么?

发布于 2024-11-27 06:58:09 字数 1102 浏览 2 评论 0原文

据我所知,目前 Android:

STREAM_ALARM         (for alarms)
STREAM_DTMF          (for DTMF Tones)
STREAM_MUSIC         (for music playback)
STREAM_NOTIFICATION  (for notifications)
STREAM_RING          (for the phone ring)
STREAM_SYSTEM        (for system sounds)
STREAM_VOICE_CALL    (for phone calls)

我也知道可以明确告诉TTS引擎使用哪个流:

params.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_ALARM));
mTts.speak(text, TextToSpeech.QUEUE_ADD, params);

但是,我找不到的是当我不使用时默认使用哪个流t指定音频 溪流。

Android TextToSpeech 引擎的默认音频流是什么?

有没有办法查询 Android 的 TextToSpeech 引擎当前正在使用哪个流?

更新: TextToSpeech.Engine 有一个常量定义为 DEFAULT_STREAM 但不清楚它指的是 7 个流中的哪一个。不过,它具有与 STREAM_MUSIC 相同的十六进制值 (0x3)。是这个吗?

As far as I can tell, there are currently are 7 audio streams in Android:

STREAM_ALARM         (for alarms)
STREAM_DTMF          (for DTMF Tones)
STREAM_MUSIC         (for music playback)
STREAM_NOTIFICATION  (for notifications)
STREAM_RING          (for the phone ring)
STREAM_SYSTEM        (for system sounds)
STREAM_VOICE_CALL    (for phone calls)

I also know that it is possible to explicitly tell the TTS engine which stream to use:

params.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_ALARM));
mTts.speak(text, TextToSpeech.QUEUE_ADD, params);

What I couldn't find, however, is what stream is used by default when I don't specify an audio stream.

What is the default audio stream from Android's TextToSpeech engine?

Is there a way to query which stream is currently being used by Android's TextToSpeech engine?

UPDATE: TextToSpeech.Engine has a constant defined as DEFAULT_STREAM but it is unclear which of the 7 streams it is referring to. It has the same hex value (0x3) as STREAM_MUSIC, though. Is this it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沩ん囻菔务 2024-12-04 06:58:09

STREAM_MUSIC 是 AOSP 源中的默认值,在 TextToSpeech.java(撰写本文时第 164 行)框架/base.git:

/**
 * Default audio stream used when playing synthesized speech.
 */
public static final int DEFAULT_STREAM = AudioManager.STREAM_MUSIC;

STREAM_MUSIC is the default in the AOSP source, defined in TextToSpeech.java (line 164 as of this writing) in frameworks/base.git:

/**
 * Default audio stream used when playing synthesized speech.
 */
public static final int DEFAULT_STREAM = AudioManager.STREAM_MUSIC;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文