I just gotta share this one-liner that Kassen posted. It rocks! SubNoise s=>dac;int n;while(++n%241+1=>s.rate){(n%83)*ms+ms=>now;5=>Std.srand;} Try ckicking on "replace shred" in miniAudicle a few times, it's a phasor! Les
2009/7/14 Les Hall
I just gotta share this one-liner that Kassen posted. It rocks!
SubNoise s=>dac;int n;while(++n%241+1=>s.rate){(n%83)*ms+ms=>now;5=>Std.srand;}
Try ckicking on "replace shred" in miniAudicle a few times, it's a phasor!
That is sick! -- Tom Lieber http://AllTom.com/
Tom;
That is sick!
Documented features are boring features... Here is the topic for this game; http://electro-music.com/forum/viewtopic.php?t=13512&postorder=asc * the code must be on only 1 line * no more than 80 characters * crazy There is some terrible abuse in that topic, it's like a how-to on writing unreadable unmaintainable code. I like it. Kas.
thor;
That's the spirit!
I might quote you on this when I write the manual for my software :)
I can't take credit for it; it's snowcloned* from Tom's slogan "safe code is boring code". Still it worked; I learned some new things about C++ today as well as about how noise works in ChucK. Sadly I didn't get CNoise to behave and I also didn't fix what I wanted to fix, being Phasor.width(). I think Phasor is considered the basic case for the plain oscillators and somehow all of the others (where it makes sense) have a working .width() yet Phasor doesn't. I can't even figure out how it "ticks" with regard to phase. Still; a lack of documentation here and there did lead to a very educational afternoon/evening. Clearly successful plans are boring plans! Cheers, Kas. *http://en.wikipedia.org/wiki/Snowclone
In case there are still people who aren't yet tired of my explorations around Std.srand(); Below is a short study that plays 8 notes on Flute. As Flute uses a random excitation signal that is based on the central random number generator we can affect the sound of Flute by calling Std.srand to reset the seed. In this case it is reset quite rapidly, making every note identical with a distinct synthetic character. After the first 4 notes we start adding extra Flutes that play silently yet still tick the random generator, resulting in a timbral change in the first flute which we hear in the following 4 notes. For your enjoyment; //====================== Flute f[8]; f[0]=> dac; //avoid distracting modulation 0 => f[0].vibratoGain; for(int i; i<8; i++) { if(i > 3) //after the first 4 notes { //note the use of silent flutes affects the sound of f[0] //by still ticking the pseudo random number generator f[i] => dac; 0 => f[i].gain; 1 => f[i].noteOn; } .5 =>f[0].noteOn; now + .5::second => time later; while (now < later) //the actual modulation { 0 => Std.srand; 2::ms => now; } 0 => f[0].noteOn; .5::second => now; } //=========== During a walk, this afternoon, I contemplated constrasting a Flute that was prepared in this way against a normal one, thinking the distinct timbre might contrast nicely against the more natural sound of the plain Flute, this -of course- won't work as they would use the same random generator. What we also can't have is random melodies to play sounds that are using this technique, at least not unless we implement our own random number generator as a public class. Sadly we can't have our cake and put it in the blender, at least not at the same time. Yours, Kas.
Kassen wrote:
...What we also can't have is random melodies to play sounds that are using this technique, at least not unless we implement our own random number generator as a public class. Sadly we can't have our cake and put it in the blender, at least not at the same time.
Sure we can.
It's not always terribly easy to implement a pseudo-random number
generator, but it is straightforward, and often they are very well
documented. Consider the very simple Xorshift RNGs:
// xorshift random number generators
// see
// Marsaglia, G. "Xorshift RNGs", Journal of Statistical Software,
Vol. 8, Issue 14, Jul 2003.
// http://www.jstatsoft.org/v08/i14
class rng
{
int seed;
2147483647.0 => float MAX_VALUE;
fun int nextInt()
{
return 0;
}
fun float nextFloat()
{
return 0.0;
}
fun float nextFloat(float n)
{
return 0.0;
}
}
class xorshift extends rng
{
fun int nextInt()
{
return seed;
}
fun float nextFloat()
{
return (nextInt()/MAX_VALUE);
}
fun float nextFloat(float n)
{
return (n * nextFloat());
}
}
class xorshift13_17_5 extends xorshift
{
fun int nextInt()
{
(seed << 13) ^=> seed;
(seed >> 17) ^=> seed;
(seed << 5) ^=> seed;
return seed;
}
}
xorshift13_17_5 xor;
2463534242 => xor.seed;
// not sure if these are working correctly, since chuck uses an unsigned integer
while(true)
{
1::second => now;
//<<
Michael Heuer;
It's not always terribly easy to implement a pseudo-random number generator, but it is straightforward, and often they are very well documented.
Quite so, you must have overlooked that I tried to point this out in the post that you quoted. We can simply roll our own. There is a excellent treatment on noise in electronic music by John Ffitch in the CSound Handbook that I very much recommend, it goes into such concerns and it's a worthwhile read if your local library would stock it. The most serious random number generators are always open source and well documented, BTW. Our digital security (banking, military, server administration, etc) depends on them so to make sure they are secure they are always heavily analysed. You could pick one of those then that would give you a mathematical guarantee that nobody will ever be able to humm along to your songs ;-). Yours, Kas.
Kassen wrote:
Michael Heuer;
It's not always terribly easy to implement a pseudo-random number generator, but it is straightforward, and often they are very well documented.
Quite so, you must have overlooked that I tried to point this out in the post that you quoted. We can simply roll our own. There is a excellent treatment on noise in electronic music by John Ffitch in the CSound Handbook that I very much recommend, it goes into such concerns and it's a worthwhile read if your local library would stock it.
The most serious random number generators are always open source and well documented, BTW. Our digital security (banking, military, server administration, etc) depends on them so to make sure they are secure they are always heavily analysed. You could pick one of those then that would give you a mathematical guarantee that nobody will ever be able to humm along to your songs ;-).
Yep, we are in full agreement here, I was referring to your we can't have our cake and put it in the blender line. :) Is it worth adding an RNG class and some RNGs to LiCK? Is anyone using LiCK? The idea was that it could be a dumping ground for all the useful general purpose ChucK stuff that we came up with, but to date only I have put things up there. Perhaps github was not a good place for it? michael
FWIW, I really want to use LiCK, but I haven't found the time to dig in yet...
-mike
On Thu, Jul 16, 2009 at 12:49 PM, Michael Heuer
Kassen wrote:
Michael Heuer;
It's not always terribly easy to implement a pseudo-random number generator, but it is straightforward, and often they are very well documented.
Quite so, you must have overlooked that I tried to point this out in the post that you quoted. We can simply roll our own. There is a excellent treatment on noise in electronic music by John Ffitch in the CSound Handbook that I very much recommend, it goes into such concerns and it's a worthwhile read if your local library would stock it.
The most serious random number generators are always open source and well documented, BTW. Our digital security (banking, military, server administration, etc) depends on them so to make sure they are secure they are always heavily analysed. You could pick one of those then that would give you a mathematical guarantee that nobody will ever be able to humm along to your songs ;-).
Yep, we are in full agreement here, I was referring to your we can't have our cake and put it in the blender line. :)
Is it worth adding an RNG class and some RNGs to LiCK? Is anyone using LiCK? The idea was that it could be a dumping ground for all the useful general purpose ChucK stuff that we came up with, but to date only I have put things up there. Perhaps github was not a good place for it?
michael _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
2009/7/17 mike clemow
FWIW, I really want to use LiCK, but I haven't found the time to dig in yet...
Same here. I could indeed see a use for a library object that would provide various kinds of randomness. Particularly things like standard normal distributions would be useful, for example in controlling grains. That would be one kind of noise that's not yet covered by the build in tools and that's general enough to be universally useful, unlike things like chaotic functions or random walks that seem -to me- top be too specific. I could also imagine how a emulation of dice (with the sort of notation used in tabletop roleplaying games) could be useful as a intuitive way of expressing ranges and distributions for impulsive usage like livecoding. Then again, maybe I'm just exposing myself as a nerd here... Yours, Kas.
participants (6)
-
Kassen
-
Les Hall
-
Michael Heuer
-
mike clemow
-
thor
-
Tom Lieber