# Getting raw field data in custom TTS implementation

**URL:** <https://forums.ankiweb.net/t/getting-raw-field-data-in-custom-tts-implementation/9603>\
**Category:** Development\
**Created:** [April 27, 2021, 11:23am UTC](https://forums.ankiweb.net/t/getting-raw-field-data-in-custom-tts-implementation/9603 "2021-04-27T11:23:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucw](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/lucw/32/29840_2.png) [@lucw](https://forums.ankiweb.net/u/lucw)\
**Post date:** [April 27, 2021, 11:23am UTC](https://forums.ankiweb.net/t/getting-raw-field-data-in-custom-tts-implementation/9603/1 "2021-04-27T11:23:00Z")

</div>

I’m being asked by users to correctly process furigana/ruby fields in AwesomeTTS, so I started looking into it but noticed that when I subclass TTSProcessPlayer, the AVtag instance which gets passed to \_play is stripped of all HTML tags.

Is it possible to get the raw field data so that I can correctly process the Ruby tags ? I think the stripping happens here: [anki/text.rs at main · ankitects/anki · GitHub](https://github.com/ankitects/anki/blob/main/rslib/src/text.rs#L270)  
is it possible for me to monkey patch that strip\_html\_for\_tts function ?

My TTS implementation: [awesometts-anki-addon/ttsplayer.py at master · AwesomeTTS/awesometts-anki-addon · GitHub](https://github.com/AwesomeTTS/awesometts-anki-addon/blob/master/awesometts/ttsplayer.py)

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [April 27, 2021, 12:29pm UTC](https://forums.ankiweb.net/t/getting-raw-field-data-in-custom-tts-implementation/9603/2 "2021-04-27T12:29:36Z")

</div>

Not sure it makes that much sense to read out both expression and reading at the same time - wouldn’t it better better if the user just used tts:kana:somefield?

---

<div class="post-metadata">

**Author:** ![lucw](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/lucw/32/29840_2.png) [@lucw](https://forums.ankiweb.net/u/lucw)\
**Post date:** [April 27, 2021, 1:18pm UTC](https://forums.ankiweb.net/t/getting-raw-field-data-in-custom-tts-implementation/9603/3 "2021-04-27T13:18:08Z")

</div>

I’m not a student of Japanese so i’m not confident i’m using the right terminology. Is your suggestion to have one field for expression, then derive the “reading” and possibly the “furigana” from that dynamically ? Then the audio generation could proceed smoothly.  
This is certainly how I would proceed myself, with clean fields containing your source data. derived data can be added to other fields but can always be generated.

---

<div class="post-metadata">

**Author:** ![lucw](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/lucw/32/29840_2.png) [@lucw](https://forums.ankiweb.net/u/lucw)\
**Post date:** [April 27, 2021, 1:43pm UTC](https://forums.ankiweb.net/t/getting-raw-field-data-in-custom-tts-implementation/9603/4 "2021-04-27T13:43:30Z")

</div>

Can you elaborate on what you mean exactly by tts:kana:somefield? What construct is this and what is happening behind the scenes?

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [May 1, 2021, 11:24pm UTC](https://forums.ankiweb.net/t/getting-raw-field-data-in-custom-tts-implementation/9603/5 "2021-05-01T23:24:39Z")

</div>

Anki includes built-in support for converting the easier-to-edit 'foo[bar] ’ (generated by [Japanese Support - AnkiWeb](https://ankiweb.net/shared/info/3918629684)) into either foo, bar, or foo with bar on top. If the user was using this standard functionality, they could use tts:kana:field to have tts only read ‘bar’ without reading ‘foo’.

If the user has used a different add-on that directly inserts ruby tags into the fields, then those built-in filters will not work, and they’ll need to put the content they want in a separate field if they want the TTS to work across platforms.

---

<div class="post-metadata">

**Author:** ![lucw](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/lucw/32/29840_2.png) [@lucw](https://forums.ankiweb.net/u/lucw)\
**Post date:** [May 23, 2021, 8:00am UTC](https://forums.ankiweb.net/t/getting-raw-field-data-in-custom-tts-implementation/9603/6 "2021-05-23T08:00:21Z")

</div>

sorry you haven’t fully answered my question: what exactly happens behind the scenes when “tts:kana:field” is mentioned in a card template ? does this invoke some kind of filtering function provided by the Japanese Support add-on ?

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [May 24, 2021, 10:46am UTC](https://forums.ankiweb.net/t/getting-raw-field-data-in-custom-tts-implementation/9603/7 "2021-05-24T10:46:00Z")

</div>

It’s a built-in filter, defined in template\_filters.rs.

---

<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:** [May 1, 2023, 3:18am UTC](https://forums.ankiweb.net/t/getting-raw-field-data-in-custom-tts-implementation/9603/8 "2023-05-01T03:18:25Z")

</div>


