ons 2007-08-29 klockan 23:11 +0200 skrev Kassen:
dur => blackhole would be exactly like SinOsc => blackhole, but with time. When you, for example, chuck second into blackhole, the shred will forward 1 second in it's own timeline (A bit like the -s otion, if I recall).
I'm still not sure exactly how this would be different. What would happen to playing Ugens that would be in the shred? Would those keep computing?
The thing is... Hm, if we have something like this: SinOsc 1 => dac; while (true) { 100::ms => now; 3::samp => blackhole; } The shred would jump 3 samples forward every 100 ms. If you change the duration to 10::ms, you might get some glitching going on every 100::ms.
Example: It could be used for plotting numbers over time. If you had two envelopes that ascending from 10 and 15 up to 88 and 100, you could add their value()s to their respective array of floats, round() the floats to ints. Then, in a for loop, you have the computer play a random midi-note between min[i] and max[i]. Congratulations! You got a solo-playing computer! (Sure, I realise that you could do this very task in other ways...)
Yes, chucking time to now would do here, I think. Maybe you could compare how this would be done now to what you propose in some chuck code and some pseudo-code?
Can always try... -------- SinOsc s => dac; fun int plot ( float from, float to, int points, dur length ) { Envelope e => blackhole; from => e.value; to => e.target; length => e.duration; float values[points]; 1 => e.keyOn for (0 => int i; i < points; i++) { e.value() => values[i]; length / points => blackhole; <--- forward! } return values[]; } 10 => int notes; plot(10.0, 88.0, notes, 50::ms) => min[]; plot(15.0, 100.0, notes, 50::ms) => max[]; for (0 => int i; i < notes; i++) { Std.rand2(Math.round(min[i]), Math.round(max[i])) => int midiNr; Std.mtof(midiNr) => s.freq; 100::ms => now; <-- First time we forward our time } --------- Something like that. Gasten