[PD] turn a symbol to a message
Roman Haefeli
reduzierer at yahoo.de
Sun Feb 21 10:55:51 CET 2010
Somehow you managed to create a symbol "open file.wav" (with a space in
between). Usually a space character is used as a delimiter for
separating the elements of a Pd message. However, when the space
character is part of the symbol itself, which is only possible to do by
using [makefilename], it cannot serve as a delimiter between the 'open'
part and the 'file.wav' part anymore.
What [readsf~] expects is a message with the 'open' method with the
first argument being the filename, for instance 'file.wav'. A message
box with the following content could work:
[open file.wav(
But you also could compose such a message without using [makefilename]:
[symbol file.wav(
|
[open $1(
or:
[symbolbox\
|
[open $1(
Traditionally, [makefilename] was used to compose the filename part (not
the whole message), for example when you used some kind of a template
for filenames, for instance fileX.wav, where X would have been a
number.
[numberbox\ <- 40
|
[makefilename file%d.wav]
|
[open $1(
-> open file40.wav
However, with modern versions of Pd, variable substitution within symbol
elements works as well, which is even simpler:
[numberbox\
|
[open file$1.wav(
Another case, which you still need [makefilename] for, is when you would
like the number part of the composed message to be fixed-length:
[numberbox\ <- 91
|
[makefilename file%04d.wav]
|
[open $1(
-> open file0090.wav
Hope that helps
Roman
On Sat, 2010-02-20 at 20:01 +0100, Ignacio Lois wrote:
> Hello everyone.
>
> I've been pulling my hair out for a while with an inexplicable
> problem.
> I'm trying to build an [open file.wav( message to feed a [readsf~]
> object.
> A [makefilename] object is returning the exact symbol. I'm connecting
> it to a [$1( message, and then onto the [readsf~] object and I get the
> error: "readsf~_ no method for 'open file.wav'
> If I replace the $1 message for the hard coded "open file.wav", it
> works perfectly.
> What am I doing wrong?
More information about the Pd-list
mailing list