Raspberry Pi for music

I’ve already gone on too long, but forgot to mention:

  1. I’m just using cheap USB sound cards. I don’t know how much this adds to latency, but I’m not doing anything interactive at the moment. Audio quality is good enough for a small powered speaker.
  2. As I said, I’m running these headless, using SSH from my MacBook to access the command line. Ultimately though, I want to install video displays in any “finished” instrument I build with an embedded RPi, whether for audio visualization or for flashing text like a Lawrence Lessig PowerPoint slideshow. Because it’s the 21st century and there are real cheap LCD modules on ebay.
1 Like

I’ve never used an RPi for music directly, but I use them all the time for audio installations. I usually run some combination of PD and Python scripts, collecting sensor data, etc. A basic USB audio card makes it perfect for this and really simple/cheap (especially when they need to stay running as part of an installation for months or longer).

Lots of the ideas in this thread sound amazing and I can’t wait to follow along with the experiments and learn a lot.

1 Like

I spent a while playing with an RPi using a behringer UCA for audio in/out. I wired my own midi port to the rpi uarts. I was running puredata and had pretty good latency and performance. I wrote an external in PD to send and recieve CV and gates via i2c from a PIC. The PIC also ran a pair of seven segment LED’s. I should really finish it up and find a case for it.

I never bothered with a screen or keyboard, I found it much more easier to connect remotely with ssh and vnc.

1 Like

Hey, my long-weekend-project is to muck around with a R.pi, too!

My aim is to make it a “remote station” for a digital recording / monitoring rig. I want it to do these tasks:

  • Be the MIDI host for a number of USB controllers, and feed that MIDI to my synth (Digitakt, also via USB).
  • Take audio from the synth, and route it through Jack:
    • over network (ethernet) to central unit (an Intel NUC)
    • take the monitor mix back from the central unit, and play it out headphones
  • Maybe also mix in one or two synth voices (Pd? Supercollider?)
  • Maybe also be a looper / effects (also Pd? Supercollider?)

I don’t have a PiSound unit on the way (didn’t get in on the Kickstarter) - so for now I was going to use a spare small Focusrite USB audio box until I can get something better. I was going to use Raspian to start with and see just how far I can get.

Looking forward to seeing what you all do, too!

2 Likes

I’m trying to do the same. The aim would be to do two things with it:

  • use it as a headless Pd device, with just a MIDI controller hooked up.
  • use it as a polyphonic synth, either with Pd or with some linux softsynth (or a plugin via a minimal Host). This I have to research more thoroughly though.

For this I’ve backed the Pisound kickstarter, since it will let me have a really tiny computer with a decent built-in audio interface. I was really back and forth between this and the Axoloti (though I might get that as well), but decided to give the PI a chance and see how that works first.

1 Like

just posted this :slight_smile:

2 Likes

Well… my long weekend of Raspberry Pi for audio has run into sadness. Here’s my “score” so far:

  • :thumbsup: USB MIDI host: Using aconnect it all just works! Yay, I can route MIDI from some USB only controllers to USB on my Digitakt and lovely!
  • :thumbsup: Audio via a USB audio interface (Focusrite Scarlet) works in that both alsa and jackd can get and route it around the unit.
  • :thumbsdown: Starting jackd with -d net so that I can send the audio to another computer (to mix), and laoding audiomanager to get the audio from the USB interface (so: Scarlet via USB -> pi w/jackd2 & net2 -> other computer w/jackd2 for mixing -> back to pi -> Scarlet) works for about 10 seconds and then the kernel panics with some mess in the eth driver.

Couldn’t find a solution to this… On Wednesday, someone suggested that since on the R.pi the ethernet shares a bus connection with the USB, this was unlikely to work well. They lent me two other devices: a Banana Pi and a ODroid C2, both which have supposedly better ethernet systems.

  • :thumbsdown: jackd2 crashes on start up with a Bus Error for memory alignment problems. This is true using either device’s standard OS, and standard built packages (Debian for one, Ubuntu for the other).

