(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Pre-Recording audio for training and testing with ROAR

Description: This tutorial gives instructions on how to record audio .wav files and use them for training and testing with the ROAR package

Tutorial Level:

It is fully possible to train/test ROAR models with non-realtime audio (pre-recorded clips). In order to do so you just need a to create a few microphone recording .wav files, and then setup your computer physically so that your audio output is patched back to your audio input. This way we can fool ROAR into thinking it is getting real-time audio.

Recording audio to a file

First you will need to record some sound clips to a .wav file so you can use them later for training/detection with ROAR. You should setup your microphone as per the normal roar instructions, and then you can record .wav files using the simple command line script arecord:

 arecord -d 10 -f cd -t wav -D hw:1,0 myfile.wav

The above will record 10 seconds of data to the file myfile.wav directly from Hardware Card 1, Device 0 (you need to figure out what hardware card/device your mic is). If you are using the PR2 Ears you can use "-D plug:left_ear". Listen to your .wav files to make sure they sound OK.

Hardware Setup

In order to use ROAR with pre-recorded audio files you will need an audio patch cable (a male-to-male audio jumper cable). You need to connect the "Output" (speaker plug) of your computer to the "Line-In" jack.

Software Setup

Now you need to go in to alsamixer and set your "Output" and "Line-In" channels to have 0.0db of Gain, this way you aren't distorting the audio clip. Set the "Master" and "PCM" in the Playback tab to 0.0db gain (gain is indicated in the top-right), and "Capture" to 0.0db in the Capture tab. Also set "Input Source" in the Capture tab to "Line". Now you are ready to run ROAR and your soundcard output should be set to loop back to your soundcard input.

Running ROAR

You can now launch either the roar/Tutorials/Trainer or roar/Tutorials/Detector. You will need to make sure you setup roar to use your "Line-In" as the default microphone. If you want to simulate your recorded sounds you just need to play them back on your computer. One way to do that is with the aplay command:

 aplay myfile.wav

Wiki: roar/Tutorials/Working with recorded audio data (last edited 2011-08-12 02:53:26 by JoeRomano)