Skip to content

Running an Audio Sketch on the Desktop

Phil Schatzmann edited this page Feb 5, 2022 · 25 revisions

Sometimes it is just to tedious to deploy and test a sketch on a Microcontroller - specially when you don't have all the wires of your hardware connected or expect to run thru many validation cycles.

This project can also be used to output the sound on Linux, Windows and OS/X.

You just need to provide an Arduino Sketch as cpp file together with this CMakeLists.txt example file. Just replace the example generator.cpp with your cpp file in the add_executable line.

In your sketch you can use the PortAudioStream class which uses PortAudio to input or output audio.

The CMakeLists.txt file automatically downloads all dependencies (including the arduino-audio-tools project).

You can build the executable with:

mkdir build
cd build
cmake ..
make

A full example can be found in the examples-desktop directory.

Clone this wiki locally