PureData Extended on Raspberry Pi
For the prototype of a sound object I need, among other things, an electronics, which can play up to 12 long samples simultaneously and can also change them via external midi controller (e.g. filter, volume). Since I didn't want to use a PC and also not a sampler like the wind chime "Modern Chimes" I wondered if maybe a Raspberry PI, of which I have two pieces lying around, could be suitable for this.
In this context, reports on the network often criticize the poor audio output and the low performance of the PI. Also my model is already old, there is now the Raspberry 2 (ArmV7 with 900MHz, 4 Core) and mine is still the Raspberry 1B (ArmV6 with 700Mhz, 1 Core). But it runs with Linux and my application is not very performance-demanding. In addition, it costs only 35 EUR
So I wrote a simple test patch with two samples with the free Pure Data on the PC, which simulates my application raw (uff, had to work my way back in there, because I'm working with MAX7 now, but this doesn't work on the Raspberry) .
Required hardware
Raspberry PI Model1B, SD memory card 16GB, power supply 2A, keyboard, mouse, USB hub with extra power supply 2A, USB audio interface, possibly USB Midi Interface
Supplement 2018: In the meantime I have also done this installation with the Raspberry PI3 Model B.
To work around the audio problem I use an external USB interface, I still had a free Roland UA-25 audio interface, this works perfectly with the Raspberry (Midi not yet):
FIRST FAILED ATTEMPT:
First, I prepared the memory card with the operating system exactly according to instructions, as suggested by Raspian Wheezy. Downloaded in Windows PC, unpacked with 7zip and written to the SD card with Win Disk Imager.
Then connect the PI to my TV via HDMI and to the Internet via Lan cable. Connected to a USB hub and then keyboard and audio interface, in the second on board jack the mouse.
Powered up with the SD card, German set and start on desktop (still, later of course it will headless).
Then laboriously installed in the terminal pd, according to instructions:
sudo nano /etc/apt/sources.list
new line entered there:
deb-src http://archive.raspbian.org/raspbian wheezy main contrib non-free rpi
ctrl+o, Enter( ctrl+x (=to get out of nano)
sudo apt-get update (takes some time)
wget https://puredata.info/downloads/pd-extended-0-43-3-on-raspberry-pi-raspbian-wheezy-armhf/releases/1.0/Pd-0.43.3-extended-20121004.deb
sudo dpkg -i Pd-0.43.3-extended-20121004.deb (there are some error messages because of non-existent libraries, ignore)
sudo apt-get -f install (here the libraries are reinstalled)
sudo chmod 4755 /usr/bin/pd-extended
So, now Pure Data (pd) can be selected from the menu.
I had to search for the sample files that are in /usr/lib/pd-extended/doc
The files load and there is also sound via HDMI, but the application window can no longer be closed and is stuck with me in the upper left corner.
You can kill the process, but that's not a solution and I don't know what I could do about it.
This attempt worked:
So once again I dealt with the problem from the ground up.
My research has shown that there is a new version of the PD software, but it does not appear in any manual, namely version 0.43.4
This is not hosted at puredata, but on sourceforge:
http://sourceforge.net/projects/pure-data/files/pd-extended/0.43.4/pd-extended_0.43.4~extended1-1~raspbian_wheezy_armhf.deb
I'll take the old, somewhat hard-to-find Raspbian Jessie in the full final version
Supplement 2018: I tried it with the Jessie successor Stretch, it didn't work out because of missing libraries, which couldn't be reinstalled with me.
So again memory card as prepared above, now with Raspian Jessie
then Raspberry PI powered up, German and desktop as above.
Now the /etc/apt/sources.list is not changed, because the line is already sufficiently similar in it!
sudo apt-get update (takes some time)
(please note, if you copy the following commands, everything is ok, but if they are written off please make sure that my font instead of TILDE displays a LANGES MINUS, so before extended and before raspbian is a TILDE)
wget http://sourceforge.net/projects/pure-data/files/pd-extended/0.43.4/pd-extended_0.43.4~extended1-1~raspbian_wheezy_armhf.deb
(here also TILDE before extended and before raspbian)
sudo dpkg -i pd-extended_0.43.4-extended1-1-raspbian_wheezy_armhf.deb (there are some error messages again due to non-existent libraries, ignore)
sudo apt-get -f install (here the libraries are reinstalled)
Once it happened that it didn't work, then I just repeated dpkg and install (the last two steps).
(for security reasons, upgrade:)
sudo apt-get upgrade (takes time)
The following changemod supposedly improves the audio playback, I can not judge but I have applied it and it does not seem to hurt anyway:
sudo chmod 4755 /usr/bin/pd-extended
Supplement 2018: I had a problem on the PI3: The created icon of Pd-extended did not open. I have tested that it works with a different shortcut, you have to link ind the icon .desktop file on
/usr/lib/pd-extended/bin/pd
then the program starts correctly.
PD is now going superbly, my Roland UA-25 audio interface is recognized without any driver and delivers the best sound.
Now I can extend my PD patch and see if the system is still running under full load, if not I can still slightly overclock the CPU.
So it should be. …
The Midi interface of Roland UA-25 does not appear in PD, I have to make it work, either via an external USB-MIDI interface or possibly. via Software Midi.
To be continued
Supplement 2018: On the Raspberry PI3 there is of course a lot more power, I have again the anomaly that windows like to open up the left and can no longer be closed, since not reachable with the cursor. It looks like, if open windows are located in a specific location from the patch in Windows or on the MAC when saving, or are pushed there last, these coordinates appear to be evaluated differently on the Raspberry. I will be testing this closely shortly.