I have some ideas for audio projects using raspberry pi and Linux and PortAudio seems to be a pretty standard library for getting audio I/O from the machine. Also its cross platform and written in C.
On a Linux machine download the latest PortAudio release from their website.
wget http://portaudio.com/archives/pa_stable_v190600_20161030.tgz
Then follow the instructions on their installation page. We need to install ALSA first.
sudo apt-get install libasound-dev
Then extract the downloaded code.
tar -xzvf pa_stable_v190600_20161030.tgz cd portaudio
It is easy to build the software, run
./configure && make
To install portaudio on our system so we can import it in our programs use:
sudo make install
To test everything is working correctly, we can change into the examples directory and run one of the examples.
cd examples/
We can compile an example using gcc and link in the extra dependencies. The “-l”s are where we link in extra code.
gcc -o pa_devs pa_devs.c -lrt -lasound -ljack -lpthread -lportaudio
Running the compiled pa_devs program should print out information about each of the connected audio devices on the system
./pa_devs