Here is a step by step on how to make a analog synth emulation with an RPi :
1. installing raspbian on a SD card
connect a keyboard, a mouse, an HDMI screen and an ethernet cable with DHCP (to get internet access) and boot on the SD card to configure the OS :
- expand root
- change keyboard
- change password
- change local (fr utf8)
- change memory split : minimum allocated to video
- enable ssh
- boot : no desktop
sudo apt-get update
sudo apt-get upgrade
install rpi-update and update the firmware (needed to improve sound quality !!)
(instruction here : http://www.framboise314.fr/maintenir-la-framboise314-a-jour-rpi-update-pour-raspberry-pi/)
sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update
log in and start graphical interface :
2. installing puredata
sudo apt-get install git tk8.5-dev libasound2-dev subversion autoconf libtool gettext
downloading latest pd :
git clone git://pure-data.git.sourceforge.net/gitroot/pure-data/pure-data pure-data
./configure CFLAGS="-mfpu=vfp -mfloat-abi=hard"
sudo make install
It takes around 20min to build, be patient.
you can start pd using the “pd” command
3. optimising the system for pd :
sudo leafpad /etc/security/limits.conf
or try nano if you don’t start an X server
* - rtprio 99
* - memlock 1000000000
Start pd and go to media > preference > startup
add the following flag in the startup flag field :
-rt -alsa -noadc -audiobuf 25
then apply and restart pd.
download analog synth emulation patch by Cyrille Henry here :
svn checkout https://pure-data.svn.sourceforge.net/svnroot/pure-data/trunk/externals/nusmuk/nusmuk-audio/ ~/nusmuk-audio
5. Performance :
The analog output of RPi has been improved but it is still quite noisy. Man can output some audio through HDMI. We use an HDMI display to convert audio and to send it to good quality loudspeaker. We later tried a USB soundcard (Edirol UA-1A) which works out-of-the-box.
We tried to reduce latency without hearing click with the Cyrille’s patch, here are the results :
10 ms latency with USB soundcard
20 ms latency with integrated HDMI audio
We also tried to input audio with USB soundcard but audio is crackly as soon as input is enable (with output too).
6. Getting data from real world
Most of MIDI-USB interface should work out-of-the-box.
With Edirol UM-1EX we get a MIDI loopback between 30 and 35ms.
HID works great.
svn checkout https://pure-data.svn.sourceforge.net/svnroot/pure-data/trunk/externals/hid/ ~/hid
The Byron interface (http://www.1010.co.uk/org/byron.html) is one of the cheapest way to make a CV-to-computer interface.
A TCP loop on a local computer takes less than 1.5 ms.
To enable auto login, we follow this : http://elinux.org/RPi_Debian_Auto_Login. And to start pd at startup, we follow the steps on the same page but replace
~/autostart.sh wich is a script like this :
pd -nogui -audiodev 3 -open ~/nusmuk-audio/examples/analog_synth_emulation.pd