dlutton / flutter_tts

Flutter Text to Speech package
MIT License
613 stars 258 forks source link

IOS 16 not working on physical device for other languages (non english) #381

Open torphix opened 1 year ago

torphix commented 1 year ago

Hi thanks for the great lib,

Unfortunately not working on ios 16.3 physical device when I try to change languages from english: In set awaitOptions I called


 if (Platform.isIOS) {
      await flutterTts.setSharedInstance(true);
      await flutterTts.setIosAudioCategory(
          IosTextToSpeechAudioCategory.ambient,
          [
            IosTextToSpeechAudioCategoryOptions.allowBluetooth,
            IosTextToSpeechAudioCategoryOptions.allowBluetoothA2DP,
            IosTextToSpeechAudioCategoryOptions.mixWithOthers
          ],
          IosTextToSpeechAudioMode.voicePrompt);
    }
    await flutterTts.awaitSpeakCompletion(true);
    await flutterTts.setLanguage(widget.languageCode);
    await flutterTts.setSpeechRate(rate);

as instructed in another issue however it still dosn't work

On start up i recieve the error: [catalog] Query for com.apple.MobileAsset.VoiceServices.GryphonVoice failed: 2 Installing and launching...
[catalog] Unable to list voice folder

And when I try to use TTS I get the error:

[catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2
[AXTTSCommon] Invalid rule:
[AXTTSCommon] Invalid rule:
[AXTTSCommon] File file:///var/MobileAsset/AssetsV2/com_apple_MobileAsset_Trial_Siri_SiriTextToSpeech/purpose_auto/70b0ca2e97d6bfd04b92b524463071852a62a8d5.asset/AssetData/vocalizer-user-dict.dat contained data that was not null terminated
[AXTTSCommon] Invalid rule:

Any help would be greatly appreciated!

Thanks

torphix commented 1 year ago

Have just tried to run the provided example in IOS 16 physical device without success, (for any language)

happyriri commented 1 year ago

Me too the example not working on physical iOS 16 !

torphix commented 1 year ago

Try with version 3.2.2

On Wed, 22 Mar 2023, 18:15 happyriri, @.***> wrote:

Me too the example not working on physical iOS 16 !

— Reply to this email directly, view it on GitHub https://github.com/dlutton/flutter_tts/issues/381#issuecomment-1480045451, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP52P6Y6WEXITES3TCDVWWDW5M6SZANCNFSM6AAAAAAWAE7QNM . You are receiving this because you authored the thread.Message ID: @.***>

happyriri commented 1 year ago

It doesn't work with version 3.2.2

I tried the example. I tried your code but not working :(

olyphotographer commented 1 year ago

I get the same error (language=de) , it may not be related but when I set e.g.

await _flutterTts.setVoice({"name": "Reed", "locale": "de-DE"});

then it works without the error, I tried different "voices" and some produce the error some not. (Anna->error, Helena->error, Grandma->okay, Eddy->okay)

happyriri commented 1 year ago

Have you a complete example that works both on Android and iOS ?

Thanks in advance

olyphotographer commented 1 year ago

Sorry, no. I have only a IOS app and it's a customer project. But I installed the example from pub on my IPhone 13 with 16.3.1.

With the standard voice I get the error, when I change it to e.g. "Reed" it works without the error.

Future _speak() async {
    await flutterTts.setVolume(volume);
    await flutterTts.setSpeechRate(rate);
    await flutterTts.setPitch(pitch);
    await flutterTts.setVoice({"name": "Reed", "locale": "de-DE"});

    if (_newVoiceText != null) {
      if (_newVoiceText!.isNotEmpty) {
        await flutterTts.speak(_newVoiceText!);
      }
    }
  }

I get a list of available voices with:

    _flutterTts.getVoices.then((value) {
      for (var v in value) {
        print("voice: $v");
      }
    });

The available voices are different from the simulator to the real device, on the simulator I only have "Anna" as voice for the locale "de-DE" and "Anna" doesn't work on the real device and it seems to be the default voice.

regards

olyphotographer commented 1 year ago

With IOS 16.4.1 (on a physical device) it doesn't really work anymore, even with the example from pub. It works only with:

  Future _speak() async {
    await flutterTts.setVolume(volume);
    await flutterTts.setSpeechRate(rate);
    await flutterTts.setPitch(pitch);
    await flutterTts.setVoice({"name": "Samantha", "locale": "en-US"});
    if (_newVoiceText != null) {
      if (_newVoiceText!.isNotEmpty) {
        print("--->  $_newVoiceText");
        await flutterTts.speak(_newVoiceText!);
      }
    }
  }

but with probably no other voice for en-US and only with the voice "Anna" for de-DE. With IOS 16.4 it has been worked with more different voices.

It's really strange, when I set the voice to "Eddy" and en-US and the text to "this is a test" the I can hear speaking the following text:

<speak><voice name="com.apple.eloquence.en-US.Eddy"><prosody volume="-6.0dB">this is a test</prosody></voice></speak>

regards

olyphotographer commented 1 year ago

okay, I found that I have to set the voice in the settings of the device, then it works, at least for English. For German there is a problem with spoken numbers (this was not the case with IOS 16.4), e.g. number 5 is now spoken as "homograph start 6 homograph end", this seems to be a IOS problem, I found several notes regarding this. I don't know what is the solution here. Is there a chance to find out what the name of the default voice is?

torphix commented 1 year ago

Thanks for sharing!

On Tue, 11 Apr 2023, 14:49 Peter Arnold, @.***> wrote:

okay, I found that I have to set the voice in the settings of the device, then it works, at least for English. For German there is a problem with spoken numbers (this was not the case with IOS 16.4), e.g. number 5 is now spoken as "homograph start 6 homograph end", this seems to be a IOS problem, I found several notes regarding this. I don't know what is the solution here. Is there a chance to find out what the name of the default voice is?

— Reply to this email directly, view it on GitHub https://github.com/dlutton/flutter_tts/issues/381#issuecomment-1503391805, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP52P66WFBPUJDCAD6RDMUDXAVOQBANCNFSM6AAAAAAWAE7QNM . You are receiving this because you authored the thread.Message ID: @.***>

durone commented 1 year ago

on IOS 16.4.1 device, It works when I use the following codes :

         _flutterTts.setIosAudioCategory(
        IosTextToSpeechAudioCategory.playback,
        [IosTextToSpeechAudioCategoryOptions.mixWithOthers],
        IosTextToSpeechAudioMode.voicePrompt);

hope this helps

mvarendorff2 commented 1 year ago

okay, I found that I have to set the voice in the settings of the device, then it works, at least for English. For German there is a problem with spoken numbers (this was not the case with IOS 16.4), e.g. number 5 is now spoken as "homograph start 6 homograph end", this seems to be a IOS problem, I found several notes regarding this. I don't know what is the solution here. Is there a chance to find out what the name of the default voice is?

The default name appears to be Anna; here is a list of all voice names from different locales to try out others.

This post (German) suggests that using one of the other voices except for Anna (even in German locale) should fix the problem. I don't have the resources to confirm this, unfortunately but maybe it helps @olyphotographer

That being said, I think the problem might be unrelated to this issue.