Again, no amount of googling has yileded an answer: Alignment issues in Jack for ARM seemed to have been common in 2012/13, and supposedly squashed in the code base in 2014. I suspect that the “standard” deb builds, while working for most things, don’t work for Jack on these devices for some reason. I tried building myself, with all sorts of options - no luck.

:play_pause: Anyone figure out how to get Jack to run on these boxes? With netjack2?

1 Like

sorry, not tried to send audio to the network yet, which seems to be where your problems lie.

I assume you are on the latest kernel etc? (its worth doing a kernel update, as its continuously getting updates)

Did you just try the jackd network side on its own? (i.e without the usb) , as it would probably be useful to isolate the issue from the usb side… or even to know for sure, both usb and Ethernet audio works fine separately, but combined have an issue.

if the Ethernet is an issue, another option to may be try (but might be a big time sink, as ive not tried it yet ;)) is to see if you can use g_audio (audio gadget), which should make the PI appear as a class compliant USB audio interface.

Yup yup - absolute latest stable system software (apt-get update ; apt-get dist-upgrade) on all systems.

I’ll try the net only jackd thing this weekend. Suspect that will fail, and the problem will be the Ethernet. I have a spare compatible Ethernet USB dongle… will try that too, (but eats up a USB port, and makes the rig yet one more bit non-compact… )

:tada: Success!!! Turns out you just need to shave a lot of yaks:

Here’s what worked for turning a R.pi into a “performer station” (my synth into pi, pi to central mixer (nuc), mix back to pi, to sound out headphones for monitoring):

Install

* download smaller raspian image * just use dd method of burning the sdcard on my mac * boot pi & find it & ssh into it * set up static ip by editing `/etc/dhcpcd.conf`:
interface eth0
static ip_address=192.168.42.6/24
static routers=192.168.42.1
static domain_name_servers=8.8.8.8 8.8.4.4
  • update & install:
sudo apt-get update ; sudo apt-get dist-upgrade
sudo apt-get install screen vim --no-install-recommends
sudo apt-get install alsa-utils jackd2 jackmeter ecasound ecatools --no-install-recommends
  • => aconnect works for simple MIDI routing
    => aplay -l shows sound cards

  • edit /etc/dbus1/system-local.conf:

    <busconfig>
      <policy user="pi">
        <allow own="org.freedesktop.ReserveDevice1.Audio0"/>
        <allow own="org.freedesktop.ReserveDevice1.Audio1"/>
        <allow own="org.freedesktop.ReserveDevice1.Audio2"/>
      </policy>
    </busconfig>
  • export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket
    • or put it in your .bashrc

on nuc (mixing machine)

