Working on a stable setup

Next step for the synth module project was to get the Raspberry Pi 2 to run in a stable manner. It seems like I’m getting close or that I’m already there. First I built a new RT kernel based on the 4.1.7 release of the RPi kernel. Therefore I had to checkout an older git commit because the RPi kernel is already at 4.1.8. The 4.1.7-rt8 patchset applied cleanly and the kernel booted right away:

pi@rpi-jessie:~$ uname -a
 Linux rpi-jessie 4.1.7-rt8-v7 #1 SMP PREEMPT RT Sun Sep 27 19:41:20 CEST 2015 armv7l GNU/Linux

After cleaning up my cmdline.txt it seems to run fine without any hiccups so far. My cmdline.txt now looks like this:

dwc_otg.lpm_enable=0 dwc_otg.speed=1 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootflags=data=writeback elevator=deadline rootwait

Setting USB speed to Full Speed (so USB1.1) by using dwc_otg.speed=1 is necessary otherwise the audio coming out of my USB DAC sounds distorted.

I’m starting ZynAddSubFX as follows:

zynaddsubfx -r 48000 -b 64 -I alsa -O alsa -P 7777 -L /usr/share/zynaddsubfx/banks/SynthPiano/0040-BinaryPiano2.xiz

With a buffer of 64 frames latency is very low and so far I haven’t run into instruments that cause a lot of xruns with this buffer size. Not even the multi-layered ones from Will Godfrey.

So I guess it’s time for the next step, creating a systemd startup unit so that ZynAddSubFX starts at boot. And it would be nice if USB MIDI devices would get connected automatically. And if you could see somehow which instrument is loaded, an LCD display would be great for this. Also I’d like to have the state of the synth saved, maybe by saving an .xmz file whenever there’s a state change or on regular intervals. And the synth module will need a housing or casing. Well, let’s get the software stuff down first.

Working on a stable setup

Building a synth module using a Raspberry Pi

Ever since I did an acid set with my brother in law at the now closed bar De Vinger I’ve been playing with the idea of creating some kind of synth module out of a Raspberry Pi. The Raspberry Pi 2 should be powerful enough to run a complex synth like ZynAddSubFX. When version  2.5.1 of that synth got released the idea resurfaced again since that version allows to remote control a running headless instance of ZynAddSubFX via OSC that is running on for instance a Raspberry Pi. I looked at this functionality before a few months ago but the developer was just starting to implement this feature so it wasn’t very usable yet.

zynaddsubfx-ext-guiBut with the release of ZynAddSubFX 2.5.1 the stabilitity of the zynaddsubfx-ext-gui utility has improved to such an extent that it’s a very usable tool. In the above screenshot you can see zynaddsubfx-ext-gui running on my notebook with Ubuntu 14.04 controlling a remote instance of ZynAddSubFX running on a Raspberry Pi.

So basically all the necessary building blocks for a synth module are there. Coupled with my battered Akai MPK Mini and a cheap PCM2704 USB DAC I started setting up a test setup.

For the OS on the Raspberry Pi 2 I chose Debian Jessie as I feel Raspbian isn’t getting you the most out of your Pi. It’s running a 4.1.6 kernel with the 4.1.5-rt5 RT patch set, which applied cleanly and seems to run so far:

pi@rpi-jessie:~$ uname -a
Linux rpi-jessie 4.1.6-rt0-v7 #1 SMP PREEMPT RT Sun Sep 13 21:01:19 CEST 2015 armv7l GNU/Linux

This isn’t a very clean solution of course so let’s hope a real 4.1.6 RT patch set will happen or maybe I could give the 4.1.6 PREEMPT kernel that rpi-update installed a try. I packaged a headless ZynAddSubFX for the RPi on my notebook using pbuilder with a Jessie armhf root and installed the package for Ubuntu 14.04 from the KXStudio repos. I slightly overclocked the RPi to 1000MHz and set the CPU scaling governor to performance. The filesystem is Ext4, mounted with noatime,nobarrier,data=writeback.

To get the USB audio interface and the USB MIDI keyboard into line I had to add the following line to my /etc/modprobe.d/alsa.conf file:

options snd-usb-audio index=0,1 vid=0x08bb,0x09e8 pid=0x2704,0x007c

This makes sure the DAC gets loaded as the first audio interface, so with index 0. Before adding this line the Akai would claim index 0 and since I’m using ZynAddSubFX with ALSA it couldn’t find an audio interface. But all is fine now:

pi@rpi-jessie:~$ cat /proc/asound/cards
 0 [DAC            ]: USB-Audio - USB Audio DAC
                      Burr-Brown from TI USB Audio DAC at usb-bcm2708_usb-1.3, full speed
 1 [mini           ]: USB-Audio - MPK mini
                      AKAI PROFESSIONAL,LP MPK mini at usb-bcm2708_usb-1.5, full speed

So no JACK as the audio back-end, the output is going directly to ALSA. I’ve decided to do it this way because I will only be running one single application that uses the audio interface so basically I don’t need JACK. And JACK tends to add a bit of overhead, you barely notice this on a PC system but on small systems like the Raspberry Pi JACK can consume a noticeable amount of resources. To make ZynAddSubFX use ALSA as the back-end I’m starting it with the -O alsa option:

zynaddsubfx -r 48000 -b 256 -I alsa -O alsa -P 7777

The -r option sets the sample rate, the -b option sets the buffer size, -I is for the MIDI input and the -P option sets the UDP port on which ZynAddSubFX starts listening for OSC messages. And now that’s the cool part. If you then start zynaddsubfx-ext-gui on another machine on the network and tell it to connect to this port it starts only the GUI and sends all changes to the GUI as OSC messages to the headless instance it is connected to:

zynaddsubfx-ext-gui osc.udp://

Next up is stabilizing this setup and testing with other kernels or kernel configs as the kernel I’ve cooked up now isn’t a viable long-term solution. And I’d like to add a physical MIDI in and maybe a display like described on the Samplerbox site. And the project needs a casing of course.

Building a synth module using a Raspberry Pi

LAC2014: submission accepted!

My submission for the Linux Sound Night at LAC2014 with The Infinite Repeat has been accepted. The Call for Papers page mentions the term “danceable” so I’m going to focus on that. Making danceable music is quite a challenge for me but it should definitely be doable to produce a solid set, especially now that I’m the proud owner of a Korg Volca Keys. I’m definitely going to integrate it in my current setup as the Volca reacts great on MIDI sent from my workstation. It has some fat sounds that just scream dance floor.

Korga Volca Keys

I’m really looking forward to this year’s LAC. It seems falkTX and avlinux are going too, it’d be great to meet these guys in real life!

LAC2014: submission accepted!

Raspberry Jam Review

Last Thursday the first Dutch Raspberry Jam took place at the Ordina HQ in Nieuwegein. I offered to do a presentation slash demonstration about realtime audio and the the Raspberry Pi so I promised myself to be there at least an hour before the scheduled starting time of my demo. That way I could also join Gert van Loo‘s presentation. When I arrived at 19:15 there was no Gert van Loo though so that should’ve triggered some alarms. Also I didn’t look out for members of the organization as soon as I came in. Instead I chose to dot the i’s and cross the t’s with regards to my demo.

Wrong decision.

About half an hour later the event was closed.


I approached the person who closed the event and introduced myself. He replied that they thought I wasn’t coming anymore. Apparently they misinterpreted my e-mail I sent earlier that day that I didn’t manage to produce something workable for the laser show guy. They took it for a cancellation. But immediately the event got kind of reopened and I set up my stuff. We had some audio issues but in the end everything went quite well actually. I showed off what is possible with a Raspberry Pi and realtime audio with the use of some of my favorite software. Guitarix featured of course. I grabbed my guitar, fired up guitarix on the RPi and played some stuff. Hooked up my MIDI foot controller and showed how to select different presets. I also demonstrated the use of the RPi as a piano with the help of LinuxSampler and the awesome Salamander Grand Piano samplepack and did some drumming by using drumkv1. Before the realtime audio demo I presented an overview of the Linux audio ecosystem and talked about the alternatives of how to get sound in and out of your Raspberry Pi. These alternatives are not bound to the onboard sound and USB, since recently it is also possible to hook up an external audio codec to the I2S bus of the Raspberry Pi. I got one in myself this week, a MikroElektronika Audio Codec PROTO board based on the WM8731 codec, so more on that soon. It’d be awesome if I can get that codec to work reliably at lower latencies.

So it all turned out well, I had a great time doing my presentation and judging by the interest shown by some attendants who came up to me after the presentation I hope I got some more people enthusiastic about doing realtime audio with the Raspberry Pi and Linux. So thanks Ordina for offering this opportunity and thanks everyone who stuck around!

Raspberry Jam Review

Ardour with video and LV2 MIDI plugins chaining support

Got so absorbed hacking my UG802 that I completely missed this:

So not only can you add video to your Ardour project but now it’s also possible to chain multiple LV2 plugins that accept MIDI. The video support is the great work of Robin Gareus and it was actually a presentation on this functionality that got me acquainted with the Linux Audio meetings at the HKU almost 3 years ago. So yes, he’s been working on it quite a while so I assume it works well.

