[PD] message-creation and parsing questions
Hans-Christoph Steiner
hans at eds.org
Thu Jun 12 05:37:43 CEST 2003
> On Tuesday, June 10, 2003, at 11:03 pm, David Merrill wrote:
>
>> Hello pd-ers,
>> I'm still getting the hang of pd, and I'm currently using it to build
>> the mechanism to run a perceptual experiment. For each condition I
>> want to read in values from a text file, play a tone, and record the
>> result. The parts I'm having trouble with are:
>>
>> - how can I build up a message from parts? for instance, the
>> [writesf~] object responds to an "open" message with a single
>> argument, like:
>> "open /tmp/output1.wav"
>> but I want to be able to iterate, and supply "output2.wav",
>> "output3.wav" etc.. I have looked at the docs for the [pack] object,
>> but I'm not sure that it can receive messages as input and pack them,
>> or output it's result as a message - is that correct? am I thinking
>> about this in a wrong way?
>>
[makefilename output%s.wav]----[open $1(----[writesf~]
>> - how can I parse a line of text such as: "output1.wav 440 500 1500"
>> that I get from a [textfile] [bang] into its constituent parts
>> (preserving the appropriate types)?
>>
[unpack] or [route] depending on what you want to do.
>> - (related to the above) is parsing a string different from parsing a
>> list?
>>
Yes, you use different objects. For list parsing you can use [pack],
[unpack], [route], etc. There are some objects for parsing symbols
(what strings are called in pd) but I don't know them off hand. Also,
there is a python object and a tcl object, so those could be handy for
parsing.
.hc
More information about the Pd-list
mailing list