Hi, I’m trying to play a SineOsc. I want the frequency to be randomly selected from an array. I also want it to change along time as defined by Dust.kr(1) with a TIRand.
I’m constantly getting an “Index not an Integer” error.
Help says TIRand is supposed to create an Integer value. Ive tried index.asInteger, index.round. No luck.
Can someone help me?
var trig = Dust.kr(1);
x = [440, 880, 1760, 3520, 7040, 14080];
index = TIRand.kr(0, 5, trig);
That’s because 2 is an integer. TIRand is a placeholder that indicates the (possible) existence of a functor on the audio server, what should the [ ] do with that?
All manipulation of sound (or anything on the server in general) must be done with one of these functors, called ugens. Now when you write a + in audio code, this automatically expands to something like Add.ar(...). Something similar could be done with [ ]… but it hasn’t (and for the best really). So you must use the underlying ugen yourself. Look at all the various versions of Select and you will see why it’s not a simple task of replacing [ ] with a Ugen automatically.
Edit: I may or may not be using the word functor wrong… I basically mean a ‘callable’ takes in a signal and returns a signal (so endofunction?).