I like the advice above regarding libao - I just tried it and it works great. Here's a similar level of difficulty using OpenAL to render audio
// sudo apt-get install libopenal-dev // gcc -o openal_play_monday openal_play_monday.c -lopenal -lm #include <stdio.h> #include <stdlib.h> // gives malloc #include <math.h> #ifdef __APPLE__ #include <OpenAL/al.h>
If you want to push OpenAL further ...
https://github.com/scottstensland/render-audio-openal
Out of the box, OpenAL perfectly reproduces the PCM audio buffer ... however, as an exercise, it leaves the ability to play the stream. In this GitHub repository, I wrote an audio server using OpenAL, which implements playback of streaming audio ...
source share