Personal tools
You are here: Home development PdMessages
Views

Edit history

Edit: -1 of 1
Time: 2009-08-13 14:52:21
Note: /pd/pd/dev/PdMessages/edit

changed:
-
This is Frank Barknecht's take on how more clearly define things in PdDefinitions:

Messages in Pd
==============

Objects in Pd send each other various data in the form of messages.
Messages can transport various kinds of information: single numbers
and words, groups of numbers and words etc. Understanding the various
ways to built and work with messages is a key to understanding Pd. 


Nomenclature (not scientific)
-----------------------------

number: 
 something you count and compute with like 1, 0.1, 1.21e+20

word: 
  Any atomic element that is not a valid number is considered a word                               
  or symbol, though we avoid the term "symbol" in this context to not                               
  confuse it with Pd's "symbol-messages". This includes, but is not                                 
  limited to the things you can look up in a dictionary. More                                       
  specifically a word is a string sequence that does not contain                                    
  whitespace (unless properly escaped), semicolons or commas and is 
  not a functional representation of a number.

  **Important note about "exotic" words:** It is possible to create words that
  at first glance look like a number with ``makefilename %d``. Internally these
  are of type "A_SYMBOL" in Pd and they are not functional as real numbers
  (i.e. you cannot do math or count and compute with them), but you can use
  them as selectors.  They are seldomly used, but you should be aware of
  their existence. Besides these digit-words some other exotic words include
  the symbols for non-printable characters like BACKSPACE or SPACE, which can
  be created by sending their ASCII-code numbers to ``makefilename %c``

  In the following all these are included when we talk about "words".

Atomic messages
---------------

bang:
.....

The most basic message is "bang". It consists of the single word
"bang" for example written in a message box. There also is the
object ``bang`` (short ``b``) which transforms every incoming message to
a "bang"-message.

Anatomy of a bang-message:
 "bang"

float:
......

A message that starts with the word "float" followed by exactly one number. The
first word "float" is also called the selector.  Examples "float 1", "float
-3.4", "float 1.21e+20". A message that only contains a number is a
float-message as well, the selector "float" then is implied.

Anatomy of a float-message: 
    
Selector: 
 float (can be implied)
    
Data:     
 one number

symbol: 
.......

A message that starts with the word "symbol" followed by (exactly)
one word. The first word "symbol" is also called the selector. If
there are more words or numbers following the data word, they get
truncated to create a proper symbol-message.

Anatomy of a symbol-message: 
  
Selector: 
     symbol (can not be implied!)
    
Data:     
     one word
    
pointer:
........

(Uhm, how to define a pointer?)

List-messages
-------------

The official text by Miller (list-help.pd): 

  Messages in Pd are somewhat artificially divided into two classes.
  First are data-holding messages (bang, float, symbol, list) which are
  the primary way of communicating between objects. Second is
  "everything else" (you could call them out-of-band messages or
  metamessages) that describe changes in configuration, read and write
  files, quit Pd, etc. These are provided so that complex objects don't
  need to have 100 separate inlets for every possible functionality.
  It's not clear whether this was a good design choice, but it's
  entrenched.

  The distinction becomes visible, and ugly, when the leading item in
  a data-holding message is a symbol (i.e. word, fbar). In this case,
  to disambiguate it from the other sort, the printed form of the
  message has a selector, "list" or "symbol" prepended to it.
  Underneath, there is always a selector in fromt of data messages,
  but it is implied if the first data item is a number.

My take: 

A list-message is a multi-element message starting with the word "list"
as selector. List-messages can be generated using the ``list`` object
family, which all convert their input to a list-message and - except
``list trim`` - they all output proper list-messages. ``list trim``
splits off the "list"-selector and just passes the data part of a
list-message.

List-messages with just one element are handled specially, see
below.

Anatomy of a list-message: 

Selector: 
     list (can be implied, if data starts with a number)

Data:     
     normally at least two elements (words, numbers or
     pointers). One-element list-messages get converted to
     atomic messages, see below.
    
One-element lists
.................

If a list-message's data contains zero or one elements, the message
gets  converted to an atomic message according to the following
rules:

No data:     
 conversion to bang-message.

One word:    
 conversion to symbol-message

One number:  
 conversion to float message.

One pointer: 
 conversion to pointer

Implied list-selector
.....................

A multi-element message that starts with a number is a list-message,
too. (Cf. implied selector in float-messages)

Meta-messages
-------------

Messages that are neither pointers, float-, symbol-, list- nor
bang-messages. 

Meta-messages can be generated out of atomic and list-messages using
``list trim``. Many objects like ``openpanel``, ``tabread`` etc. accept
and generate meta-message for administrative tasks. 

Anatomy of a meta-message:

Selector: 
 a word that is not "float", "symbol", "list" nor "bang"

Data:     
 anything

Examples::

    "reset"
    "read -resize soundfile.wav"
    "set pd-%s"
    "/synth/param 0 127"

Hey, that was a short definition of meta-messages. 




Powered by IEM Powered by Plone Section 508 WCAG Valid XHTML Valid CSS Usable in any browser