run (adjusting `hw:1` to your sound card:
jackd -P 90 -d alsa -d hw:1 -r 44100 -p 128 -n 1 -s &
jack_load netmanager

on pi

run (adjusting `hw:1` to your sound card on the pi, and `-n` to the name of this station):
jackd -P 90 -d net -n pi -s -l 1 &
jack_load audioadapter -i '-d hw:1 -r 44100 -p 128 -n 1'

# route audio in to the network (`system`) and then the network back to audio out
for c in 1 2 ; do jack_connect audioadapter:capture_$c system:playback_$c ; done
for c in 1 2 ; do jack_connect system:capture_$c audioadapter:playback_$c ; done

back on nuc

run
# route audio from network to audio card, as well as back to network
for c in 1 2 ; do jack_connect pi:from_slave_$c system:playback_$c ; done
for c in 1 2 ; do jack_connect pi:from_slave_$c pi:to_slave_$c ; done

# if you had multiple performer stations you could mix them with `ecasound` before routing to sound card and network.

Play!

* all works! But must keep `-p` at 128 or things are very sad * latency can be as low as 1 (`-n` for alsa, `-l` for net) * I haven't measured it, but feels ~1ms - probably a bit more with `ecasound` in the loop.
13 Likes

Reviving this thread for a lo-fi angle at this. I’m running my B+ on Satellite. I have a very crude PD patch throwing out 4 sine waves and 5 types of noise, over which I have very limited control. The noisy built-in audio output on the Pi is a benefit here, since it adds some nice flavours to things. I have a simple feedback loop on a mixer to add some more spice. It sounds like this:

6 Likes

There’s an open source DIY eurorack module “Terminal Tedium” which is a nice platform for running PureData patches in your modular rig. I’ve built a handful of these and there’s a small group of folks hacking pd to work with it - like getting organelle and automatonism patches running on it. I think someone may have Orac working there too

I also did some work to integrate the most recent Terminal Tedium version with some Machine Listening research by Chris Latina at Georgia Tech.

I’ve hacked a Tedium pcb to use it’s DAC (along with adding encoders and rewiring buttons) with a new PI to run Norns.

There’s a handful of other DAC boards out there that I found while doing research this week like these:

MIKROE-506 (commercial)
I2S AudioPhat (DIY Open Source)

For the moment, I’m not really doing anything with these projects, but hope to do more with the norns stuff as I learn more.

4 Likes

Hi there. This is my second post to “Lines”. Hope you’ll find the guide useful.

4 Likes

We built this for our Isn’tses setup to play field recordings, loops and soundfonts/samples without a laptop: http://homspace.xs4all.nl/homspace/samplerbox/

There are a few different versions, here’s the main/original http://www.samplerbox.org/

Update: I’ve written up a full set of instructions for building a “headless Pi” music machine from start to finish. While the instructions are aimed at RaspberryPi + Pisound, most of it is applicable to any general music RaspberryPi situation:

13 Likes

thanks for making this. i’ve been curious about a little minimal pisound setup. for someone with no PD / SC experience - would you recommend one over the other? will you be sharing the “performance” patches you’ve used?

edit: i have played with automatonism a bit, so maybe that’s a good starting point.

mzero’s guide is really great and easy to follow!
If you have a spare monitor/keyboard/mouse you can skip some steps but since that is often not available, it’s really great that the guide walks you through setting things up headlessly from the start.
I have only dipped my nose into SC, but maybe getting a feedback from somebody who – like you – did start with very little previous experience is helpful anyway.
I can say that Pd is pretty doable, while SC is much more intimidating.
My aim is always to get the technical stuff over quickly so I can start to make music and Pd seemed to be much better for me in those regards.
I have to say though that the whole Raspi/Pisound/Pd combo has been a big time hog for me, and I’m not sure I’d do it again. There’s so many simple things that just don’t work for totally unexplicable reasons… and take a lot of time and help from forum members, until you have figured them out.
There’s certainly a learning value in it, but I’m not entirely sure it’s worth the hassle.
But it really depends on your goals.

2 Likes

in passing - my rPi/Pisound is currently a Norns in conjunction with a push2 but as soon as Norns/Grid are on sale (or sooner if someone fancies selling me one ;-)) it’ll have to find a new use. I’ve been thinking a lot about this.

I know PD quite well and SC a bit (spent a couple of weeks at christmas learning it so not a total novice). from Norns I really like the crone/SC,Matron/Lua interaction with the whole thing - it feels very natural and there is a lot of heavy lifting done for you.

My current thinking for headless rPi is to leverage that somehow - I guess in someways that could just be making headless patches that don’t need display or encoders…

(edit: on the PD/SC thing - I was a great enthusiast for PD (& Max) for a long time but somehow SC feels more natural - I guess I’m just a coder at heart - it is how I’ve earned a living for a most of my career)

1 Like

I just picked up one of these Tasty Chips granular synths which runs on a Raspberry Pi3. It is really nicely thought out and very musical to my ears. https://www.tastychips.nl/?page_id=2182

2 Likes

that looks very nice - Gaz on sonic talk was enthusing about it I seem to remember (not a high bar mind :wink: )