Teach your MCU to talk: AN11085 Speex on LPC175x/6x

Teach your MCU to talk: AN11085 Speex on LPC175x/6x

A growing number of applications, including VoIP, voice messaging, internet audio streaming, and audio books, involve the recording and playback of human speech. To support these applications, we’ve developed source code and a sample application for running Speex, the open-source, royalty-free software codec for voice data. The sample application demonstrates playback and/or record functions, and can be used with the LPC175x and LPC176x microcontrollers, which are based on Cortex-M3 cores. The sample application is also compatible with Keil MDK, IAR EWARM, and the LPCXpresso IDE. Click here to access AN11085 : Using Speex in NXP’s LPC175x/6x MCU family

Speex and the LPC1700 series
Originally designed as a no-cost alternative to expensive speech codecs, Speex is a free audio compression format, designed specifically for speech and based on Code-Excited Linear Prediction (CELP), that compresses voice signals at bitrates ranging from 2 to 44 kb/s. The Speex format offers three features not found in similar codecs: intensity stereo encoding, integration of multiple sampling rates in the bitstream (embedded coding), and a variable bit rate (VBR) mode. The result is a voice codec (vodec) format that delivers high-quality speech at a low bit rate. (For more on Speex, visit this site.)

The LPC175x/6x, which is built around a low-power Cortex-M3 core that operates at up to 120 MHz, is powerful enough and has sufficient SRAM to run the Speex codec without optimization. Adding some of the pre-processor functions in the Speex software library, such as reseampler and echo cancellation, can help boost the audio quality.

The sample application
For our sample application, we started with a development board from Code Red Technologies that includes an LPC1768 and several hardware options for evaluating and testing LPC1768 features. One of the ICs integrated onto the board is an NXP UDA1380 I2S stereo codec, which includes sound processing features in playback mode, de-emphasis, volume, mute, bass boost, and treble. The demo board also has an input for the ADC and an output for the DAC pins, allowing the application to integrate various working modes and merge the use of the converters and the I2S codec interface. Figure 1 gives a block diagram of the design.

Figure 1. LPC17xx Speex application using an NXP I2S codec and ADC/DAC converters

The design processes the audio signal, enhancing the bandpass related to the voice spectrum frequencies, then encodes, decodes, filters, and finally amplifies the signal. The application software processes Speex data, capturing it from ADC or I2S and delivering it to DAC or I2S. The application supports use of ADC and DAC converters in case an I2S codec isn’t available.

We programmed the application to perform two functions: record and playback. The record function uses a routine call to obtain the audio stream from the from the I2S or ADC input , encodes the stream, and then stores it in RAM. The playback function loads a voice audio stream (previously stored in RAM), decodes it, and then delivers it to the I2S or DAC output.

Sample boards
The application note AN11085 gives examples of three LPC175x6x evaluation boards — the Code Red RDB1768v2, the Keil MCB1700, and the IAR LPC1768-SK — that have been configured for the Speex demo. The playback function is available on all three boards; the record function is only available with the Code Red and IAR boards.

The application note gives a full description of the design, with codec settings, Speex parameters, and recommendations for using the libSpeex library. It also gives flowcharts for the record and playback processes, as well as guidelines for the audio I/O and the user interface.

How will you use it?
Our application team has created the starting point for a Speex-equipped system, but the rest is up to you. Let us know how you might use Speex in your next design!

LPCzone
LPCzone
We are here to deliver the latest and greatest news to developers using our LPC families of microcontrollers. Follow @LPCZone on Twitter, Facebook, and LinkedIn ~ and you will have the most up-to-date information on the LPC product families.

1 Comment

  1. […] use an audio codec of some kind. This site's sponsor, NXP, recently released information on Speex, an open-source, royalty-free audio processing library that includes such a […]

Buy now