29 3
Contact Author Sign in to rate

Audio Files

0.07MB. Updated 2022-07-31.
The author has shared 4 other item(s).

Description

A simple add-on to search for audio files matching the text in a field. It adds a button to the editor to use during note editing to search for audio data using the text in the current field. A configuration option is provided to make the search use selected text if a text selection has been made. The audio file content is uploaded to Anki and a [sound:...] element appended to the text. That can be cut& pasted into a separate field for sound if desired, making what I have found to be a quick and simple process for getting sound data into your notes. For instance, for a field containing "немножко" the result of using this add-on with the cursor in the field would be that the field contains "немножко[sound:немножко.mp3]" and the audio data is copied to Anki's media folder. It is also copied to a local working folder - by default the system location for temporary data, but the folder used can be changed via a configuration parameter. 3 sources of data are currently used, Forvo, Wiktionary and Open Russian - data sources can be separately enabled or disabled. The addon has been designed to make it easy to add code for using additional data sources. For Wiktionary the target language to search is a configuration option - it should match the code used by Wiktionary to specify locale, eg "En-uk" for UK English. The default is 'ru'. For Forvo the target language to search is a configuration option - it should match the code used by Forvo to search by language. The default is 'ru'. Accents are supported for Forvo - for instance using a code of "es_es" will search for Spanish words as spoken in Spain. Instead of using the word as the filename the data can be saved with a random filename by setting the 'filenames' configuration option to 'random'. To maximise the likelihood of finding a sound file searches will be automatically repeated using minor transformations of the text. This is configured, separately for each data source, by selecting one or more search rules. Note that at least one rule must be selected for a search to be made - by default the 'convert to lowercase' rule is selected. A simple dialog has been provided to make configuration easy. Note that configuration is per Anki profile, so if you use multiple profiles configuration changes will only affect the active profile. change log 20220730 20220418 20211111 20211110 20201228 20191230 20191123

Download

As add-ons are programs downloaded from the internet, they are potentially malicious. You should only download add-ons you trust.

Supported Anki versions:

To download this add-on, please copy and paste the following code into Anki 2.1:

1984823157

If you were linked to this page from the internet, please open Anki on your computer, go to the Tools menu and then Add-ons>Browse & Install to paste in the code.

All Anki 2.1.x Add-Ons Contact Author

Reviews

on 1650355282
Fantastic addon, keep it up!
Tried Forvo for the first time )) And have to say I'm somewhat disappointed. Expected more from them. + there are mixing sometimes and instead of Mandarin, the Cantonese pronunciation are downloaded, even though I set locale to 'zh'.
Wiktionary on the other hand just can't find anything with the 'zh' set.

Feature request: Please add batch operation mode and ability to put sound field into a separate predefined field
(right now only single-card edit,
can't enhance with audio a whole deck)
Comment from author before post was edited
I know it's been a while, but I've updated the addon today to support dialects and accents in Forvo. For instance, if you use es_es as the Forvo locale it will only search for Iberian Spanish pronunciations (ie. it will ignore Latin American Spanish pronunciations).

Obviously restricting it to a specific dialect or accent reduces the chance of a pronunciation being found, but it will fix your issue with Cantonese instead of Mandarin.

If you look at the url displayed when hovering above the dialect/accent name in the 'Accent:' row on the Forvo screen you will see the locale to use.

I've thought about your request for a batch mode and ability to put the sound file in a separate field. I'd like to keep the addon as simple as possible to use and think that these may complicate it. To put the sound file in a separate field would mean make the configuration dialog much more complex as each note type (and I personally have quite a few different types) would need a separate entry. And a batch operation would need it's own configuration and menu entry - I think that it could be better to use the basic word lookup code in a separate addon to add those features rather than making this addon too complex.
on 1647410691
Very useful, save quite a lot of time.
on 1640944118
Extremely helpful and saves loads of time manually searching for audio!
on 1640560403
Extremely useful!
on 1639837196
This has saved me so much time, thank you so much
on 1622237889
the add on is fantastic
on 1612736552
Works great for chinese flashcards!
on 1611188847
Very good! Thank you!
on 1607875399
This is saving me SO much time! Thank you.
on 1604291611
works!
on 1603361549
Really nice and easy to use and the code is super easy to edit. It would be amazing if it is possible to search for only marked words since often my decks contain more than the single vocabulary in one field. The add-on will always seach for the whole field wich is unfortunate. For instance: My backside "la Sociologia (f)" can t be found, but fovea has the word sociologia.
Comment from author
The differences between languages! Thank you for this suggestion - I have added a new feature so that you it will search for an audio file using the selected text rather than the whole of the field value. To use it you will need to enable the option in the configuration dialog.

I hope that it helps.
on 1602372651
Amazing addon! It would be impressive to look for sentences instead single words (for example with google translator) to add a voice to the "dry" cards!
Thank you!
on 1601547534
This is awesome! I am a newbie, so I was copying/pasting all the wiktionary audio files. Thanks man, you saved so many hours of my life!
on 1595706131
Could someone help me get this to work for Hungarian?
Comment from author
Just set the Forvo language code to 'hu'
on 1594651545
Is there any way to add the audios to a whole deck without having to do it for each card one by one?
on 1592955219
Спасибо большое!)
on 1590056568
works for Hungarian! Many thanks.
on 1589773033
Works well for Forvo! I have a problem with Wiktionary for Chinese though

