Difference between revisions of "Pure Data"
From Wikicliki
(28 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Learning by reading Pure Data examples == | == Learning by reading Pure Data examples == | ||
− | Today's goal is to read 12 tutorials to understand how PD works. | + | Today's goal is to read 12 tutorials to understand how PD's GEM works. |
=== Patch 1 - Hello World === | === Patch 1 - Hello World === | ||
Line 7: | Line 7: | ||
[[Image:puredata_helloworld.jpg]] | [[Image:puredata_helloworld.jpg]] | ||
− | |||
+ | * I made a bang. In fact I made two versions of the bang so you can see it. You can make a bang with Shift-⌘-B or just make a new Message and write bang inside it. A bang is a special kind of message that can be used to trigger/execute things. Hooked it to a [Message( with any text inside. Finally, it leads to a [print] object. If you press the loadbang it will print to the display. In the example image above i have pressed it many many times. This is like the trace function that will come in useful further on for debugging and troubleshooting. | ||
* Shortcut for switching between edit and play mode is ⌘-E | * Shortcut for switching between edit and play mode is ⌘-E | ||
− | |||
− | |||
− | === Patch 2 - Flossmanual's GEM Basic Drawing === | + | * '''List of keyboard shortcuts for different things you will write within PD''' (its good to be familiar with the terminologies) |
+ | : (Mac version / windows is probably the same just substitute ⌘ with CTRL] | ||
+ | : [[Image:puredata_shortcuts.jpg]] | ||
+ | |||
+ | === Patch 2 - Hot and Cold Inlets === | ||
+ | |||
+ | From [http://en.flossmanuals.net/pure-data/dataflow-tutorials/order-of-operations/ Flossmanuals: Order of Operations] | ||
+ | |||
+ | * the inlet on the LEFT is the hot inlet, the rest are cold inlets. | ||
+ | * if a value is sent to the cold inlets, it is just stored inside but will not do anything unless the hot inlet receives a value or a bang or something along those lines. | ||
+ | |||
+ | |||
+ | [[Image:puredata_hotcoldinlets.jpg]] | ||
+ | |||
+ | |||
+ | * This is before I press on any of the messages, when I have just made this. The number value at the bottom is still 0. | ||
+ | * Step 1 - At this point, it being the first time I'm running this: | ||
+ | ** If I press on the 7, only 7 will print on Number value below. | ||
+ | ** If I press on 3 or 5, nothing will print as they are leading to cold inlets. | ||
+ | * Step 2 - as for the 2nd thing I press... | ||
+ | ** If in Step 1 I pressed 7, when I press 3 or 5 next, nothing happens, cos they are still cold inlets. | ||
+ | ** If in Step 1 I pressed 3 or 5 (or both), when I press 7 next, they will have gotten whatever 3 or 5 value I added via the cold inlet, so the final number will be 7 + whatever you pressed. | ||
+ | |||
+ | |||
+ | * So how to pack all at the same time, even if the numbers are changing? You'll need to bang them all... | ||
+ | : [[Image:puredata_packallbang.jpg]] | ||
+ | |||
+ | === Patch 3 - Loading Files Tutorial === | ||
+ | |||
+ | From [http://en.flossmanuals.net/pure-data/ch049_moving-images/ Flossmanuals: Moving Images] | ||
+ | |||
+ | === Patch 4 - Flossmanual's GEM Basic Drawing === | ||
From [http://en.flossmanuals.net/pure-data/video-gem-tutorials/basics/ Flossmanual's Basic Gem Tutorial], which helps explain the basics of GEM ("Graphics Environment for Multimedia"). This example loads an image in and maps it to a simple geo, a rectangle. | From [http://en.flossmanuals.net/pure-data/video-gem-tutorials/basics/ Flossmanual's Basic Gem Tutorial], which helps explain the basics of GEM ("Graphics Environment for Multimedia"). This example loads an image in and maps it to a simple geo, a rectangle. | ||
[[Image:puredata_sadcatexample.jpg]] | [[Image:puredata_sadcatexample.jpg]] | ||
+ | |||
* Image has to be placed in the same folder as the pd patch | * Image has to be placed in the same folder as the pd patch | ||
* Objects that deal with textures are called pix objects and have the prefix "pix_" in their object name. | * Objects that deal with textures are called pix objects and have the prefix "pix_" in their object name. | ||
* Why do we still need [pix_texture] with the other [pix_image]? Because this is the pix_texture is the part that indicates that the texture is to be mapped onto the geo (in this case a rectangle). | * Why do we still need [pix_texture] with the other [pix_image]? Because this is the pix_texture is the part that indicates that the texture is to be mapped onto the geo (in this case a rectangle). | ||
+ | * Default colour of a geo is white | ||
− | * '''List of Gem controls''' (From [http://gem.iem.at/documentation/manual/manual/list-of-gem-objects List of Gem Objects] | + | * '''List of Gem controls''' (From [http://gem.iem.at/documentation/manual/manual/list-of-gem-objects List of Gem Objects]] |
**gemhead - the start of rendering chain | **gemhead - the start of rendering chain | ||
**gemwin - the window manager | **gemwin - the window manager | ||
Line 35: | Line 66: | ||
− | * '''List of possible Geos''' (From [http://gem.iem.at/documentation/manual/manual/list-of-gem-objects#Geos List of Gem Objects] | + | |
+ | * '''create and destroy gemwin''' | ||
+ | * this is how you can create or destroy the gem window. click on create to make it and destroy to remove. | ||
+ | * i think the 0 in front of destroy is a delay, a vestige of previous versions of pd that might crash due to some things like gemmouse becoming invalidated at the point of destroying the gemwin | ||
+ | : [[Image:puredata_createdestroygemwin.jpg]] | ||
+ | |||
+ | |||
+ | |||
+ | * '''List of possible Geos''' (From [http://gem.iem.at/documentation/manual/manual/list-of-gem-objects#Geos List of Gem Objects]] | ||
** circle - render a circle | ** circle - render a circle | ||
** colorSquare - render a colored square (evtl. with color gradients) | ** colorSquare - render a colored square (evtl. with color gradients) | ||
Line 63: | Line 102: | ||
** textoutline - render outlined text (polygonal) | ** textoutline - render outlined text (polygonal) | ||
** triangle - render a triangle | ** triangle - render a triangle | ||
+ | |||
+ | |||
* '''Teapot example''': | * '''Teapot example''': | ||
− | [[Image:puredata_sadcatteapotexample.jpg]] | + | : [[Image:puredata_sadcatteapotexample.jpg]] |
+ | |||
+ | |||
* BONUS!!! I found an extra shape while reading another page: the '''pqtorusknots'''... (note there is no pqtorus... just pqtorusknots) | * BONUS!!! I found an extra shape while reading another page: the '''pqtorusknots'''... (note there is no pqtorus... just pqtorusknots) | ||
: (a torus knot is like a big fat knotted math cushion. [http://www.blackpawn.com/texts/pqtorus/default.html this] is a better description of a pqtorus knot.) | : (a torus knot is like a big fat knotted math cushion. [http://www.blackpawn.com/texts/pqtorus/default.html this] is a better description of a pqtorus knot.) | ||
− | [[Image:puredata_pqtorus.jpg]] | + | : [[Image:puredata_pqtorus.jpg]] |
− | === Patch | + | === Patch 5 - Feedback Loop patch by hellocatfood === |
[[Image:puredata_hellocatfood.png]] | [[Image:puredata_hellocatfood.png]] | ||
Line 77: | Line 120: | ||
* Noticed there was no connection between the original loading video geo and the feedback geos. Apparently the different geos do not need to be connected up. in this example [gemhead 4] runs first followed by whatever gemhead number next in order. it could be any number bigger than 4. if the second one was gemhead 3 it wouldnt work. the higher the number, the later the [gemhead] is drawing... | * Noticed there was no connection between the original loading video geo and the feedback geos. Apparently the different geos do not need to be connected up. in this example [gemhead 4] runs first followed by whatever gemhead number next in order. it could be any number bigger than 4. if the second one was gemhead 3 it wouldnt work. the higher the number, the later the [gemhead] is drawing... | ||
* No soundtrack. Found out from this flossmanuals page on [http://en.flossmanuals.net/pure-data/ch049_moving-images/ Images, Movies and Live Video] that "Sound is not supported by [pix_film] ([pix_movie] neither). If you want to sync a soundtrack of a video to your images, you have to first extract it using an external video editor." | * No soundtrack. Found out from this flossmanuals page on [http://en.flossmanuals.net/pure-data/ch049_moving-images/ Images, Movies and Live Video] that "Sound is not supported by [pix_film] ([pix_movie] neither). If you want to sync a soundtrack of a video to your images, you have to first extract it using an external video editor." | ||
+ | |||
+ | |||
* '''List of the messages that the gemwin understands''' | * '''List of the messages that the gemwin understands''' | ||
** create - makes the window for output and an OpenGL rendering context | ** create - makes the window for output and an OpenGL rendering context | ||
Line 91: | Line 136: | ||
** title 'name' - puts a title on top of the window where applicable | ** title 'name' - puts a title on top of the window where applicable | ||
** color R G B - changes the background color to the mixture of the Red Green and Blue values. The values are floating point numbers between 0 and 1 where 0 0 0 is black and 1 1 1 is white (1 0 0 is Red etc.) | ** color R G B - changes the background color to the mixture of the Red Green and Blue values. The values are floating point numbers between 0 and 1 where 0 0 0 is black and 1 1 1 is white (1 0 0 is Red etc.) | ||
+ | |||
+ | === Patch 6: Video Mixer === | ||
+ | |||
+ | * [http://en.flossmanuals.net/pure-data/ch050_video-mixer/ Video Mixer] | ||
+ | |||
+ | * http://booki.flossmanuals.net/pure-data/_draft/_v/1.0/video-tracking/ | ||
+ | * http://booki.flossmanuals.net/pure-data/_draft/_v/1.0/video-mixer/ | ||
== see also == | == see also == | ||
Line 96: | Line 148: | ||
: http://www.uni-weimar.de/medien/wiki/Audiovideo | : http://www.uni-weimar.de/medien/wiki/Audiovideo | ||
: http://www.uni-weimar.de/medien/wiki/Bewegungsmelder | : http://www.uni-weimar.de/medien/wiki/Bewegungsmelder | ||
+ | |||
+ | |||
+ | * http://www.umatic.nl/workshop/objects.txt | ||
+ | * http://gem.iem.at/documentation/manual/manual/list-of-gem-objects | ||
+ | |||
* http://trac.rjdj.me/ | * http://trac.rjdj.me/ | ||
Line 101: | Line 158: | ||
* http://crca.ucsd.edu/~msp/Pd_documentation/ | * http://crca.ucsd.edu/~msp/Pd_documentation/ | ||
* [http://aspress.co.uk/ds/about_book.php designing sound] | * [http://aspress.co.uk/ds/about_book.php designing sound] | ||
+ | * http://www.sofyyuditskaya.com/wordpress/ | ||
+ | * http://puredata.info/community/groups/pdmtl - visuals library? | ||
+ | |||
+ | == a return to pd! == | ||
+ | |||
+ | https://puredata.wikispaces.com/ | ||
+ | |||
[[Category:Programming]] | [[Category:Programming]] |
Latest revision as of 19:19, 9 May 2016
Contents
Learning by reading Pure Data examples
Today's goal is to read 12 tutorials to understand how PD's GEM works.
Patch 1 - Hello World
- I made a bang. In fact I made two versions of the bang so you can see it. You can make a bang with Shift-⌘-B or just make a new Message and write bang inside it. A bang is a special kind of message that can be used to trigger/execute things. Hooked it to a [Message( with any text inside. Finally, it leads to a [print] object. If you press the loadbang it will print to the display. In the example image above i have pressed it many many times. This is like the trace function that will come in useful further on for debugging and troubleshooting.
- Shortcut for switching between edit and play mode is ⌘-E
- List of keyboard shortcuts for different things you will write within PD (its good to be familiar with the terminologies)
Patch 2 - Hot and Cold Inlets
From Flossmanuals: Order of Operations
- the inlet on the LEFT is the hot inlet, the rest are cold inlets.
- if a value is sent to the cold inlets, it is just stored inside but will not do anything unless the hot inlet receives a value or a bang or something along those lines.
- This is before I press on any of the messages, when I have just made this. The number value at the bottom is still 0.
- Step 1 - At this point, it being the first time I'm running this:
- If I press on the 7, only 7 will print on Number value below.
- If I press on 3 or 5, nothing will print as they are leading to cold inlets.
- Step 2 - as for the 2nd thing I press...
- If in Step 1 I pressed 7, when I press 3 or 5 next, nothing happens, cos they are still cold inlets.
- If in Step 1 I pressed 3 or 5 (or both), when I press 7 next, they will have gotten whatever 3 or 5 value I added via the cold inlet, so the final number will be 7 + whatever you pressed.
- So how to pack all at the same time, even if the numbers are changing? You'll need to bang them all...
Patch 3 - Loading Files Tutorial
From Flossmanuals: Moving Images
Patch 4 - Flossmanual's GEM Basic Drawing
From Flossmanual's Basic Gem Tutorial, which helps explain the basics of GEM ("Graphics Environment for Multimedia"). This example loads an image in and maps it to a simple geo, a rectangle.
- Image has to be placed in the same folder as the pd patch
- Objects that deal with textures are called pix objects and have the prefix "pix_" in their object name.
- Why do we still need [pix_texture] with the other [pix_image]? Because this is the pix_texture is the part that indicates that the texture is to be mapped onto the geo (in this case a rectangle).
- Default colour of a geo is white
- List of Gem controls (From List of Gem Objects]
- gemhead - the start of rendering chain
- gemwin - the window manager
- gemmouse - outputs the mouse position and buttons in the GEM window
- gemkeyboard - outputs the keycode of a key pressed when you are in the GEM window (there might be different keycodes in Windows/Linux)
- gemkeyname - outputs a symbolic description of a key pressed when you are in the GEM window (there might be different symbols in Windows/Linux)
- gemorb - outputs the position, rotation, and buttons for a Space Orb
- gemtablet - outputs the pen position, pressure, and buttons in the GEM window
- create and destroy gemwin
- this is how you can create or destroy the gem window. click on create to make it and destroy to remove.
- i think the 0 in front of destroy is a delay, a vestige of previous versions of pd that might crash due to some things like gemmouse becoming invalidated at the point of destroying the gemwin
- List of possible Geos (From List of Gem Objects]
- circle - render a circle
- colorSquare - render a colored square (evtl. with color gradients)
- cone - render a cone
- cube - render a cube
- cuboid - render a box
- curve - render a Bezier curve
- curve3d - render a surface
- cylinder - render a cylinder
- disk - render a disk
- imageVert - make pixel colors to a height field map
- model - render an Alias|Wavefront model
- multimodel - render a series of Alias|Wavefront models, render by number
- newWave - render a wave (that is evolving over time)
- polygon - render a polygon
- primTri - a triangle primitive
- rectangle - render a rectangle
- ripple - a rectangle with distorted (over time) texture-coordinates
- rubber - a grid where you can move one of the grid-points
- slideSquare - render a number of sliding squares
- sphere - render a sphere
- square - render a square
- teapot - render a teapot
- text2d - render 2-D text (a bitmap)
- text3d - render 3-D text (polygonal)
- textextruded - render an extruded 3D-text
- textoutline - render outlined text (polygonal)
- triangle - render a triangle
- Teapot example:
- BONUS!!! I found an extra shape while reading another page: the pqtorusknots... (note there is no pqtorus... just pqtorusknots)
- (a torus knot is like a big fat knotted math cushion. this is a better description of a pqtorus knot.)
Patch 5 - Feedback Loop patch by hellocatfood
From http://www.hellocatfood.com/2012/03/23/feedback-loops-in-pure-data/
- Noticed there was no connection between the original loading video geo and the feedback geos. Apparently the different geos do not need to be connected up. in this example [gemhead 4] runs first followed by whatever gemhead number next in order. it could be any number bigger than 4. if the second one was gemhead 3 it wouldnt work. the higher the number, the later the [gemhead] is drawing...
- No soundtrack. Found out from this flossmanuals page on Images, Movies and Live Video that "Sound is not supported by [pix_film] ([pix_movie] neither). If you want to sync a soundtrack of a video to your images, you have to first extract it using an external video editor."
- List of the messages that the gemwin understands
- create - makes the window for output and an OpenGL rendering context
- destroy - removes the output window and the OpenGL context
- 1 - starts rendering
- 0 - stops rendering
- bang - swaps buffers in double buffered mode; clears the window in single buffered mode
- frame $1 - the number sets the frames per second the render chain executes\
- cursor 0/1 - turns the cursor on (1) or off (0)
- border 0/1 - (1) draws a border around the window, (0) removes it
- offset x y - sets the position where the window is drawn. this is usually the screen coordinates for the top left corner of the window. the units are pixels.
- dimen x y - sets the size of the output window. x is the horizontal dimension in pixels, y is the vertical dimension in pixels.
- fullscreen 0/1 - draws the window as the entire size of the screen.
- title 'name' - puts a title on top of the window where applicable
- color R G B - changes the background color to the mixture of the Red Green and Blue values. The values are floating point numbers between 0 and 1 where 0 0 0 is black and 1 1 1 is white (1 0 0 is Red etc.)
Patch 6: Video Mixer
- http://booki.flossmanuals.net/pure-data/_draft/_v/1.0/video-tracking/
- http://booki.flossmanuals.net/pure-data/_draft/_v/1.0/video-mixer/
see also
- max neupert's tutorials
- http://www.uni-weimar.de/medien/wiki/Audiovideo
- http://www.uni-weimar.de/medien/wiki/Bewegungsmelder
- http://www.umatic.nl/workshop/objects.txt
- http://gem.iem.at/documentation/manual/manual/list-of-gem-objects
- http://trac.rjdj.me/
- RjDj
- http://crca.ucsd.edu/~msp/Pd_documentation/
- designing sound
- http://www.sofyyuditskaya.com/wordpress/
- http://puredata.info/community/groups/pdmtl - visuals library?