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:
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?
that I get from a [textfile] [bang] into its constituent parts (preserving the appropriate types)?
much appreciated! -David Merrill
Hi,
- 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"
Have you tried "open $1" where $1 can be a dynamic value ? if receiving a list you can also try "open $n" where n is the n element of the list. Does that answer some of your questions ?
Alex
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?
- 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)?
- (related to the above) is parsing a string different from parsing a
list?
much appreciated! -David Merrill
PD-list mailing list PD-list@iem.kug.ac.at http://iem.kug.ac.at/cgi-bin/mailman/listinfo/pd-list
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