please excuse the following beginner question.
I am trying to query the length of a buffer ~buf1 in order to store it
in a global variable, which I can then use in arguments of a Synth.new
So far I have managed to do
which gets me a continuously running UGen inside ~lb1. Is there a way
to have the actual value inside that variable instead of the UGen? I
would like to print the value, and do some language-side math on it and
use it as argument in Synth.new objects.
Thanks for all hints!
sc-users mailing list
In terms of best practices, you probably want to do something like this:
var duration, samples, rate;
duration = BufDur.kr(bufnum);
samples = BufSamples.kr(bufnum);
rate = BufSampleRate.kr(bufnum);
Synth(\bufferThing, arg:[\bufnum, ~buffer]);
Meaning - if you need the duration, samples, etc in your Synth, pass in a buffer number and get them via the Buf* Ugens. It's more robust insofar as you can change the buffer while the synth is running and everything will work correctly - and simpler, as you can just pass the buffer number, and not worry about ALSO passing e.g. duration, sample rate, etc.