-
Notifications
You must be signed in to change notification settings - Fork 1
Generation of Audio Files
Initially I used the TTS functionality of google translate to generate the mp3 files. 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
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. Or you can use the bash script created by Ashley Cox.
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.
The generated mp3 files can be used directly with the AudioDictionarySD. In order to provide them as parameter to a AudioDictionary (which uses audio data from PROGMEM) you just need to prepare your own array with all relevant data:
#include "and.h"
#include "billion.h"
AudioDictionaryEntry MyAudioDictionaryValues[] = {
{"AND", new MemoryStream(and_mp3, and_mp3_len)},
{"BILLION", new MemoryStream(billion_mp3, billion_mp3_len)},
// must end with nullptr to mark end
{nullptr, nullptr}
};
AudioDictionary dictionary(MyAudioDictionaryValues);