Fellow ChucKists, Yesterday I posted this to the forum and I thought people here might be amused as well. I suppose it's "code art" but working from the idea that some art can be ugly. It might also be a bit like a toddler who discovers he *can* stuff beads up his nose and doesn't stop to pause whether he *should* do so... I'm sorry, Kas. UGen top; fun UGen foo(int n) { if (n <= 0) { return dac; } else { ([new SinOsc, new TriOsc, new SawOsc, new SqrOsc])[ Std.rand2(0, 3)] @=> UGen bar; 1.0 / n => (bar $ Phasor).phase; (n%3) + 1 => (bar $ PulseOsc).sync; (75 * (n-1)) + 1 => bar.gain; (5 * n) => (bar $ Shakers).freq; if (n == 1) bar @=> top; bar => foo(n - 1); return bar; } } Step stp => Envelope e; true => stp.next; 6::second => dur loop => e.duration; while (1) { top =< dac; !(e.value() $ int ) * 10000 => e.target; e => foo(([1, 4, 7, 10, 13])[Std.rand2(0,4)]); loop => now; }
the animals in the neighborhood salute you ; ) *********** Van Stiefel Assistant Professor Department of Music Theory and Composition Swope Music Building College of Visual and Performing Arts West Chester University West Chester, PA 19383 Tel.: 610-436-2757 -----Original Message----- From: chuck-users-bounces@lists.cs.princeton.edu on behalf of Kassen Sent: Fri 8/21/2009 10:40 AM To: ChucK Users Mailing List Subject: [chuck-users] Playing with fire Fellow ChucKists, Yesterday I posted this to the forum and I thought people here might be amused as well. I suppose it's "code art" but working from the idea that some art can be ugly. It might also be a bit like a toddler who discovers he *can* stuff beads up his nose and doesn't stop to pause whether he *should* do so... I'm sorry, Kas. UGen top; fun UGen foo(int n) { if (n <= 0) { return dac; } else { ([new SinOsc, new TriOsc, new SawOsc, new SqrOsc])[ Std.rand2(0, 3)] @=> UGen bar; 1.0 / n => (bar $ Phasor).phase; (n%3) + 1 => (bar $ PulseOsc).sync; (75 * (n-1)) + 1 => bar.gain; (5 * n) => (bar $ Shakers).freq; if (n == 1) bar @=> top; bar => foo(n - 1); return bar; } } Step stp => Envelope e; true => stp.next; 6::second => dur loop => e.duration; while (1) { top =< dac; !(e.value() $ int ) * 10000 => e.target; e => foo(([1, 4, 7, 10, 13])[Std.rand2(0,4)]); loop => now; }
2009/8/21 Stiefel, Van
the animals in the neighborhood salute you ; )
I tried to get the frequencies contained to a reasonable range but this -erm- structure doesn't mix so well with being reasonable :-). Actually it doesn't seem to mix well with readability, maintainability and good stylistic taste either. It does have some rather interesting implications for function syntax, this works; e => foo(([1, 4, 7, 10, 13])[Std.rand2(0,4)]); and it's nice, it's even somewhat logical, but I'm not at all sure the language specs make it clear that it *should* work. In a way two parameters are send to the function but ChucK figures out the UGen should be connected to the return value of the function. Interesting. Yours, Kas.
participants (2)
-
Kassen
-
Stiefel, Van