Download presentation
Presentation is loading. Please wait.
Published byNigel Rich Modified over 9 years ago
1
Copyright © 2011 by Denny Lin1 Computer Music Synthesis Chapter 2 Based on “Excerpt from Designing Sound” by Andy Farnell Slides by Denny Lin
2
Copyright © 2011 by Denny Lin2 Starting with Pure Data 2.1 Pure Data 2.2 How does Pure Data work? 2.3 Message data and GUI boxes 2.4 Getting help with Pure Data
3
Copyright © 2011 by Denny Lin3 2.1 Pure Data Pure Data (Pd) is a visual signal dataflow programming language Designed to process sound and MIDI events. Has grown to process video and inputs from a variety of general purpose sensors Free alternative to MAX/MSP Runs on Linux, Macintosh, and Windows computers
4
Copyright © 2011 by Denny Lin4 Pure Data Console
5
Copyright © 2011 by Denny Lin5 Pure Data Test Signal
6
Copyright © 2011 by Denny Lin6 2.2 How does Pure Data work? Data flows between objects connected through cords or wires Thin cords carry message data; fat cords carry audio signals Objects take in data at inlets, and may send output to outlets; inlets and outlets appear as tabs at the edge of objects Types of object names: –Object names with ~: Process signals –Object names without ~: Process messages
7
Copyright © 2011 by Denny Lin7 Patches A collection of objects wired together is a dataflow graph program or patch. Name is derived from analog electronic synthesizer modules connected together with patch cords Patches are placed on a canvas Patches are navigated by the PD interpreter depth first, from right to left (tries to go as deep as possible in a graph, processing the right-most branch first before a left branch)
8
Copyright © 2011 by Denny Lin8 Dataflow computation
9
Copyright © 2011 by Denny Lin9 Pure Data Software Architecture Pure Data consists of several programs: –pd(main engine): the interpreter, scheduler and audio engine –pd-gui: the interface you use to build Pure Data programs –pd-watchdog: monitors the main engine and gui, and will attempt to terminate unresponsive pd or pd-gui
10
Copyright © 2011 by Denny Lin10 Some Command Shortcuts CTRL+1: Put object CTRL+3: Put number CTRL+A: Select all objects on canvas CTRL+C: Copy selection CTRL+D: Duplicate selection CTRL+E: Toggle Edit Mode CTRL+O: Open file CTRL+S: Save file CTRL+V: Paste selection CTRL+X: Cut selection SHIFT: Select multiple objects
11
Copyright © 2011 by Denny Lin11 Placing a new object Can use Put->Object from menu, or use CTRL+1 An active dotted box (object) appears Assign a name to the object Depending on the object’s name, Pd assigns an appropriate number of inlets and outlets, changing the dotted box into a solid box; no changes and assignments made to unrecognized objects To delete an object, click and hold to draw a selection box around the target object, and press delete
12
Copyright © 2011 by Denny Lin12 Wiring Hovering over an outlet changes the mouse cursor to a wiring tool Click and hold the mouse when the wiring tool is active, and drag a connection from the first object; hover over another compatible object and release the mouse to complete a connection To delete a connection, click on a connection to select it and press delete
13
Copyright © 2011 by Denny Lin13 Initial Parameters or Arguments Most objects can take default initial values, which are specified as initial parameters or arguments These parameters are not always required Uninitialized values generally are set to 0 Add a 3 to its input by defaultAddition depends on inlet(s)
14
Copyright © 2011 by Denny Lin14 Modifying Objects The name and function of an object, and its parameters can be changed The following causes the multiply object to always multiply its input by 5, and the addition object to always add 3 to its input. When 4 is the input of the multiply object, the output of the graph is (4 x 5) + 3 = 23
15
Copyright © 2011 by Denny Lin15 Number Input and Output Number boxes can be used to enter numbers, or view results Can use Put->Number from the menu or use CTRL+3 The following solves y = 5x + 3, where x = 10
16
Copyright © 2011 by Denny Lin16 Toggle Edit Mode In edit mode, you can move or modify objects To use the patch, you must exit edit mode Pressing CTRL+E (or Edit->Edit from menu) allows you to enter and exit edit mode While not in edit mode, place the mouse on the top number box (fig. 2.9), then drag the mouse up and down; this changes the computed result in the second number box
17
Copyright © 2011 by Denny Lin17 More Edit Operations Objects can be copied into the buffer using familiar cut, copy, paste, and duplicate commands Select multiple objects by holding Shift while clicking on targets Duplicating groups of objects will also duplicate connections between them
18
Copyright © 2011 by Denny Lin18 Patch Files Pd files are text files that end with a.pd file extension Novices should avoid modifying these text files Can use File->Save or CTRL+S to save the current canvas Can use File->Open or CTRL+O to load a patch file
19
Copyright © 2011 by Denny Lin19 2.3 Message data and GUI boxes Messages are events or data sent between two objects A message can be: –as short as a character or a number, or –as long as an entire musical score or synthesizer parameter set GUI boxes (objects) can be placed on a canvas using the Put menu, or using CTRL+1 through CTRL+8 All GUI boxes have properties that can be modified (in edit mode) by clicking on them and selecting the properties pop-up menu item
20
Copyright © 2011 by Denny Lin20 Selectors All messages (except bang) carry an invisible selector that identifies the message type (symbol, number, pointer, or list) When a message arrives at the inlet of an object, the object examines the selector to see if it has an appropriate method to handle the message If the object does not have an appropriate method, an error message reports the incompatible data type
21
Copyright © 2011 by Denny Lin21 Bang message and box The most fundamental and smallest message The bang is used to cause an object to output a value or advance to a next state Other messages have an implicit bang A bang box sends and receives messages; changes from white to black whenever it sends or receives a bang Bang boxes can be used to initiate actions or as indicators
22
Copyright © 2011 by Denny Lin22 Float messages and Number boxes All numbers (even integers) are stored as 32 bit floating point values in Pd A number box object has a beveled top right corner Number box values can be changed by using the mouse: –Coarse control: drag the mouse up or down over the value field –Fine control: hold shift while dragging the mouse up or down Number boxes display by default up to 5 digits including a sign (-9999 to 99999). Can be changed in the properties dialog
23
Copyright © 2011 by Denny Lin23 Toggle box Toggle boxes work with floats to represent on and off states. When clicked, a cross appears in the box, and a number 1 is sent. When the box is clear, a 0 is sent Sending a bang to the inlet of a toggle box flips the toggle box to an opposite state Other non-zero values can be sent by editing the properties dialog
24
Copyright © 2011 by Denny Lin24 Sliders and other numerical GUI elements GUI elements for horizontal and vertical sliders can be used as input and display elements; has a default range of 0 to 127 Radio boxes provide mutually exclusive buttons which output a number starting at zero; can be used either as indicators or input elements VU meters can be used to indicate decibels (scale of - 99.0 to +12.0), and can be used only as display (output) element
25
Copyright © 2011 by Denny Lin25 Message box Visual containers for user definable messages Only has one inlet and one outlet When clicked or when a bang is received, its contents are sent to the outlet Is aware of the type of data it stores, and will output data of matching type
26
Copyright © 2011 by Denny Lin26 Symbolic messages A symbol is usually a word or some text, and can contain any printable or non-printable character Whitespace is used to separate symbols from each other: cannot type a symbol that has a space character in a message box Valid symbols: –Badget, sound_2, or all_your_base Invalid symbols: –Hello there (there are two symbols) –20 (interpreted as float 20.0)
27
Copyright © 2011 by Denny Lin27 Symbol box The symbol box displays text, or can be used to input Enter a valid symbol text, and a symbol message will be sent to the outlet A symbol message received at the inlet will be displayed as text Sending a bang message to a symbol box causes it to output its contents
28
Copyright © 2011 by Denny Lin28 Lists A list is an ordered collection of floats, symbols, pointers, or any things This collection is treated as one set Lists have a list selector attached to the beginning of its message Lists may contain mixed types: –{5 6 pick up sticks} contains two floats and three symbols A list of one float will be type cast to a float
29
Copyright © 2011 by Denny Lin29 Tables, arrays and graphs A table is a way of using an array, and is a two-dimensional data structure Arrays are invisible A graph can be used to view array contents
30
Copyright © 2011 by Denny Lin30 Creating a new array Use Put->Array from the menu, and complete the dialog box to set up the array name, size, and display characteristics The Save contents option stores array data with the patch file The points, polygon, Bezier curve show data with different degrees of smoothing Can put more than one array in same graph to compare two or more sets of data, by selecting the last graph option The tabwrite object writes data to array The tabread object reads data from array
31
Copyright © 2011 by Denny Lin31 Tabwrite and Tabread Tabwrite takes the array name as its parameter, and writes data to array –Right inlet sets the index –Left inlet sets the value Tabread takes the array name as its parameter, and reads data from the array –The inlet specifies the index –The outlet returns the array’s value
32
Copyright © 2011 by Denny Lin32 2.3 Getting help with Pure Data Original PD Documentation http://www.crca.ucsd.edu/~msp/Pd_documentation/index.htm Online PD Users Forum http://puredata.hurleur.com Tutorials http://www.pd-tutorial.com/english/index.html http://obiwannabe.co.uk/tutorials/html/tutorials_main.html Textbooks used in MUET495 http://aspress.co.uk/ds/pdf/pd_intro.pdf http://en.flossmanuals.net/PureData/_booki/pure-data/pure-data.pdf
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.