LPC encoding for the Arduino’s Talkie library

Adding new sounds or vocabulary for the Talkie library is not straightforward and I needed a checklist to smoothen the process.
Here are the main steps :

Recording audio with Audacity

  • The recording has to be made at 8 kHz with 16-bit depth
  • Export to Wav signed 16-bit PCM(note that you can also use Audacity to re-sample the audio to 8000 kHz via the [track/re-sample] menu)

Converting sounds using SoX

Alternatively, you can also convert various audio format to 16 bits 8 kHz with SoX, using the following command:

sox audiodump.wav -r8000 -b16 audio-8k.wav

Coding with QBOX pro

QboxPro was made to code sounds for the venerable TMS5220 chip that Talkie library is emulating.

It runs only on an ancient system like Window XP or older

Note: it seems that QBOX doesn’t like when the audio starts immediately. In that case the compressed audio is totally inaudible, so adding a little pause before the sound starts helps a lot

Installation

Get the software here : ftp://ftp.whtech.com/pc%20utilities/qboxpro.zip

Don’t forget to install QBOX at the root of the disk : c:\QBOX and to move the QBOXPRO.ini file to c:\WINDOWS

Coding

The process of coding has already been described in detail here : http://furrtek.free.fr/index.php?a=speakandspell&ss=9&i=2

The process goes like this:

  • Create a new project using the following project parameters : Byte / 8 Khz / 5220 coding table
  • Goto Project and add the audio file
  • Choose process using : medium bit rate and pressing OK
  • Edit concatenation : insert concatenation after by adding a name; then insert phrase and press ok
  • Format it by choosing the first line in the format menu : LPC 10V, 4UV

Arduino code

Recuperate the .bin file that Qboxpro has generated This file contains the LPC stream and need to be translated into C++

I use this small Python script to convert the .bin

Simply paste the script’s outputs at their respective places into the Arduino code and upload

Here is an example I generated with the Mac’s say command (note the 0.3-second silent before the speech starts)[edit : it’s fine with 0.1 too]

say -v"Yannick" "[[slnc 300]] Wir sind die Roboter" -r 100 -o roboter.wave

then I converted to the appropriate format using SoX

sox roboter.wave -r 8k -b16 roboter.wav

After the QBOXpro coding and the Python converting, I copied these lines into the Arduino IDE

and here is how it sounds: