Raspberry Pi Revisited

When the Raspberry Pi 2 was released I certainly got curious. Would it be really better than it’s little brother? As soon as it got available in The Netherlands I bought it and sure this thing flies compared to the Raspberry Pi 1. The four cores and 1GB of memory are certainly an improvement. The biggest improvement though is the shift from ARMv6 to ARMv7. Now you can really run basically anything on it and thus I soon parted from Raspbian and I’m now running plain Debian Jessie armhf on the RPi.

So is everything fine and dandy with the RPi2? Well, no. It still uses the poor USB implementation and audio output. And it was quite a challenge to prepare it for its intended use: a musical instrument. To my great surprise a new version of the Wolfson Audio Card was available too for the new Raspberry Pi board layout so as soon as people reported they got it to work with the RPi2 I ordered one too.

 

http://community.emlid.com/t/raspberry-2-realtime-kernel-image/112/12

Cirrus Logic Audio Card for Raspberry Pi

One of the first steps to make the device suitable for use as a musical device was to build a real-time kernel for it. Building the kernel itself was quite easy as the RT patchset of the kernel being used at the moment by the Raspberry Foundation (3.18) applied cleanly and it also booted without issues. But after a few minutes the RPi2 would lock up without logging anything. Fortunately there were people on the same boat as me and with the help of the info and patches provided by the Emlid community I managed to get my RPi2 stable with a RT kernel.

Next step was to get the right software running so I dusted off my RPi repositories and added a Jessie armhf repo. With the help of fundamental the latest version of ZynAddSubFX now runs like charm with very acceptable latencies, when using not all too elaborate instrument patches Zyn is happy with an internal latency of 64/48000=1.3ms. I haven’t measured the total round-trip latency but it probably stays well below 10ms. LinuxSampler with the Salamander Grand Piano sample pack also performs a lot better than on the RPi1 and when using ALSA directly I barely get any underruns with a slightly higher buffer setting.

I’d love to get Guitarix running on the RPi2 with the Cirrus Logic Audio Card so that will be the next challenge.

Raspberry Pi Revisited

23 thoughts on “Raspberry Pi Revisited

  1. Hi,
    Emlid kernel is a fork from https://github.com/Clouded . Afaik Emlid developes the rt kernel for Raspberry Pi and Odroid-C1 to get their drone project running.
    Is it better to use the Clouded or the Emlid sources?
    By the way: For musical and some other hardware projects I’m runnung a rt kernel on my Odroid-C1. Unfortunately yoshimi (you are a co-developer, aren`t you?)shows me a black surface in the odroid gui. Is there a possibility to configure yoshimi to set another contrast?
    Best regards
    Georg

  2. Hello Georg, I’m not using the Emlid/Clouded sources so I don’t see why you would use those sources. How’s the Odroid C1? And I don’t work on Yoshimi anymore, I’d recommend using ZynAddSubFX, especially the latest release (2.5.0). Also, try to run Yoshimi without a GUI, that way you save A LOT of precious CPU cycles 😉

  3. Hi Jeremy,
    yep, you are right. Without GUI should be much better for a good performance.
    The ODROID-C1 is running fine.
    Disadvantage: uname -r -> 3.10.72-rt77
    Advantage: Better USB-Bus than RPI2, Gigabit-LAN
    Where do I find some examples for running ZynAddSubFX from commandline. How can I change the banks/sounds from commandline?

  4. Hi Georg, I’m ok with 3.10, I’ve seen some cyclictest results and those looked promising. I’m mainly interested in the extra CPU power of the Odroid C1. A better USB implementation would be welcome too, especially when doing full duplex stuff the RPi doesn’t really shine.

    Running ZynAddSubFX headless can be done like this:
    @zynaddsubfx -r 48000 -b 64 -I alsa -O alsa -L /usr/share/zynaddsubfx/banks/Strings/0014-Strings Pad5.xiz &@

    And then connect your USB MIDI device like this:
    @aconnect ‘MPK mini’ ‘ZynAddSubFX’@

    It is possible to control ZynAddSubFX via OSC messages but therefore I need to compile the right messenger: “oscprompt”:https://github.com/fundamental/oscprompt

    Haven’t had time for this yet as it needs librtosc and that isn’t available either in the default repositories. If I make any progress I’ll dedicate a blog post to it. Presets can be changed via MIDI PC messages too.

  5. Hello Georg, that looks and sounds great! I’m thinking about putting a RPi in a Hammond/Eddystone enclosure and turn it into a MIDI sound module.

  6. James says:

    Hi Jeremy,
    I just read your post on element14 that you have packages available for RPi2 and the Wolfson audio card. Super exciting, thanks for making them available! Is there any way to install them without having the RPi connected to the internet?
    Thanks,
    James

  7. Hello James, you can put the following packages on an USB stick:
    * http://rpi.autostatic.com/pool/main/l/linux-upstream/linux-image-3.18.9-v7-cirrus_3.18.9-cirrus-1~autostatic1_armhf.deb
    * all packages in http://rpi.autostatic.com/pool/main/c/cirrus-config/

    And then become root on your RPi2, cd to the directory where the USB stick is mounted and issue a @dpkg -i linux-image-3.18.9-v7-cirrus_3.18.9-cirrus-1~autostatic1_armhf.deb *.deb@
    Then reboot and if all went well you should boot with a working kernel and config for the Cirrus Logic audio card.

  8. Hello Georg, that’s really good to hear! ZynAddSubFX 2.5.1 just got released which contains several bug fixes and improvements wrt to remote controlling Zyn’s engine. I’m on holiday right now but I can’t wait to start playing around with Zyn’s remote capabilities.

  9. azihsan says:

    Hi Jeremy,
    i am doing some project on my raspberry pi 2, i have finished building a synthesizer based on Jack from your repos.
    Now i have some a question about the right DAC for my synth, what i have tried is focusrite scarlett whics has no problem with my synth but it seems too big for my project to implement. and also i heard about hifiberry DAC+, but it seems it won’t work with jack.
    But i have heard about cirrus logic audio card that works with raspi2 from this page, could you recommend cirrus to be implemented in my handy-pocket synthesizer?

  10. Hello azihsan,
    Sounds like a great project! Which synth are you using or did you write one yourself? As for soundcards, the Hifiberry DAC’s should work with JACK, basically any soundcard that works with ALSA should work with JACK. I can recommend the Cirrus Logic audio card but if you’re only planning to use outputs and no inputs it’s a bit overkill I guess. Another option could be those small PCM2704 based USB audio interfaces: http://www.ebay.com/itm/1Pcs-PCM2704-5V-Mini-USB-Powered-Sound-Card-DAC-Decoder-Board-PC-Good-/181561936744
    They’re small, sound good, are cheap and work like a charm right out of the box.

  11. azihsan says:

    Hi Jeremy,
    glad you replied very soon, Thanks anyway.
    Yes, i wrote my code with c/c++ and it seems the hardware itself it’s a little bit confusing.
    I have tried the behringer uca222, but the latency always shows up but a lot of differences when i used focusrite scarlett.
    Then, i thought hifiberry will suit with my project since my project only need output, but i read https://www.hifiberry.com/forums/topic/jackd/ , now i doubt about it since i read that forum. could you give me an explanation about that?

  12. Ah, so the Hifiberry DAC doesn’t have mmap support. Yeah, JACK needs that. But if your synth only has outputs and will be the only application using the soundcard why not use ALSA directly? On the RPi JACK does add some overhead. Or does your synth rely on mmap?

  13. As for the difference between the Scarlett and the UCA222, the difference in system latencies between those interfaces should be little. I’ve got a UCG102 myself and that works just fine with the RPi.

  14. jeremy says:

    Hello Hans, I can run guitarix on the RPi2 but I haven’t tested it extensively yet. Will give it a shot this weekend and report back. Maybe in a separate blog post.

Leave a Reply

Your email address will not be published.