Programs and files of Pd are called patches
in Pd, we can program e.g. synthesisers, samplers, rhythm machines, interactive system by connecting small boxes called objects. For connecting these objects, we use patch cords.
There are more than 100 different objects in Pd. Each object functions differently. You can open the list of all available object by clicking the patch with right mouse button and select "help".
We can categorise these objects into two groups; tilde objects and control objects
Tilde objects deal with audio signal.
Control objects deal the rest (e.g. MIDI data)
To open the help file of each object: select an object, right click it, and choose help.
There are two modes in Pd; edit mode and run mode. You can switch these two modes by Cmd+E (Ctrl + E in windows)
The shape of cursor indicate which mode you are in:
finger cursor : you are in edit mode
arrow cursor : you are in run mode
To make an empty object box, press Cmd+1
To start and stop the sound, toggle DSP switch.
osc~ an object that generates sine wave with the specified frequency
dac~ the audio output of the patch. The signals, that are sent to this object, will be heard from the speakers
by writing numbers next to the object name, you can set the initial parameter of the object. These numbers are called arguments
by writing an argument in osc~, you can change the frequency of the sine wave.
by pressing Cmd+3, you can put a number box in the patch. Connect the number box to the osc~ and change the mode to run mode by pressing Cmd+E. Then, click on the number box and drag the cursor vertically to change the value in the box. In this way you can smoothly change the number in the number box.
by giving a new number from the number box, the argument of the osc~ is overwritten.
The highest frequency that Pd can generate is 22050 Hz by default.
The sound above 20000 Hz is normally difficult to perceive
put a *~ (multiplication) object in the patch with an argument 0.1
create and connect a number box to the right inlet of the *~ object and click and drag the value in the number box, pressing the shift key at the same time. In this way, you can precisely change the value.
do not put a number above 1 in the number box. otherwise, the sound will be distorted.
as seen in the patches. most of the arguments can be overwritten by connecting a number box to the objects.
a vertical slider can be created by pressing Cmd+Shift+v
the default range of output is between 0 and 127 (MIDI range)
If you want to control the volume with a slider, you need to scale the output by "/ 127" object
you can create message boxes by pressing Cmd+2
It is useful when you want to set a value immediately by one click
bang means "do your task" for the most of objects
bng is a button-shaped GUI object, that outputs a bang by clicking it in run mode. You can create this object by pressing Cmd+Shift+b
If a message box receives a bang, it outputs its content.
In order to make a short sound, we need to send a bang to the message box with the value 0.5 and then send another bang to the message box with the value 0 immediately after that.
You can automate this process by using "del" object
del outputs received bang with specified delay time. you can set the delay time through the argument or the its inlet
In order to generate sounds continually, we need to send a bang to the top bng continually.
metro helps us to realize this.
metro continually outputs bangs witht the specified interval
you can start the output of bang by sending a number above 1 to the left inlet and stop the output by sending 0
tgl is a GUI object that generates 1 and 0 alternately in response to clicks on the object.
sudden change of volume causes click noise
to avoid this, we have to change the volume gradually
line~ object help us to change the volume gradually
line~ is a ramp generator. With this object you can gradually change the value from A to B. This object requires two values simultanesouly. The first value is destnation value and the second value is the duration.
pack object enables us to pack two or more values and send them in one message
random object generates a random value between 0 and argument -1.
you can change the interval of the metro by providing a new number to the right inlet.
BPM = Beats Per Minute. Number of beats in a minute
the interval between beats can be calculated by 60 / BPM
In Pd times are counted in milliseconds. 60000/BPM gives us the interval in milliseconds.
Pd objects executes the calcuration only it receives a value from its left inlet. Thus, we need to send a BPM value to the right inlet and then 60000 to the left inlet.
In order to automate the above process, we need to keep the order of procedure
trigger object enables us to do this
trigger outputs the received values from right to left outputs without processing the values.
In the following examples, the value of the top number box is copied to the three buttom number boxes. Only the case with a trigger object the order of copying is gurantieed.
you can specify b instead of f as the arguments of a trigger object. With argument b, the corresponding outlet outputs a bang instead of received value.
by using this second function of the trigger, we can automate the BPM to interval conversion as follows
an Array is required to plaback a sample
to make an array, select Array from the "put" menu.
in the property panel, name the Array "my Sample"
to load a soundfile to an Array, we use soundfiler object
make a message box by pressing Cmd+2 and write "read - resize guitar.wav mySample" in it. Then, send the message to the soundfiler
the soundfile should be in the same folder of the patch
soundfiler can also store the content of Array in a soundfile by "write" message
with -resize option, the size of the Array is automatically adjusted to the size of sound file
to playback the sample, we use tabplay~ object
tabplay~ starts playback when it receives a bang
tabplay~ outputs a bang from its right output when it finishes the playback.
if you connect the right outlet and the bng, you can loop the sample
spigot bypass the received message when the last received value on its right inlet is greater than 1. otherwise it blocks the received value
by combining spigot and tgl, we can easily program the loop switch.
create an Array and name it "myVoice"
adjust the size to 44100 (1 sec)
to record the voice, a tabwrite~ object is required
adc~ (analog to digital convert) outputs the signal from audio input device
to change the playback speed, we use tabread4~ object
tabread4~ is required 3 values through line~ object, the start, the end, and the duration of the playback
With "0, 44100 1000" the sample will be played from the begining to the end in one second
if you swap the value of start and end, you can play the sample backwards.
Creating two Arrays and name them snare and kick respectively
load samples from snare.wav and kick.wav
key object outputs the ascii code of corresponding key. for examplex key x outputs 120, z outputs 122.
sel object outputs bang from the corresponding outlets, when the received value and one of the arguments is same
by connecting adc~ and env~, you can analyze the loudness of the incoming signal from the microphone
- > outputs 1 when the received value is greated than the argument, otherwise 0.
change bypass the incoming value when it is different from the previous value
combine the routines of metronome and snare drum
counter outputs from 0 to the value argument
16th note based drum machine
with Cmd+d, you can duplicate the object(s)
We need to divide the duration of the beat by 4, because of 16th note
through LAN, you can synchronize your drum machine with a patch running on another computer
netsend sends a message to receiver computer
netreceive receives a message from the sender
a port number(above 5000) should be specified by the both sides.