You are viewing an older revision! See the latest version

RS Audio Codec

The audio codec board mounted on the RS Animatronic Lab Board

This page provides information and some examples for the use of the RS Audio Codec sub board, based on TI's TLV320 chip. This chip provides a high quality audio link out and in to the mbed with IO including: an amplified stereo headphone out, an stereo line out, a stereo line in and an pre-amped mono microphone input. Such a capable chip opens up a lot of options for high quality audio on mbed.

One can get this board from RS: AudioCODEC for mbed

The easiest way to get something working is to load a test wave file (such as this one or this one) onto a flash drive, plug it into the Lab Board and load up this program:

Import program

00001 // This is all set up for the RS Labboard: Just plug a memory stick with a wav file called test.wav on it and have a listen!
00002 
00003 #include "mbed.h"
00004 #include "WavPlayer.h"
00005 #include "MSCFileSystem.h"
00006 
00007 MSCFileSystem msc("msc"); // Mount flash drive under the name "msc"
00008 WavPlayer player;
00009 
00010 int main() {
00011     FILE *fp = fopen("/msc/test.wav", "r");  // Open "out.txt" on the local file system for writing
00012     player.open(&fp);
00013     player.play();
00014     fclose(fp);
00015 }

/media/uploads/p07gbar/animatronics_labboard_audio_set_up.png

The easiest way to get something working is to load a test wave file (such as this one or this one) onto a flash drive, plug it into the Lab Board and load up this program:

Import programWavPlayer_test

A test program for the WavPlayer class, works on the RS Animatronic Lab Board

or just this one:

Import programTLV320_Write_test

A test program for the TLV320, Generates some sine waves.

Both programs use the TLV320 library and the I2S library:

Import libraryI2S

A well tested I2S library where the send and recieve parts are seperate instances.

Import libraryTLV320

A fairly well tested TLV320 library for I2C configuration and control of the TI TLV320 part

A WAV library was written to make the process of playing wave files easier:

Import library

Public Member Functions

WavPlayer ()
Create a WavPlayer instance.
WavPlayer (FILE **fpp)
Create a WavPlayer instance.
void open (FILE **fpp)
Set the file to read out of.
int getConfig ()
Extract the header infomation, automatically called by open.
float play ()
Play the entire file.
float play (float time)
Play the file for a certain number of seconds.
float play (float start, float timefor)
Play the file for a certain number of seconds, from a certain start point.

All wikipages