In most cases – including learning Japanese or Chinese with the
standard
add-ons installed –
adding a field Audio
to the note and to at
least one side of a card is enough, but more
sophisticated use of the add-on is also possible.
This page describes how the add-on matches audio and text fields and gives examples on how to use more than one pronunciation per note.
Fields rules
The download mechanism uses the following rules to match audio fields to text fields
For most downloaders, plain text is used. The rules to find the source fields are:
- When there is a field called
Audio
orSound
,
the add-on looks for a field called
Expression
orWord
- When there is an
Audio
orSound
field, but noExpression
orWord
field, the first field is used as the source. - For fields where
Audio
orSound
is a substring, this word is removed and the rest used to look for a field. For example, to get pronunciations for a field calledExample
, you should add a field namedExample Audio
(orAudio Example
). When downloading, the add-on will find the fieldExample Audio
, strip theAudio
, clean up the space to getExample
and look for that field to get the text.
To get Japanese pronunciations from JapanesePod101.com there has to be the reading stored in the note. The detailed rules are:
- When there is a field called
Audio
orSound
,
the add-on looks for a field called
Reading
,Kana
,かな
or仮名
- The substring rule is different for this case. For fields where
Audio
orSound
is a substring, this word is not removed, but the add-on looks for fields where that word has been replaced with one from theReading
list. For example, when there is a field calledJapanese Reading
, add a fieldJapanese Audio
to download from the reading field. - There is no first field rule for readings.
All of these field names are not case sensitive. For example, expression
,
auDIO
or SOUND
will work.
The field names are defined in the lists in the file
in the add-ons folder. That folder can be displayed through the
downloadaudio/get_fields.py
Tools/Add-ons/Open Add-ons Folder…
menu item, and names can be
added to the lists.
Examples
I use complex note types with many fields in my personal collection. Field lists from these models can be used to demonstrate real-life use of these rules.
Model Standard — Japanese
My main Japanese vocabulary model has these fields:
- Expression
- Reading
- Deutsch
- Zusatz
- Audio
- 例文
- 例文 Audio
Applying the rules means that:
- The plain rule matches the field
Expression
to the fieldAudio
. The GoogleTTS downloader will work from the expression and download into the audio field. - The readings rule matches the field
Reading
to the fieldAudio
. The JapanesePod downloader will work from the reading and download into the audio field, too. - The plain substring rule matches the field
例文
to the field例文 Audio
- For the fields
Deutsch
andZusatz
(and the audio fields themselves), nothing is downloaded.
Model Land, state etc.
For my world-wide geography deck, i use the fields:
- CountryName
- CountryName_Audio
- Capital
- CapitalName_Audio
- Map
- Flag
- Inhabitants_Scalar
- Area_Scalar
- NameAlternative
- NameAlternative_Audio
- CapitalAlternative
- CapitalAlternative_Audio
Here only the plain substring rule matches. The add-on tries to get audio for these field pairs:
- CountryName → CountryName_Audio
- Capital → Capital_Audio
- NameAlternative → NameAlternative_Audio
- CapitalAlternative → CapitalAlternative_Audio
Model 都道府県 – Japanese
Here some of the fields are:
- Präfektur_ローマ字
- 都道府県
- 都道府県_Reading
- 都道府県_Audio
- Nummer
- Einwohner
- Fläche
- Karte
Here the plain substring and the reading substring rules match:
- The plain substring rule matches the field
都道府県
to the field都道府県_Audio
. - The readings substring rule matches the field
都道 府県_Reading
to the field都道府県 _Audio
.
Here, too, pronunciations from different source texts are downloaded to the same field