This project contains a C command-line demo for PvSpeaker that demonstrates how to use PvSpeaker to play audio from a single-channel PCM WAV file.
PvSpeaker is an easy-to-use, cross-platform audio player designed for real-time speech audio processing. It allows developers to send raw PCM frames to an audio device's output stream.
- CMake 3.4+.
- C99 compatible compiler.
- Windows: MinGW.
- Linux (x86_64)
- macOS (x86_64, arm64)
- Windows (amd64, arm64)
- Raspberry Pi (3, 4 and 5)
Run the following commands to build the demo app:
git submodule update --init --recursive
cmake -S . -B build -DPV_SPEAKER_PLATFORM={PV_SPEAKER_PLATFORM}
cmake --build build
The {PV_SPEAKER_PLATFORM}
variable will set the compilation flags for the given platform. Exclude this variable
to get a list of possible values.
To see the usage options for the demo:
./pv_speaker_demo
Get a list of available audio player devices:
./pv_speaker_demo --show_audio_devices
Play from a single-channel PCM WAV file with a given audio device index:
./pv_speaker_demo -i test.wav -d 2
Hit Ctrl+C
if you wish to stop playing audio before it completes. If no audio device index (-d
) is provided, the demo will use the system's default audio player device.