-
Koos
I am using a float as part of a filename (of a sound I record). However the filenames are like:
blabla0.wav
blabla10.wav
blabla20.wav
[..]
blabla100.wavNow, I was wondering if it is possible to get:
blabla000.wav
blabla010.wav
blabla020.wav
[..]
blabla100.wavIn other words can I get a specific output format, e.g. 3decimals, from a [float]?
Note: I am computing the float (counter*constant), so I can't just type a 3 decimal number as input for the [makefilename]
-
Koos
I have a loop that makes a recording during each pass.
At the moment the files are named sound%d.wav, where %d is the counter value.Now, I want to get more logical filenames based on two parameters. One to dermine a preset and the second, based on the counter value ,to determine the second part of the filename. The problem is the second part not having an equal length for each preset.
For Example:
when preset/first part is set to:
* A1 the second part will be: X1, X3, X4 (counter 1->3)
* B1 the second part will be: Y6, Y-4, Y-1, Y3 (couter 1->4)
* C1 the second part will be: Z4, Z-3 (counter 1->2)In other words (as I think I the above is not really clear):
I want to do some conditional (?) selectionwhen preset is A1 and counter 1 -> A1X3.wav
A1 and counter 2 -> A1X3.wav
etc
C1 and counter 1 -> C1Z4.wav
C1 and conter 2 -> C1Z-3.wav.. but how?
edit: Only need to run the loop for one (a priori chosen) preset !
-
Koos
Goal: Saving two arrays (left and right channel) in a (stereo) wave file with a specific filename e.g. sound1.wav. Then overwritting the arrays and save again with different filename e.g. sound2.wav.
So far, I am able to save the arrays using
|bang(
|
[savepanel] (Bang->savepanel gives "save as menu")
|
[write(
|
[soundfiler]I tried to get rid of the "save as" by sending the specified file name e.g. sound1(.wav) to [savepanel]. However this results in:
error: savepanel: no such method for 'sound1(.wav)'
I tried changing various things (writesf~, no savepanel etc), but so far I haven't found the mistake...
Edit: I do have a counter available, so I can use something like "sound$1" as filename (where $1 is the counter value) or use [select].
-
Koos
I made a abstraction with three inputs e.g. in1, in2 and in3 and three outputs out1, out2 and out3.
Now I made patch, where I use this abstraction. I set in2 and in3 with a (load)bang and have a counter to change in1; in1 = constant * counter.
The output of the abstraction is something like:
out1 = cos(in1)*sin(in2)*in3
out2 = sin(in1)*sin(in2)*in3
out3 = in3*cos(in2)Indeed, a polar to cartesian conversion. Then I send the cartesian coordinates to a box to indicate a point and in the meanwhile a bang is send to update the counter by one. E.g.
[in1] [in2] [in3]
| | |
[PolarToCartesian]
| | |
[out1] [out2] [out3]
| | |[r out1][r out2][r out3]
| | |
|ToBox $1 $2 $3;(
|ToCounter bang (The problem is that as soon as I set in2 and in3 the out's are calculated (with in1 being the last value inputed..?) and the loop starts running till the stop certeria (max counter)is reached.
However I want to start getting outputs when I start the counter manual (e.g. in1 = 0 -> in2 = contanst * 1 -> in2=constant*2 etc).
Is this possible?
-
Koos
Hello,
I am trying to make a loop in PD that runs a couple of times, but before the next run starts I want to insert a delay.
For example: I want to print the numbers 0-2 with a delay of 2 seconds.
As a test I tried to alter the loop shown in the [until] help, but as delay outputs a bang I am not sure how to implement this correct.
Any tips?
-
Koos
Ah, thanks the solution!
I tried %d3, which -obvious- didn't work.
-
Koos
ehm, I guess I don't have that library?
I only see/have
, , , (still new to PD)
-
Koos
@hardoff said:
check out [list2symbol] from zexy for combining 2 messages into one.
I think [pack] will do the same.
However -current- main problem is the selection process. Obivious I can make one big [select] with 144 arg's, but with 5 different presets and two different 'lists' for the second part (one of 36 values and one of 18) I think there is a better way.
-
Koos
In case anybody needs this in the future:
[bang( [r counter]
| /
\ /
\ /
[float]
|
[makefilename ./rec/sound%d.wav]
|
[write $1]
|
[soundfiler]Notes:
- I had to use ./directory/ instead of ../directory/
I saw ../ mentioned couple of times.
- Make sure to use %d (if input is float/number) when I used %s PD crashed when attempting to save the second wav
Now I have another (small) problem:
Is there a way to overwrite files if they already exist?edit: Nevermind, files are overwritten.
- I had to use ./directory/ instead of ../directory/
-
Koos
@sunji said:
check out [makefilename]
Thanks for the tip. 'Found' this object/command just before reading your reply .
@thep said:
Hey,
I don't know if I'm understanding you correctly, but it seems like you think that the [savepanel] object has something to do with the actual saving of the soundfile.It doesn't it just generates a filename. It's the 'write' message being sent to the soundfiler which causes the soundfiler object to write to disk.
My suggestion is this:
[counter] (assuming this outputs a float when you bang the top)
|
[makesymbol sound%s.wav]
|
|write $1(
|
[soundfiler]The makesymbol will take whatever float you send it and output a symbol soundXXX.wav (the %s in the argument is replaced by whatever float you input to the object). The write $1 then prepends write to the filename, and sends the instruction to soundfiler to write the wav file.
Theo
I tried couple of things without savepanel, but I didn't get any saved file(s). Now I see what I did wrong: I forgot to connect [write] and [soundfiler]. The following works
[bang(
|
[test.wav]
|
[write $1]
|
[soundfiler]Now going to change this to get the filenames right!
By the way I think [makesymbol] should be [symbol]?