pd howto

pd – monome 40h howto v 0.1

Attached pd_howto

1. software

Pure Data / PD is a patch based synthesis environment licensed under the “Standard Improved BSD License”. It is part of the same software family as Max/MSP (www.cycling74.com) and jMax (freesoftware.ircam.fr). This tutorial is based on PD-extended, which is Pure Data packaged with a large collection of externals for extending PD in various ways such as adding OSC communication.

Pd-extended is available at:

http://www.pure-data.info/downloads

2. installing

(this step will not be needed after the release of mapd) Follow the general setup instructions for the monome 40h. Download the serialio source package. To make life easier, I copied the command line version of serialio (notSerialIO) into my path (e.g. /usr/bin or /usr/local/bin). If you are uncomfortable with adding software to your /usr/bin (which should be avoided at any time), you can skip to stage 3.2 and run serialio from wherever you decide to keep it.

2.1 placing serialio in your path

To place serialio in your path, drag the program into a finder window that is pointing to that folder (press apple-shift-g and enter /usr/bin into the popup window), or bust open a terminal (/Applications/Utillities/Terminal) and navigate your way to wherever you downloaded serialio and copy it to your path:

cd /wherever/the/file/is/downloaded
tar -xf serialio-0.1
cd serialio-0.1
sudo cp ./serialio /usr/bin

it will ask you for the admin password…

2.2 running serialio

Plug in your box. It should now light up. Again we need to bust open a terminal (or use the one we used above). In the terminal, navigate to where serialio is residing (this is not needed if you placed it in your path) and enter the following:

./serialio localhost:8085 8080 (if you placed it in your
path, skip the ./)

This will allow us to access the 40h with a different port setting than the SerialIO application uses. This is needed for PD for some unexplained reason.

You should now see a message similar to the following:

serialio version 0.1, Copyright (C) 2006 Joe Lake
serialio comes with ABSOLUTELY NO WARRANTY; for details
type `warranty'. This is free software, and you are welcome
to redistribute it under certain conditions; type `conditions'
for details. 
Usage:
serialio - converts serial data from 40h to open sound control 
message and vice versa .
syntax:
serialio dest_ip_addr:dest_port 
where
dest_ip_addr:dest_port is the target ip address and port
(default localhost:8000).
listen_port is the port on which to listen for 
OpenSoundControl messages.
type 'quit' to quit.
serialio listening for incoming osc messages on port 8080
serialio broadcasting osc messages to localhost:8085
serialio searching for devices...
Serial device matched: /dev/tty.usbserial-m40h0004.

3. 40h and pd

The following text describes the patch OSCplumbing that takes care of basic 40h functionality in micro_keyes, lights, clave_machine and pattern_sequencer. A demonstration patch called help-40h.pd displays how to interface with this patch. However, the best way to learn this is to get your hands dirty playing around with the help-40h.pd patch.

3.1 OSCplumbing – input / output

[dumpOSC 8085] connects to serialio on port 8085 and then broadcasts these messages inside PD on a send [s] channel called dOSC. By sending the message [connect localhost 8080] to the [sendOSC] object, we establish communication with serialio in the other direction. Items received® on the sOSC channel are sent out to the 40h (the sub-patch clear contains some code to initialize the LEDs on the 40h when the patch is opened). It is not possible to open multiple instances of dumpOSC at the same time, so if the user wants to use many different 40h patches at the same time, this may be best spun off into a separate patch and not as a sub-patch.

3.2 internal routing

To simplify programing for the 40h, a number of send and receive ([s] and®) objects in OSCroute take care of routing information to and from the 40h. The OSCroute object reads all messages coming in over [dOSC]. If the first part of an OSC address matches OSCroute’s creation argument, the rest of that message will be sent out through the left inlet, and all other messages will be sent through the right outlet. /box and /press returns the state of each button. Another important routing address is /box/adc, which receives data from the 40h’s ADC if they are turned on and connected.

The send and receive channel matrix-in returns a three value vector describing the location of a button and its state, so if a patch has a receive object called matrix-in, that object will return [0 0 1] when the button in the lower left hand corner is pressed, and [0 0 0] when the same button is released. Messages sent to leds-out turn the leds on and off. For example sending the message [0 0 1] to leds-out will turn on the led at row 0, column 0, and [0 0 0] will turn it off. If sent directly to dOSC, the message would need to be [send /box/led 0 0 1].

Any command sent on the raw-out channel will be sent straight to the 40h. For information on the available commands, please refer to the serialio OSC protocol available at the monome.org website. Simple examples of in/out functions are shown in help-40h.pd

Edit this page or watch for changes using RSS.