# Dynamic TTS Generation at Runtime?

**URL:** <https://forums.ankiweb.net/t/dynamic-tts-generation-at-runtime/54512>\
**Category:** Card Design\
**Created:** [January 17, 2025, 5:47pm UTC](https://forums.ankiweb.net/t/dynamic-tts-generation-at-runtime/54512 "2025-01-17T17:47:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shenma](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@shenma](https://forums.ankiweb.net/u/shenma)\
**Post date:** [January 17, 2025, 5:47pm UTC](https://forums.ankiweb.net/t/dynamic-tts-generation-at-runtime/54512/1 "2025-01-17T17:47:10Z")

</div>

Is there a way to use JS to speak out text dynamically at runtime? My understanding is that Anki’s native TTS only works with static fields which are templated before JS is ran.

It appears there is an AnkDroid API for this: github (dot) ankidroid/Anki-Android/wiki/AnkiDroid-Javascript-API#usage-45 but I can’t find if there is a desktop/ios api.

At first pass it seems like this wasn’t possible on other platforms at least a year or so ago but I may be wrong  
forums (dot) [ankiweb.net/t/modify-string-before-tts-reads-the-field-advanced/20075](http://ankiweb.net/t/modify-string-before-tts-reads-the-field-advanced/20075)

Am I overlooking something? Is there a better way to do this? I don’t want to bundle static audio assets if possible.  
I am a visually impaired user so I have a lot of use cases where I want to write uncommon or custom helper functions.

If there is an issue tracker for this somewhere on Github feel free to drop that here.

Thank you very much

(Links were posted with `dot` so it got around spam filter)

---

<div class="post-metadata">

**Author:** ![Danika\_Dakika](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/danika_dakika/32/17815_2.png) [@Danika\_Dakika](https://forums.ankiweb.net/u/Danika_Dakika)\
**Post date:** [January 17, 2025, 9:30pm UTC](https://forums.ankiweb.net/t/dynamic-tts-generation-at-runtime/54512/2 "2025-01-17T21:30:25Z")

</div>

> [@Can I use Anki TTS to play fields in random order?](https://forums.ankiweb.net/t/can-i-use-anki-tts-to-play-fields-in-random-order/47029/2):
>
> Sorry, it’s not possible - tts is processed before JS runs.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [February 16, 2025, 9:30pm UTC](https://forums.ankiweb.net/t/dynamic-tts-generation-at-runtime/54512/3 "2025-02-16T21:30:26Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
