CURRENT ISSUE
Contests
Feature Article
|
|
Issue #207 October 2007
Embedded Speech
Speech Synthesis for Small Applications
by Nicusor Birsan & Ionut Tarsa
Start |Embedding Speech | Speech Synthesis Techniques | Open-Source Project | System Building Blocks | Sound From Luminary Micro | First Big Porting Problem | Synthesizer | Translator | The LM3S811 Speaks | More Speech Applications | Sources & PDF
SOUND FROM LUMINARY MICRO
Our first task was to develop a “sound driver” and a small application for testing. We wanted the driver to be as simple as possible (i.e., sound generation could be a secondary feature in a control application).
In terms of the hardware, things are very simple. Only DC blocking and a low-pass filter are needed (see Figure 2). Due to the high frequency of the Luminary Micro LM3S811’s PWMs, an RC filter was enough for a 35-dB rejection at the PWM frequency. The resistor value we chose did not exceed 8 mA, the maximum current of the LM3S811’s ports. (Appropriate settings must be done in the initialization routine too.) With this simple circuit, we can drive low-power headphones or an amplifier (e.g., the line-input of a sound blaster, giving us an opportunity to perform waveform analysis or store the generated sound on the hard disk). There is no need for any circuitry if the amplifier is class D (e.g., the TPA family from Texas Instruments).
Building the hardware was as simple as soldering a few components and a jack (see Photo 1). This was the only hardware we needed to finish the project.
![]() |
| Photo 1—The LM3S811 evaluation board is speaking “stereo” through the PWM1 peripheral. |
The basic functionality of the driver is to output samples to a PWM peripheral from a circular buffer. The buffer is filled as the interrupt routine eats samples based on a double-buffering technique. While the interrupt generates from one half of the buffer, the application fills the other half (see Listing 1).
We used indices instead of pointers to get a more optimized implementation based on the index addressing mode of the new RISC microcontrollers. This way, the time spent in interrupt routines is significantly reduced. By choosing the length of the buffer as a power of two, testing which half is currently “playing” is much easier. (Test only the most significant bit of snd_ix index.) More importantly, it is easy to keep the index within the range of the buffer with only an AND instruction.
To test the driver, a WAV file was generated using eSpeak. The file was stored in a constant array in flash memory. (Refer to the TestDrv project on the Circuit Cellar FTP site.)
The first time that we tried the system, it was a success. The sound generated was the same as the sound from a desktop speaker. Hearing the small LM3S811 evaluation board speak “Circuit Cellar and Luminary Micro Contest” motivated us to continue.
|
