[sdiy] Raspberry Pi 2 B Synthesizer Project Progress

Scott Gravenhorst music.maker at gte.net
Tue Mar 15 19:58:52 CET 2016

More progress - the current version works with latency (MIDI note-on 
receipt to start of sound) of 2 milliseconds.

Now that I finally understand how the buffer usage algorithm works for 
ALSA, I started reducing the buffer size until it stopped working.  4 
periods caused error messages from ALSA where 6 periods ran smoothly.

6 periods or 48 frames at 44.1 ksps is about 1.09 milliseconds.

It turned out that for the example program I started with (from the ALSA 
project) the buffer had originally been set up to provide flawless audio 
in a system with a lot of user stuff going on.  It's not a problem in 
that environment for someone's MP3 to start playing some few 
milliseconds after clicking the play button, so the buffer being rather 
large allows for fits and starts of other CPU activity.  For the Rpi2, 
I've been able to set audio to have a period size of 8 frames and a 
buffer size of 6 periods.  This provides about 1 millisecond of latency 
from ALSA and the rest comes from various sources including the MIDI 
controller.  With these new settings I tested the synth for about 3 
hours (pretty much continuously) and found no problems, no audio 
glitches and no error indications from the synth or from ALSA.

At 2 milliseconds, it's my opinion that the Raspberry Pi 2 B is a worthy 
platform for synth development in C.

Note that this is with Xorg running, so there's also the possibility of 
a GUI based front panel with patch controls.

-- Scott

More information about the Synth-diy mailing list