Programming in pd is not command line, instead it uses a graphical interface where data flows through objects via inlets and outlets. This interface makes it much easier for non-programmers to get their ideas down quickly and easily and makes designing a graphical user interface for your applications very straightforward. Pd runs in real-time which is helpful for debugging and understanding how objects are interacting with each other.
Step 1: Getting Started
When you open pd a dialog box like the one pictured above will appear, ignore this for now. Programming in pd is done in files called "patches," to open a new patch go to File>>New. Once you have a new file open go to Put>>Object or ctrl/command + 1 to start building your patch. A box will appear near your cursor; click somewhere within the space of your new patch. You can then type the name of the object into the box and click to create the object. Try out some simple objects like "slider" or "+", right click and select Help to learn more about how these objects are used.
Step 2: Basic Synth Patch
The most fundamental object in a synth patch is "osc~", this object generates a sine wave. You can specify the frequency of the sine wave by including an argument such as "osc~ 440"; this oscillator will generate a sine wave with a frequency of 440Hz. You can also send the frequency of the osc~ object through it's top left inlet. Remember if you want to find more info about any of the objects, right click on the object and select "Help".
Next create a "dac~" object, dac stands for digital to audio converter. This object will route audio from pd to speakers or the audio output jack of your computer. The left inlet sends audio to the left channel and right inlet sends it to the right channel. Connect the outlet of the osc~ 440 to the inlets of the dac~ as shown in the first image.
No sound is coming out of your speakers yet. This is because we have to tell pd to turn on its digital signal processing. Do this by selecting "compute audio" on the pd-extended main window (figure 2). You should hear a sine wave, if you want it to stop, uncheck compute audio.
The sine wave output from osc~ has an amplitude of 1 by default; signals sent to the dac~ must be between -1 and 1 or they will be clipped and sound distorted. If we want to change the overall gain/volume of the signal we need to add some more objects. As shown in figure 4, create a "slider" and "*~" object and connect them so that the output from osc~ is multiplied by the slider value. Notice the "/ 127" object in the path between the slider and *~. The slider object outputs values between 0 and 127, but if we multiply our sine wave by anything larger than 1 it will be distorted in the dac~ (go ahead and try it). Dividing by 127 scales this number so that it is always between 0 and 1, now dragging the slider up and down should raise and lower the volume of the sine wave. Use numberbox objects ("nbx") to double check that everything is working properly (figure 4).
Next attach a numberbox ("nbx") to the left inlet of osc~ as shown in figure 5- this object will modulate the frequency of the osc~ object. Use control/command + e to switch out of edit mode (also Edit>>Edit Mode) and click and drag the numberbox to change its value. Once you get above about about 30Hz you will hear a low frequency sine (make sure compute audio is checked!).
In figure 6 I have included some additional objects and connected them to the left inlet of osc. These objects will give our main sine wave some vibrato (wavering frequency). The osc~ 5 object outputs a sine wave of frequency 5Hz. Next and *~ gives the 5Hz sine wave an amplitude of 20. And finally, The sine wave is offset by 440 by the +~ object, this means that this signal coming out is a sine wave which oscillates between the numbers 420 and 460 at a frequency of 5Hz. When this signal is fed into the left inlet of another osc~, it sets the frequency of that osc~ to waiver between 420 and 460Hz at a frequency of 5Hz. This is called frequency modulation. Get out of Edit Mode and use the numberboxes to change the amplitude, rate, and center frequency of the frequency modulation to get a better understanding of how it works.
I've attached this patch below.