obsidian-tts icon indicating copy to clipboard operation
obsidian-tts copied to clipboard

Android Obsidian 1.4.0, the language specific voices of Text to Speech can not select voice

Open ajmz opened this issue 3 years ago • 6 comments

Android Obsidian 1.4.0, the language specific voices of Text to Speech can not select voice, while the Obsidian 1.0 for windows works well.

ajmz avatar Oct 16 '22 17:10 ajmz

This plugin does not work at all on Android. See the README and #8

joethei avatar Oct 16 '22 17:10 joethei

This plugin does not work at all on Android. See the README and #8

Thanks a lot. I will report it to the development team of Obsidian to see if it can support TTS for Android environment.

ajmz avatar Oct 16 '22 17:10 ajmz

No, we can't (I am also part of that team) The issue is with Android itself, see the link the README.

joethei avatar Oct 16 '22 17:10 joethei

Thanks for replying, I'm not a programmer. But I read the README and the link inside to https://bugs.chromium.org/p/chromium/issues/detail?id=487255 .

I found the comment as follows, "But the problem I had was solvable":

Comment 62 by [email protected] on Mon, Jun 21, 2021, 6:54 AM GMT+8 I might have misunderstood the purpose of this issue. But the problem I had was solvable.

I was using utterance.voice which is only wrong on Android Chrome. The following snippet is broken.

let utterance = new SpeechSynthesisUtterance("hello");
let voice = speechSynthesis.getVoices()[0]
utterance.voice = voice;
speechSynthesis.speak(utterance);

That works on Chrome Windows, iOS, MacOS, Firefox Android, but doesn't work on Android Chrome. The following works on all platforms I tested. To test in the console, you might have to run it twice to make sure the voices are loaded:

let utterance = new SpeechSynthesisUtterance("hello");
let voice = speechSynthesis.getVoices()[0]
utterance.voice = voice; // required for iOS
utterance.lang = voice.lang; // required for Android Chrome
utterance.voiceURI = voice.voiceURI; // unclear if needed
speechSynthesis.speak(utterance);

And you should hear a non-native accent saying "hello".

ajmz avatar Oct 17 '22 01:10 ajmz

let utterance = new SpeechSynthesisUtterance("hello");
let voice = speechSynthesis.getVoices()[0]
utterance.voice = voice; // required for iOS
utterance.lang = voice.lang; // required for Android Chrome
utterance.voiceURI = voice.voiceURI; // unclear if needed
speechSynthesis.speak(utterance);

And you should hear a non-native accent saying "hello".

BTW, I tried the quoted workaround, but it didn't resolve the issue. It's a shame, it would really benefit me to listen to my vault while on the go 😞

usernotnull avatar Jun 04 '23 13:06 usernotnull