ListsFirst, download the patches for this chapter: Lists.pd.zip
Often you want to group numbers together into a single message so that an object can respond to multiple things at once. For example if you want to turn on and off notes in a musical synthesizer, then you could make a list of two numbers that includes the frequency and the amplitude as a single message. In Pd, "list" has a special meaning, it is a specific way of collecting data into a single message. The simplest kinds of lists are made up of collections of numbers.
For many math objects, you can use a list as a shortcut for sending data to each inlet. With an object like [+ ], you can send a list of two floats to the left inlet, and [+ ] will interpret the second, rightmost number in the left as if it was sent to the right inlet, and the first, leftmost number as if it was sent to the left inlet.
A list can also include symbols, but if the symbol is the first element, it can get a bit tricky. Pd classifies the basic chunks of data for you. A float is any single chunk of data that can be interpreted as a number, and a symbol is any single chunk of data that cannot be interpreted as a number. Pd also classifies messages as lists based on similar rules. As long as the first element is a number, Pd will recognize the message as a list. If you want to make a list that has a symbol as the first element, then you need to tell Pd that it is a list by starting the message with the "list" selector.
Lists can used for processing collections of data. Once the data is organizing into lists, then it is much easier to sort the data and route it to the places it needs to go. There are a number of objects that output a range of different kinds of data, so they need to use lists instead of specific outlets. |