Skip to content
mxmxmx edited this page Jan 14, 2016 · 45 revisions

almost there / final steps

  • on the pd end of things, we just need to put together the elements from before, and make things start up on start-up.

  • in terms of the UI, a pd patch typically will use [terminal_tedium_adc] (for the CV inputs), [tedium_input] for the gates and switches; and [tedium_output] for gate outputs.

  • a most basic patch might look like so -- not really doing anything much at all:

  • the [loadbang] object in the centre puts out a bang when the patch is loaded and turns on the dsp (note that [dac~] and [adc~] aren't pictured). a little delay is required for that to work, thus [delay 300]. the bang also turns on the [metro] object for the ADC.

  • you have to run the patch with sudo because of the GPIO/SPI access. the corresponding pcm5102a sketch would look basically similar, except for the GPIO numbers and the message sent to terminal_tedium_adc (see here)

==============================================================================================================

  • finally, we need some kind of start-up script(s), in which we launch pd and possibly a few other things as well. an example can be found here. it simply calls a patch called nameofpatch.pd located in the folder /home/pi/ :
#!/bin/bash

## start pd
sudo puredata -nogui -noadc -rt /home/pi/nameofpatch.pd  &
  • note this uses the -noadc flag; for wm8731, it'll look like:
#!/bin/bash

## start pd
sudo puredata -nogui -rt /home/pi/nameofpatch.pd  &
  • (more complex things (like changing patches) is possible of course, but requires some more complex little programs running in the background. see the OSC client for some pointers.)

  • put that script in a folder of your choice, say /home/pi (that what the example is using). make it executable - sudo chmod 755. entering /home/pi/pdpd in the terminal should launch pd.

  • next, we need to edit rc.local so that the script will automatically run at start-up. you can do so with sudo nano /etc/rc.local (or your editor of choice). simply add the line /home/pi/pdpd. then reboot. your terminal tedium should be booting up now with pd/your patch running

finally ..

  • optimisations etc. there's lots of room for improvement/experimentation. you might consider using a different distribution, there's realtime kernels or using jack* (not ALSA). you're on your own here though.

  • some simple/basics things can be found in this script: https://github.com/mxmxmx/terminal_tedium/blob/master/software/rt_start (in particular, note the line echo -n performance | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor). you can simply add it to rc.local, too, before the pd script (and after chmod 755-ing it). ie:

sudo /home/pi/rt_start

/home/pi/pdpd

  • in terms of audio latency, the best results (with pcm5102a) i got is with something like:

sudo puredata -noadc -nogui -rt -r 44100 -audiobuf 5 [yourpatch].pd ; though this is unlikely to run stable. you'll have to experiment with the size of the audio buffer.

  • as the wm8731 codec runs at a fixed clock, use 48k:

sudo puredata -noadc -nogui -rt -r 48000 -audiobuf 5 [yourpatch].pd

Clone this wiki locally