How to build a test environment for audio DSP code in C using GNU/Linux

Gabriel RivasFebruary 12, 20112 comments

This may be useful for people that want to try audio DSP algorithms in C.

You will need:

  1. Hardware: You will need regular a PC (not older than a Pentium 3) or small PC will do the job.
  2. Sound card: This PC should have a soundcard, at least with one mic input and one headphones output.
  3. I/O: You will need, speakers or headphones and a microphone, or some cable the connect the source of the sound to the PC that will be doing the audio processing.
  4. Software: You will need a GNU/Linux distribution with at least OSS (Open Sound System) audio driver and GCC compiler.

The Open Sound System is one of the the first Linux driver built, and like other devices like Ethernet and serial ports, it has a well defined API and abstraction models of different audio devices like soundcards, DSPs, synthesizers, MIDI devices, etc. You can download the OSS programming guide at

I use the Fedora Core 6 distribution because I am using old PCs to this (a 7 years old PC and a 5 years old PC).

You will require also some Linux basic skills like browsing directories, compiling with GCC and so on. It would be better if you know how to install the Linux distribution, if you don’t know how to do it, there are plenty of HOWTOs guides in the web.

Once you have everything installed, the next thing you do is setting the soundcard. In the OS desktop you can do this by setting the mic input for recording, and also set the capture option.

When you have the soundcard configured then you can copy the code listed at and create a .c file with it, and compile it with GCC, there should not be any problem.

Then run the compiled program and you should be able to connect an audio signal in the mic input and hear that signal in the headphones or speakers output of the PC.

[ - ]
Comment by mboignerFebruary 14, 2011
Wouldn´t it be better to go with ALSA which is much newer? Or use some sound "middleware" like PulseAudio? OSS is pretty old...
[ - ]
Comment by grivasFebruary 14, 2011
OSS still have big demand, and is good enough to use it as an audio processing engine. Maybe for more advanced applications ALSA and other software may be better.

To post reply to a comment, click on the 'reply' button attached to each comment. To post a new comment (not a reply to a comment) check out the 'Write a Comment' tab at the top of the comments.

Registering will allow you to participate to the forums on ALL the related sites and give you access to all pdf downloads.

Sign up

I agree with the terms of use and privacy policy.

Try our occasional but popular newsletter. VERY easy to unsubscribe.
or Sign in