Edit: it does work but apparently only with pinyin, not characters, because that's the file names that are used. Doesn't work with all words because some times the filenames on Wiktionary are messed up. Also, if your pinyin is formatted in some way (mine often is due to the Chinese Support extension), it won't work. So, make sure you don't use any formatting

Edit 2: it would be really cool if we could import audio from Wordreference too!
Comment from author
Thank you for this - interesting to know that it works for Chinese as well!

I'd be happy to include Wordreference as a data source if someone can provide some sample code to me.
on 1589099603
Really helpful, I was able to download more than 5000 forvo audio files thanks to this add-on ! Thanks a bunch!
on 1587923708
It's very helpful.
Good job.
on 1586914624
Working fine but currently shtooka.net is down. I don't know how much longer that will last but until then can it be updated to source from a different website?
on 1586680675
It is working :-)
Fetching from Forvo English OK.
on 1584460090
I set Forvo to Korean and it works perfectly! I've got no problems with any settings and it helps a lot. Thank you!
on 1579452546
Great add-on - this was very easy to configure for my target language (German) and worked seamlessly with my decks. Thanks!
on 1579107292
Hello.
Many thanks for the plugin but I can't make it work, it gives me a "couldn't find sound data"

http://prntscr.com/qo55y4

Here a screenshot. I wanted to only use Forvo and even set the language to "de" (it didn't work either when it was by default "ru").
What do you think it could be?

Srry to give the red hand :(
on 1576353987
Unfortunately, the addon fails to load with both custom and default config.
Comment from author
A very unhelpful and selfish comment.

I'd developed this for my own use, and in the spirit of Anki shared it as I thought that it may benefit others. However, a comment of just "doesn't load" makes me think that maybe I'm better to keep my addins to myself.

Could you not even be bothered to post any information that would help diagnose what was wrong, and so help fix it?
on 1575745496
Thank you. Unfortunately the addon does not load. I'm on macOS Mojave, Anki 2.1.15. Here some details:

```
An add-on you installed failed to load. If problems persist, please go to the Tools>Add-ons menu, and disable or delete the add-on.

When loading 'Audio Files':
Traceback (most recent call last):
File "aqt/addons.py", line 80, in loadAddons
File "/Users/aus/Library/Application Support/Anki2/addons21/1984823157/__init__.py", line 12, in <module>
datasource.setConfig(mw.addonManager.getConfig(__name__))
File "/Users/aus/Library/Application Support/Anki2/addons21/1984823157/datasource.py", line 17, in setConfig
self._dir = tempfile.gettempdir() if data['dir'] == '' else data['dir']
KeyError: 'dir'
```
Comment from author
Thank you for this detailed report.

This should have been fixed by the latest release.
on 1574671628
Hi, a question/suggestion:
What happens if there is already a file with the generated name in the media folder? To avoid problems, Awesome TTS has an option to generate randomized filenames.
Comment from author
It will be overwritten.

Thank you for the suggestion, this has been included in the latest release.
on 1573210595
So glad to find this add-on. And huge thanks to the previous commentator for fixing the SSL problem. It works!
Comment from author
I really appreciate your thanks.

If you are learning Russian you may wish to check out my Cloze Generator addin - I wrote that to help myself learn aspect pairs.
on 1571193996
I'm so happy to find this add on. Thank you so much to the creator.

I had to fix the SSL error by changing wiktionary.py like the following

# -*- coding: utf-8 -*-

....
import certifi

class WiktionaryParser(html.parser.HTMLParser):
....
def lookup(self, word):
....
datafile = urllib.request.urlopen(url, cafile=certifi.where())
....

def _download(self, url):
try:
datafile = urllib.request.urlopen(url, cafile=certifi.where())
return datafile.read()
finally:
datafile.close()
Comment from author
Thank you all for pointing out the issue re certificates. I hope to release a new version soon with an additional data source and will include this fix in that.
on 1542869157
I love this, thanks.
on 1538965954
Soooo so glad this exists, thank you so much to the creator, you've made creating Russian flashcards much easier for me.

Just to note, I was receiving an SSL error about certificates whenever I tried to lookup sounds. I fixed this by changing the line

datafile = urllib.request.urlopen(url)

in openrussian.py to

datafile = urllib.request.urlopen(url, cafile='/etc/ssl/certs/ca-certificates.crt')

I'm sure this will also work in wiktionary.py.
Comment from author
I appreciated your thanks - will add the later suggestion of how to fix this when I upload a new version soon