[PD] First time PD troubles: A programmers confusion.

Chuckk Hubbard badmuthahubbard at gmail.com
Fri Nov 9 00:56:25 CET 2007

On Nov 8, 2007 11:12 PM, Timothy Sikes <trs164 at 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.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20071109/446a899a/attachment.htm>

More information about the Pd-list mailing list