标签: text-to-speech

如何在Android上可听见地播放IPA发音?

我有一个单词的IPA发音,我想听到它回复给用户.

可以使用内置的TTS引擎完成吗?如果没有,是否有支持它的TTS引擎?

android text-to-speech ipa

5
推荐指数
1
解决办法
910
查看次数

如何在外部存储中将文本到语音文件保存为.wav/.mp3格式

我正在做一个示例文本到语音应用程序,我的要求是使用EditText从用户获取文本并将输入文本保存为.wav/.mp3格式并存储在外部存储中.我在这个过程中使用了以下代码,但我不会成功.

main.xml中

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <EditText
        android:id="@+id/editText1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:inputType="textMultiLine" >

        <requestFocus />
    </EditText>

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Save in Sdcard" />


    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Play the text file" />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

TTS_AudioActivity.java

public class TTS_AudioActivity extends Activity {
    /** Called when the activity is first created. */
    Button store, play;
    EditText input;
    String speakTextTxt;
    private TextToSpeech mTts;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        store = (Button) findViewById(R.id.button1);
        play = …
Run Code Online (Sandbox Code Playgroud)

android text-to-speech

5
推荐指数
1
解决办法
3881
查看次数

Android TTS添加语言

我想开发一个使用TTS用于多种语言的应用程序.问题是只有少数语言带有特定的设备,这取决于我想的国家(我在谈论PICO).有没有办法使用我的apk中嵌入的TTS engin或在网上找到丢失的PICO文件,并将它们放在apk ...或任何其他解决方案,以支持语言,但默认情况下出现在设备?

android text-to-speech

5
推荐指数
1
解决办法
8257
查看次数

在通过文本到语音说话然后恢复时暂停手机铃声

我正在制作一个使用TTS说出来电者姓名的来电者.我想在TTS讲话时暂停铃声然后恢复铃声.根据我的研究,我们可以使用AudioFocus(希望如此).无论如何,我使用以下代码

更新

我现在正在使用此代码.

public void speak(final String talk) throws InterruptedException {
     final AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
     int musicVolume= audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
     audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, musicVolume, 0);
     audioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT);

    int result = tts.setOnUtteranceProgressListener(new UtteranceProgressListener() {

        @Override
        public void onStart(String utteranceId) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onError(String utteranceId) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onDone(String utteranceId) {
            // TODO Auto-generated method stub
            audioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
            System.out.println("done");
        }
    });
    HashMap<String, String> params = new HashMap<String, String>();
    params.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID,"stringId");
    tts.speak(talk, …
Run Code Online (Sandbox Code Playgroud)

android text-to-speech ringtone android-audiomanager

5
推荐指数
1
解决办法
2658
查看次数

TextToSpeech和内存泄漏

由于内存不足(在程序中,而不是程序员),我一直在进行应用程序崩溃.MAT显示我的Activity的副本有时会在屏幕旋转中保留,而保持虚假副本的唯一对象是每个实例的TextToSpeech对象.我可以使用此代码段复制此行为:

public class MainActivity extends Activity {
    TextToSpeech    mTts;
    char[]          mBigChunk = new char[1000000];  // not used; just makes MainActivity instances easier to see in MAT

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
    @Override
    public void onStart() {
        super.onStart();
        if (mTts==null)                             // shouldn't be necessary and doesn't make any difference
            mTts = new TextToSpeech(this, null);        // commenting this out fixes the leak
    }
    @Override
    public void onStop() {
        super.onStop();
        if (mTts != null) {
            mTts.shutdown();
            mTts = null; …
Run Code Online (Sandbox Code Playgroud)

android memory-leaks text-to-speech google-text-to-speech

5
推荐指数
1
解决办法
1406
查看次数

如何在您的应用程序中禁用辅助功能"TalkBack"?

我的应用程序使用TTS(文本到语音)引擎,我遇到的冲突是Accessibility Talkback设置覆盖TTS试图说的任何内容.如果使用我的应用程序,我想禁用手机的对讲选项.

是否有某种权限来处理这个问题?我找不到任何东西.

android accessibility text-to-speech

5
推荐指数
1
解决办法
2948
查看次数

在Android的TTS中无延迟地处理多种语言

我有这个问题:我想让TTS说一个带有外来词的英语句子(例如意大利语).问题在于,在实例化TextToSpeech课程之后,每次我改变语言时,加载都需要几秒钟,这是不可接受的,因为句子需要尽可能流畅.我也试过多次实例化TextToSpeech,但结果几乎相同.

除了这个无用的问题之外,我无法在谷歌上找到任何东西.

有没有办法实现这一目标?怎么样?

提前谢谢,毛罗.

android text-to-speech

5
推荐指数
1
解决办法
668
查看次数

如何在画外音讲话时停止文本到语音,或者在Swift中反之亦然?

现在,我的应用程序实现AVSpeechSynthesizer了读取每个屏幕的说明.该应用还会在启用Voiceover辅助功能时考虑.

我现在面临的问题是文本到语音功能与配音功能重叠.是否有解决方案来检测当用户导航到屏幕上的另一个元素时,TTS停止说话,或者当TTS说话时,画外音不会说话直到TTS结束(尽管前者是优选的).

目前的开发是在iOS 8上,使用Swift.

accessibility text-to-speech voiceover ios8

5
推荐指数
1
解决办法
2817
查看次数

背景文本到iOS上的演讲

我阅读了很多文章,阅读了许多StackOverflow帖子并尝试了不同的解决方案,但我无法让它发挥作用.

对于与蓝牙耳机通信的应用程序,用户必须能够在用户按下耳机上的按钮时启动/停止秒表.按下此按钮时,我收到一个蓝牙事件并启动秒表(在后台接收此蓝牙事件不是问题).秒表启动后,我用它AVSpeechSynthesizer来说"秒表开始".现在出现了我的问题:我希望每分钟都有一个文本到演讲,说出已经过去的分钟数.但是当应用程序在后台时......

我读过这样的解决方案:

var bgTask = UIBackgroundTaskIdentifier()
bgTask = UIApplication.shared.beginBackgroundTask(expirationHandler: {
   UIApplication.shared.endBackgroundTask(bgTask)
})
let timer = Timer.scheduledTimer(timeInterval: 60.0, target: self, selector: #selector(notificationReceived), userInfo: nil, repeats: true)
RunLoop.current.add(timer, forMode: RunLoopMode.defaultRunLoopMode)
Run Code Online (Sandbox Code Playgroud)

它确实有效,但我找不到任何关于此代码在生产中的稳定性(从App Store下载应用程序时).当应用程序在后台时,计划的本地通知也无法触发任何代码.即使是财产postUtteranceDelayAVSpeechUtterance似乎不太稳定.我将属性设置为460秒,但是文本在随机56秒后被说出......

我为我的应用程序打开了几乎所有的后台模式.

<key>UIBackgroundModes</key>
<array>
    <string>audio</string>
    <string>bluetooth-central</string>
    <string>fetch</string>
    <string>remote-notification</string>
</array>
Run Code Online (Sandbox Code Playgroud)

其他人建议制作一个无声的音轨.但似乎使用那种"无声轨道"的应用程序被Apple Review团队拒绝了.

令我印象最深刻的是,像Runkeeper和Seconds Interval Timer这样的应用程序可以完成他的工作.即使我打开飞行模式并禁用应用程序中的所有设置(如推动,动作感应).那么,为什么我找不到可行的解决方案......?

有没有人有建议从哪里开始?

text-to-speech background-process ios swift

5
推荐指数
0
解决办法
436
查看次数

iOS文字语音转换:由什么决定[AVSpeechSynthesisVoice voiceWithLanguage]返回的默认语音?

iOS SDK 7.0中引入了AVSpeechSynthesisVoice.voiceWithLanguage。那时,每种语言/地区只有一种声音。

自iOS SDK 9.0起,每种语言/地区都添加了更多声音。因此,Apple引入了新的API voiceWithIdentifier,以便您可以获取所需的特定语音。

我的问题是,如果我们仍在iOS 9或更高版本中使用voiceWithLanguage,该怎么办?该API究竟返回什么?更重要的是,返回的语音是否在iOS版本之间甚至在不同设备之间发生了变化?

我注意到,voiceWithLanguage返回的内容有点依赖于iOS语音设置“设置->常规->辅助功能->语音->语音->英语”。但并不是完全匹配。就是说,例如英语US,如果将语音设置为“ Fred”,voiceWithLanguage将返回“ Fred”,这很酷。但是,如果将语音设置为“ Nicky”,voiceWithLanguage会返回“ Nicky”以外的其他内容。

我问这是因为我的应用程序正在使用voiceWithLanguage。当用户将iOS升级到iOS 12时,他们报告说他们听到了不同的声音。我相信voiceWithLanguage在升级到iOS 12后会返回不同的声音。虽然我无法在相同类型的设备上重现它。

当然,我可以开始改用voiceWithIdentifier。但是只是对带语音的voiceWithLanguage感到好奇。

text-to-speech ios avspeechsynthesizer

5
推荐指数
1
解决办法
528
查看次数