Running Puredata patches on Bela » History » Version 10

« Previous - Version 10/20 (diff) - Next » - Current version
Giulio Moro, 2016-02-06 12:17 AM


Compiling Puredata patches on Bela

Here's a quick guide to compiling Pd patches on Bela. Currently this only works on OSX and Linux, but Windows support will be coming soon.

You can also access the slides from the latest Bela workshop on compiling Pd patches at the following link: https://goo.gl/59hShW This also includes some handy tips for handling Bela's sensor inputs using Puredata.

Getting everything up and running

Follow the following steps to get everything up and running on your Beaglebone Black:

1. Download the project archive from https://code.soundsoftware.ac.uk/attachments/download/1723/bela_4-12-2015.zip

  • Extract the archive (and remember where you extracted it to)

2. Make sure python is installed:

curl -OL https://github.com/kennethreitz/requests/zipball/master && unzip master && cd kenneth* && sudo python setup.py install

if the above does not work, try this:

curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py" 
sudo python get-pip.py #install pip packet manager for python
pip install request

3. Create an account on enzienaudio.com:
  • Click Login on the top right corner of the page
  • Create a new account
  • Create a new patch and call it bbb (N.B. compiling won't work if you use a different name)

4. Make sure the Beaglebone is plugged in to laptop and open a terminal window:

  • Navigate to the scripts folder cd /path/to/folder/scripts
  • If running for the first time sh setup_board.sh

5. Compile your first project!

  • ./build_pd.sh -i ../projects/heavy/pd/hello-world/
    This script compiles your project, uploads it to the Beaglebone and starts it.
    If you run this script with the --watch --screen flags, it will check automatically for edits in your Pd files and refresh your build automatically: no need to touch the terminal again, as long as you keep working in the same folder. For example:
    ./build_pd.sh -i ../projects/heavy/pd/hello-world/ --screen --watch
    If you are on a Mac, you can browse to the BeagleRT/resources/MacOS folder and you will find an app called BelaPdBuild. You just have to drag and drop the folder containing your files on this icon and you will not need to touch the terminal at all.

6. Create a new pd project

  • Create a new folder inside the /pd directory
  • The pd patch must exist in its own folder and be named _main.pd. You can use abstractions if you like.

Using analog ins/outs

  • You can directly address the analog ins and outs from within PD (note that you have to compile and run the patch onto the BeagleBone to receive the data)
  • Use the [adc~] and [dac~] objects to receive and send the data
  • [adc~ 3] refers to Analog Input 0 (first two channels of [adc~] are audio inputs), likewise for [dac~]
  • These inputs are sampled at audio sampling rate, so handle them as you would audio signals. (Use [snapshot~] if you want to turn them into control-rate values)
  • See the example patches in the /pd folder for more information

Important notes

  • The Pd patch must exist in its own folder and be named _main.pd. You can use abstractions if you like.
  • See the example pd patches for more information.

Have fun!

libpdBela - The libpd-Bela executable: will load the _main.pd file from the folder where it is located 89 KB, downloaded 132 times Giulio Moro, 2016-04-10 10:46 AM

libpd.so - The pre-compiled libpd shared library 622 KB, downloaded 255 times Giulio Moro, 2016-04-10 10:46 AM