Hello,
this is my feature request to add compatibility to the new Anki 2.1.20 TTS support. Please note that it was done in a rush since I have a deadline approaching.
https://apps.ankiweb.net/docs/manual.html#text-to-speech
https://github.com/ankitects/anki/search?q=tts&unscoped_q=tts
Please note that my card does not make use of the tts voice/speed settings, which would ideally be included as well.
According to https://apps.ankiweb.net/docs/manual.html#text-to-speech, there should be a play audio button, the text in the {{tts en_GB:Field}} will not be shown and the audio is automatically played when reviewing.

[ x ] I have read the support page and am reporting a bug or enhancement request specific to AnkiDroid
[ x ] I have checked the manual and the FAQ and could not find a solution to my issue
[ x ] I have searched for similar existing issues here and on the user forum
Thanks @p4nix I appreciate your taking the time to log this
One could convert the new 2.1.20 TTS syntax into the old syntax. Essentially, {{Front}}{{tts de_DE:Front}} becomes {{Front}}<tts service="android" voice="de_DE">Front</tts>.
As I understand it, one could grab a string surrounded by {{tts and ending in }}, interpret the first characters (ending before a colon: or a space ) as the old syntax "voice". Characters after the colon : would be the field name, which must be passed as a string e.g. Front, NOT {{Front}}. All other characters (if included, e.g. voices=Apple_Otoya,Microsoft_Haruka) would be ignored, as they have information pertaining to MacOS or Windows.
Thanks for looking into this issue!
I myself have downloaded the AnkiDroid sourcecode to look into this, but I am afraid my limited knowledge of coding and limited amount of time I could spend for it didn't allow me to find a solution. Please note that your solution would only be a "dirty fix" (no offense, it would help me out personally with that issue) - but ideally, it should generate the standard voice button by saving the audio temporarily, as I understand it works on Anki desktop. Otherwise it wouldn't really be ecosystem compatibility :)
Basic flow:
{{tts en_US voices=Bob,Jane:Field}} from template and convert to [anki:tts][en_US voices=Bob,Jane]text[/anki:tts]: tts_filter[anki:tts] into [anki:play:q:0]: extract_av_tags[sound:] tagsAVTag, and the textual representation references the index of this list.AVTag is stored in the card: render_card_from_context, render_card, question_av_tags[anki:play] is converted to an svg which calls pycmd('play:q:0') av_refs_to_play_iconssounds.av_player: replay_audioaqt.sounds.av_player is an abstraction over a list of players. These are set up to accept an AVTag, and rank it setup_audio _best_player_for_tagRanking logic: voice_for_tag
.play is invoked on the player, Add {{tts-voices}} field: on_tts_voices
Notes
A worrying method is temp_file_for_tag_and_voice, but this appears unused. It seems easiest to ignore this in our implementation and let our TTS engine handle caching.
How do I unsuspend my greendot card i found
@david-allison-1
Would that also yield a play button similar to how the Anki 2.1.20 does?
I find it useful being able to break up the sound playback, instead of always getting the audio for the full text. Hence the question and request :)
@EmilRehnberg Haven't looked into the implementation, but the initial change will almost certainly mirror how Anki Desktop does it.
Hello 馃憢, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like _still searching for solutions_ and if you found one, please open a pull request! You have 7 days until this gets closed automatically
I'm planning on supporting the Anki 2.1.20 TTS {{tts}} functionality within AwesomeTTS (as opposed to the previously used
I'm getting the initial stages of the Rust conversion into AnkiDroid 2.14, after then we'll be able to use the Anki Desktop TTS code.
That sounds like a good idea, will you be able to share a large proportion of code with Anki at that point ? I did notice the code which parses the {{tts}} tag is in rust (.rs file - I know nothing about rust).
That sounds like a good idea, will you be able to share a large proportion of code with Anki at that point ? I did notice the code which parses the {{tts}} tag is in rust (.rs file - I know nothing about rust).
We'll be compiling the rust as a native library for Android, none of the Python sadly