HiFirst of all, this is my first email to this email group, so, I want to make sure that asking 'newb' questions is okay, and that this would be the place to email those 'newb' questions.I'll tell a little bit about some things that might be helpful in answering my questions. I started Python when I was in 7th or 8th grade, and loved it. I started working through one of the O'Reilly's Python books. Now, I am taking a Java class, and loving it too ( have a 103%). So when I got PD, I thought I would just have to learn how to apply these things I've learned in Python and Java to PD. I went through the documentation, and just got confused. Next, I tried to find some basic tutorials on the web with no avail. Finally, I looked at the examples that came with the installation. These were by far the best introduction to PD, and I understood them... Until I got to the flow of control ones. It's the one where the counter counts up to ten, then stops, with another that is a counter that goes up by one, and you clear it by pressing the -1 button. Remember, I program, so if it could be explained as if I were programming, that would probably help me. I don't understand what the term 'bang' refers to in these examples, along with why certain 'inlets' connect to certain 'outlets', or the flow of control in the programs, or where the 'count' variable is and how to manipulate it. I feel that once I understand these things, I'll be able to have loads of fun with PD. So, Please help, and:Thank you. _________________________________________________________________ Climb to the top of the charts! Play Star Shuffle: the word scramble challenge with star power. http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_oct
# Hi, # The framework of PD is somewhat different than Java and Phyton. Java is a language in which the code is first compiled then run. While running, the objects are created in memory according to code. # In PD, you are creating the objects in realtime. If you create (put) an object its place in memory is allocated automatically (and deallocated when you deleted it) It is something like a debug mode. # To have something similar to double or float in Java there is an [float] object, [f] is its abbreviation. # [f] is similar to "float x;" and [f 10] is equivalent to "float x = 10;" # In Java the code is run sequentially, one line after another. But in PD there is no such sequantial listing. You have to connect events in an cause&effect manner. # |bang( is a message which activates the primary purposes of the objects. For example [f] holds a number. If you send a |bang( to its inlet it outputs what it keeps, and this output can be used to trigger another objects. You can feed the inlet other things than bang. (You can look at their help to learn which inlet is what for) # so, the idiom "x=x+1" can be done in PD way: Create an [f 0] object. This allocate a slot for a number in memory and initializes it with 0. Create a |bang( message and connect to [f]'s left inlet. Create an [+ 1] object and connect the outlet of the [f] to the left inlet of [+]. When you click on bang, it sends a bang message to [f], [f] outputs the value in it and this value goes to [+ 1], plus is triggered by the incoming number and outputs the incremented number. So, this way we finished the "x+1" part. let assign this value to x. This is done by connecting the output of [+ 1] to the right inlet of [f]. Right inlet of a float assigns the incoming number to the slot in the memory like the left inlet. But unlike it, f does not output if right inlet is used (which is called "cold inlet") if you use left inlet (don't use it!) as you can see, the patch will fall in a loop. # This is some kind of explanation in the perspective of traditional programming. # Good luck! -uğur-
On Nov 8, 2007 11:12 PM, Timothy Sikes trs164@hotmail.com wrote:
Hi
First of all, this is my first email to this email group, so, I want to make sure that asking 'newb' questions is okay, and that this would be the place to email those 'newb' questions.
I'll tell a little bit about some things that might be helpful in answering my questions. I started Python when I was in 7th or 8th grade, and loved it. I started working through one of the O'Reilly's Python books. Now, I am taking a Java class, and loving it too ( have a 103%). So when I got PD, I thought I would just have to learn how to apply these things I've learned in Python and Java to PD. I went through the documentation, and just got confused. Next, I tried to find some basic tutorials on the web with no avail. Finally, I looked at the examples that came with the installation. These were by far the best introduction to PD, and I understood them... Until I got to the flow of control ones. It's the one where the counter counts up to ten, then stops, with another that is a counter that goes up by one, and you clear it by pressing the -1 button.
Remember, I program, so if it could be explained as if I were programming, that would probably help me. I don't understand what the term 'bang' refers to in these examples, along with why certain 'inlets' connect to certain 'outlets', or the flow of control in the programs, or where the 'count' variable is and how to manipulate it. I feel that once I understand these things, I'll be able to have loads of fun with PD. So, Please help, and:
Thank you.
Climb to the top of the charts! Play Star Shuffle: the word scramble challenge with star power. Play Now!http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_oct
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Hallo, Timothy Sikes hat gesagt: // Timothy Sikes wrote:
Until I got to the flow of control ones. It's the one where the counter counts up to ten, then stops, with another that is a counter that goes up by one, and you clear it by pressing the -1 button.
Maybe attached counting.pd tutorial helps a bit, it's more verbose.
Remember, I program, so if it could be explained as if I were programming, that would probably help me. I don't understand what the term 'bang' refers to in these examples, along with why certain 'inlets' connect to certain 'outlets', or the flow of control in the programs, or where the 'count' variable is and how to manipulate it. I feel that once I understand these things, I'll be able to have loads of fun with PD.
You feel right: I'd say, understanding execution order, the trigger object and hot and cold inlets are *the* imporant next steps now for you.
I'll give it a shot:
Message objects (I only talk about these now) in Pd talk to each other by sending each other messages through patch cords into inlets. The objects generate messages on their outlets. Almost every object reacts to certain special messages (float-messages, symbol-messages, "meta-messages" like "open filename" or "set tablename" etc.) and also to the bang-message, which is like a default message saying "do your thing, object, and do it now!"
Example: The [float] or [f] object for example accepts two kinds of messages in its first inlet: float-messages (numbers) and the "bang" message. Float messages will set the stored number and output it. The bang message will not change the stored number but only make the [f] object "do its thing" which is: output the stored number.
So far that should have been easy, now the tricky part: In almost every object only the first inlet will make the object generate output. (Exceptions are the time-objects [timer], [realtime])
This inlet is called the "hot inlet". Other inlets that don't generate output are "cold inlets".
With this knowledge, you can already understand the counter idiom, if you closely watch what is happening at each object with every step or bang. Here's the counter idiom in ASCII:
[f 0]x[+ 1] | [print result]
Note: The outlet of [f] is connected to the "hot" left inlet of the [+ 1], but the outlet of [+ 1] is connected to the "cold" right inlet of the [f].
First step: "bang" the [f]
What happens is, that the stored number, 0 at first, is sent to the [+ 1] which adds 1 so we get 1 and immediatly (because the inlet of [+ 1] was hot) sends the 1 back to the [f]. At this time, the 1 is sent into a cold inlet, so the [f] only stores the 1 but doesn't generate any further output and execution stops here.
Second step: "bang" the [f] again
Now the [f] has a 1 stored, which will be sent to the [+ 1] which adds 1 again so we get 2. Immediatly (because the inlet was hot) the 2 gets sent to the cold inlet of the [f], is stored there and we're done again.
Further steps go on and on like this.
An interesting alternative step now is resetting the counter: You do this for example by sending a "0" to the [float]'s *cold* inlet, the right one. This will not generate any output, but only set the stored number so that the whole system is ready to start again at 'First step: "bang" the [f]'
As soon as you understand the counter idiom, you have made a huge step to understand Pd in general. After that try to understand the [trigger] object and how outlets "fire" in right to left order and how this ideally fits the right-to-left order of cold-to-hot inlets. But that's homework until the next lesson. ;)
Frank Barknecht _ ______footils.org__
On Nov 8, 2007 11:12 PM, Timothy Sikes trs164@hotmail.com wrote:
Hi
First of all, this is my first email to this email group, so, I want to make sure that asking 'newb' questions is okay, and that this would be the place to email those 'newb' questions.
As long as you don't mind newb answers...
I'll tell a little bit about some things that might be helpful in answering my questions. I started Python when I was in 7th or 8th grade, and loved it. I started working through one of the O'Reilly's Python books. Now, I am taking a Java class, and loving it too ( have a 103%). So when I got PD, I thought I would just have to learn how to apply these things I've learned in Python and Java to PD. I went through the documentation, and just got confused. Next, I tried to find some basic tutorials on the web with no avail. Finally, I looked at the examples that came with the installation. These were by far the best introduction to PD, and I understood them... Until I got to the flow of control ones. It's the one where the counter counts up to ten, then stops, with another that is a counter that goes up by one, and you clear it by pressing the -1 button.
I am not so familiar with object-oriented programming myself, but the best understanding I have is that it's like Pd without the pictures. I come from the opposite direction from you. Actually I learned programming first with Pd, not realizing that's what I was learning. Each object in Pd has methods, properties, and messages. Most of them are pretty straightforward. [float 0] or [f 0] is an instance of [float]; it has the property 0, which can change, and float, which can't; it has one method to replace its value (a float sent to its right inlet), one method to send a message of its value (a "bang" message to its left inlet), and one method to do both in that order (a float to the left inlet replaces and then sends a message). Where it sends the messages it sends, and from where it receives the instructions it receives, are not for the object itself to worry about.
The [+ 1] object has one method to add 1 to its input and output the result (a float to the left inlet); a method to replace the argument 1 (float to the right inlet); and if I'm not mistaken, it also remembers its last left-side input, so if it has already received a float to the left inlet, then a "bang" to the left inlet repeats the operation the same as before. AFAIK there are no other methods of the [+ 1] object; anything it does is one of those three things. Not including error checking (it won't accept a symbol as input or argument).
One of the fundamental concepts of Pd that arises a lot in newbie confusion is "depth-first message passing". I don't know if such a thing is present in Java or Python or not. I'll take a stab: if two messages are sent by the same object "at the same time", then one is always sent before the other one, and every "method" or message instigated by the first is performed to completion before the second message is sent; if message A goes right before message B, but kicks off C, D, E, F, and G as results of A, no matter how far removed, they all happen before B. This makes the [trigger] object one of the first to learn. It lets you say whether A or B happens first, and it includes a handy sort of case mechanism. Most of the flow control derives from this one concept, and the methods of the various objects.
Remember, I program, so if it could be explained as if I were programming, that would probably help me. I don't understand what the term 'bang' refers to in these examples, along with why certain 'inlets' connect to certain 'outlets', or the flow of control in the programs, or where the 'count' variable is and how to manipulate it. I feel that once I understand these things, I'll be able to have loads of fun with PD. So, Please help, and:
I hope I haven't insulted your intelligence with my explanation.
-Chuckk
Hallo, Chuckk Hubbard hat gesagt: // Chuckk Hubbard wrote:
[float 0] or [f 0] is an instance of [float]; it has the property 0, which can change, and float, which can't; it has one method to replace its value (a float sent to its right inlet), one method to send a message of its value (a "bang" message to its left inlet), and one method to do both in that order (a float to the left inlet replaces and then sends a message). Where it sends the messages it sends, and from where it receives the instructions it receives, are not for the object itself to worry about.
The [+ 1] object has one method to add 1 to its input and output the result (a float to the left inlet); a method to replace the argument 1 (float to the right inlet); and if I'm not mistaken, it also remembers its last left-side input, so if it has already received a float to the left inlet, then a "bang" to the left inlet repeats the operation the same as before. AFAIK there are no other methods of the [+ 1] object; anything it does is one of those three things. Not including error checking (it won't accept a symbol as input or argument).
To illustrate that with Python:
class Float(pyext._class): """[float] in Python""" _inlets=2 _outlets=1
# constructor
def __init__(self,*args)
self.stored=args[0] or 0
def bang_1(self):
"Bang into first inlet: send float to outlet"
self._outlet(1,self.stored)
def float_1(self,f):
self.stored = f
self._outlet(1,f)
def float_2(self,f)
self.stored = f
class Add(pyext._class): """[+ ] in Python""" _inlets=2 _outlets=1
# constructor
def __init__(self,*args)
self.stored = 0
self.add=args[0] or 0
def bang_1(self):
"Bang into first inlet: send float to outlet"
self._outlet(1,self.stored)
def float_1(self,f):
self.stored = f + self.add
self._outlet(1,self.stored)
def float_2(self,f)
self.add = f
# use it: f0 = Float(0) add1 = Add(1) connect((f0, outlet0), (add1, inlet0)) connect((add1, outlet0), (f0, inlet1)) for i in range(10): send_bang_to(f0, inlet0)
The classes are actually almost valid code.
Frank Barknecht _ ______footils.org__
On Thu, 8 Nov 2007 15:12:19 -0600 Timothy Sikes trs164@hotmail.com wrote:
HiFirst of all, this is my first email to this email group, so, I want to make sure that asking 'newb' questions is okay, and that this would be the place to email those 'newb' questions.
Welcome Tim,
Certainly you can ask noob questions, it's what the list is for and things are pretty friendly here, you won't get any RTFM nonsense unless the question is a really obvious FAQ that you would find with a simple Google search.
I went through the documentation, and just got confused.
Out of interest, which documentation are you refering to? Some of it is for reference and is rather terse, like any programming language I suppose.
Next, I tried to find some basic tutorials on the web with no avail.
I have written some new tutorials which are very basic, hopefully I'll get time to web publish them ahead of the textbook from which they are taken. Meanwhile have another look because there are several others here on this list who have written excellent tuts. The Pd community is currently in a phase of intensive documentation and reordering existing stuff with a new multi-language wiki. Try using different search terms such as "Puredata tutorials" and "Pd tutorials". "Pure data" (two words) tends to lead to poor results. There's also a searchable forum with lots of beginner questions archived.
Finally, I looked at the examples that came with the installation. These were by far the best introduction to PD, and I understood them...
Yes they are well thought out and simple. Don't forget that you can access help on any object by right clicking it and choosing "help".
Until I got to the flow of control ones. It's the one where the counter counts up to ten, then stops, with another that is a counter that goes up by one, and you clear it by pressing the -1 button. Remember, I program, so if it could be explained as if I were programming, that would probably help me.
Dataflow is a programing language, but rarely do any tutorials take the longest view and step back to explain it in detail. It is a bit like the "canned loop" you get in GUI frameworks, an event driven system where the entire ensemble of objects is periodically evaluated.
I don't understand what the term 'bang' refers to in these examples,
A bang is a message. It is a most primitive message that just means "compute something". A bang causes the object that receives it to update its state, which usually means outputing its current value or moving to its next state.
along with why certain 'inlets' connect to certain 'outlets', or the flow of control in the programs
Stop thinking about flow of control so much and think about flow of data In visual dataflow programs each box is an object. From an OO point of view you can think of objects as things that only have methods which take data and only return values that are data. Data drives everything.
where the 'count' variable is and how to manipulate it.
The count "variable" is an internal part of the [float] object. You can't read it directly except by banging the float which accesses a method to retrieve the current value.
Don't be afraid to ask more questions. Like all languages doing it practically will cement the principles in place. The curve is quite steep, however you will find that after a few weeks it all suddenly falls into place rather quickly.