This repository demos pumping audio from the default input device (e.g. a microphone) to the default output device (e.g. headphones/speakers) in C99. In other words: this demo records audio, and it plays back audio.
There are four editions:
- one for PortAudio using asynchronous callbacks —
portaudio_async_pump_demo.c
, - one for SDL 2 —
sdl2_audio_pump_demo.c
, - one for the Simple API of PulseAudio —
pulseaudio_simple_pump_demo.c
, - one for the Asynchronous API of PulseAudio —
pulseaudio_async_pump_demo.c
.
The code is Software Libre licensed under GPL v3 or later.
- libpulse
- libpulse-simple
- PortAudio
- SDL 2.x
e.g.:
# sudo apt install --no-install-recommends --yes -V \
build-essential \
libpulse-dev \
libsdl2-dev \
portaudio19-dev
# make CFLAGS='-O2 -pipe' -j
# ./portaudio_async_pump_demo
# ./pulseaudio_async_pump_demo
# ./pulseaudio_simple_pump_demo
# ./sdl2_audio_pump_demo
- Ctrl+C — exit