PortAudioPlayRec

From Sphinx

Contents

Instructions

NOTE: if not downloaded by /usr/src/ it must be inside of the same directory where the directory as portaudio is situated, otherwise the Makefile will need to be modified so to specify the correct location of the directory as portaudio.

  • Build and install standard portaudio libraries
cd /usr/src/portaudio
./configure --prefix=/usr
make all
sudo make install
  • Build and install C++ binding library
cd /usr/src/portaudio/bindings/cpp/build/gnu
chmod u+x configure
./configure --prefix=/usr
make all
sudo 
sudo cp -f ../../lib/libportaudiocpp.* /usr/lib 
  • Build the sample program:
cd /usr/src/PortAudioRecPlay
make
  • Run the program
./PortAudioRecPlay

Hit enter, there will be a low frequency foghorn (aka beep) .. start speaking AFTER it finishes, then hit enter again. Your recording will be be immediately played back to you.

Troubleshooting

Multiple sound devices

If you have multiple sound devices (like a sound card and a USB mic), you may have to experiment to find out which device is which. The input/output device to use can be specified on the command line:

PortAudioRecPlay [input device index] [output device index]

Mic volume

Make sure the mic is enabled and has the volume turned up. In Ubuntu, I had to switch devices using System->Sound->Sounds->Default sound card and the "alsamixer" utility to get both my analog and USB mics to record.

Unable to find libraries

The executable file is dynamically linked to the portaudio libraries, etc. So it will break on systems that don't have these installed.

Crashing

At least in the stable release v19 of PortAudio, the OSS implementation sometimes crashes due to an assertion. The latest development release fixes this, but the rest of the development tree won't build. So I included the file pa_unix_oss.c in the SphinxSimpleRec.zip file. I suggest copying over the fixed version into portaudio/src/hostapi/oss

related