I have actually never worked with Ardour, I’ve always used Qtractor. But maybe it’s getting time to check out Ardour too, especially now that the MIDI part is stabilizing.

Ardour with video and LV2 MIDI plugins chaining support

Raspberry Pi als virtuele gitaarversterker: MIDI en effecten

Live demo van m’n Raspberry Pi, guitarix en een MIDI floorboard.

Raspberry Pi als virtuele gitaarversterker: MIDI en effecten

Eerste DX bestelling binnen

M’n MIDI to USB kabel en oprolbaar USB drumpad zijn binnen.

MIDI to USB kabel:

jeremy@piertje:~$ cat /proc/asound/cards
 1 [USB20MIDI      ]: USB-Audio - USB2.0-MIDI
                      USB2.0-MIDI at usb-0000:00:1d.0-1, full speed

USB drumpad werd in eerste instantie niet goed herkend:

jeremy@piertje:~$ lsusb
Bus 005 Device 014: ID 1941:8021 Dream Link WH1080 Weather Station / USB Missile Launcher

USB Missile Launcher? Even googlen, ah:
Maar dan nog, ik weet toch bijna zeker dat dit ding gewoon meteen hoort te werken. Dus even checken met het drumpadje wat ik in bruikleen heb:

jeremy@piertje:~$ lsusb
Bus 005 Device 015: ID 0218:0001 Hangzhou Worlde

Dus er klopt iets niet helemaal, moet recht te trekken zijn. Na wat verder gegoogled te hebben kwam ik hier op uit:

Code gecompiled en het draait. Maar vrees dat ik de drumpad niet met mijn RPi kan gebruiken want de drumroll binary verstookt op mijn notebook al 4% aan CPU. Maar zien wat ik met de drumpad ga doen, sowieso kijken of ik er ergens een kan vinden die wel een USB MIDI device is.

Eerste DX bestelling binnen


Oftewel DealExtreme. Eigenlijk een beetje herontdekt door de buurtgenoot die hier laatst op bezoek was. Hij had een oprolbaar USB drumpadje mee en dat vond ik zo’n cool ding, moest ik ook hebben. Uiteindelijk kwam ik dus uit op DealExtreme waar ik wel eerder spulletjes had besteld. Het gaat om dit drumpadje:

Niet aanslaggevoelig ofzo maar het padje stuurt wel keurig MIDI CC messages uit over MIDI kanaal 10. Ik heb zo’n idee dat dit één van de goedkoopste USB MIDI controllers is die je momenteel kunt krijgen. Ik denk dat ik ‘m ga demonteren om er een USB MIDI footswitch van te maken. Heb er gelijk een USB MIDI kabel bij besteld:

$5.99, dat kun je niet laten liggen toch? Ik ga deze gebruiken om mijn Boss FC-50 MIDI footswitch aan mijn Raspberry Pi te hangen. Ik kan namelijk de MIDI poorten op mijn Edirol UA-25 niet gebruiken aangezien deze het alleen doen als de UA-25 in Advanced mode staat en dat staat momenteel uit omdat anders JACK niet werkt op mijn RPi icm. de UA-25. Hopelijk werkt het wel met dit cheapo kabeltje. Binnenkort ga ik ook deze bestellen:

Ziet er bekend uit hè? Het is gewoon hetzelfde apparaat als de Behringer UCG102!

De UCG102 is al goedkoop (rond de €25,-) maar op DealExtreme kost dit apparaatje slechts $14.80! Samen met de USB MIDI kabel ga ik deze gebruiken met mijn RPi. Kijken of ik een cheapo customizable gitaarversterkeremulatieapparaatje kan bouwen voor minder dan €50,-.


De wederopstanding van PHASEX

PHASEX leeft weer! De oorspronkelijke ontwikkelaar heeft de draad weer opgepakt en een nieuwe release uitgebracht. Heb er nog niet uitgebreid naar kunnen kijken maar hij heeft de boel flink onder handen genomen. Uiteraard zijn de nodige bugs gefikst maar daarnaast is de functionaliteit van PHASEX flink uitgebreid: je kan nu meerdere parts tegelijkertijd gebruiken (dus geen losse instances meer), support voor JACK MIDI en JACK Transport en PHASEX kan nu zonder GUI gebruikt worden. Ook heeft de GUI een update gehad en zijn er de nodige filters toegevoegd en bestaande filters verbeterd.

Al met al goed nieuws, PHASEX is een erg goed klinkende synthesizer waar je echt heel veel uit kan halen. Als de ontwikkelaar dit alles nou ook nog in een LV2 plug-in zou kunnen stoppen…


PHASEX 0.14.97

De wederopstanding van PHASEX