C++ is the language of choice of audio developers and the industry. Its power flexibility and speed serve us well once we invest the time and effort to learn it. While many projects and technologies help to lower the barrier for entry or ease the learning curve, C++ remains very challenging for newcomers, especially for those aiming to learn audio DSP in terms of C++.
Per-Sample C is a C++ compiler environment for new students of audio programming. Based on LLVM/clang and (optionally) the Tiny C Compiler, it compiles a students short C/C++ program each time it changes, generating audio and visualizing the waveforms and spectrums of the resulting signals. The immediacy of the system satisfies the curiosity of the impatient student that might not otherwise choose to learn C++.
Per-Sample C does not try to be a comprehensive framework or tool, like JUCE, and it does not necessarily encourage "best practices" for writing C++, but it is a starting point for students who want to jump directly into audio signal processing in C++.
We recognize Viznut's "Algorithmic symphonies from one line of code" as the single greatest inspiration for this system. Our primary goal is education, but the composition and performance of bytebeat and demoscene music is a secondary aim. More generally, we motivated by questions like "what would GLSL/shaders for audio look like?" and immediacy in programming.
This demo explores techniques in audio synthesis, effects, and music composition in terms of the Per-Sample C environment. These include:
- Frequency Modulation
- Phase Distortion
- Biquad, One-Pole, and Comb Filters
- Delay and Reverb
- Waveshaping
- Sequencing and Envelope Generation
See <
https://youtu.be/FdgVW8AOcMs> for more information.