I the last Blog I introduced you to my new Simple TTS Arduino Library which is available on Github.

I used the Text-to-Speech (TTS) functionality of Google Translate to generate the mp3 files, which was quite tedious to do manually. Then I executed xxd to generate a .h file from an mp3 recording with:

xxd -i mp3file.mp3 header-file.h

The header files are then made available with the logic that can be found in AudioDictionary.h

Tools

You can prepare your own audio data easily with the help of a CSV file. Details can be found in the Jupyter Notebook in the tools directory of the project.

CSV File Format

The input CSV file has the following format:

Name, Text
zero, zero
one, one
two, two
three, three
four, four
five, five
six, six
@menu1, Hallo this is the main menu
...

The first field is used to identify the audio information and to generate the file name and is case insensitive. This value is passed as key to the audio generation class. Please note that you should only use a short name w/o special characters because this will be used as file name on a SD drive!
The second field is used as input to generate the audio file.
Usually both values are the same. However you could decide to record some long text under a short name. In this case we recommend to start the name with a @ character.


0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *