Nobody really uses jankyteeth/soup anymore. SO i figured I'd ask here: I can still not quite figure out how to do random choice wihtout replacement... I seem to have gotten one of the ways of doing it, but need help to make it not crash the spork. Here is the actual code. After all the effects it tries to randomly select pieces out of a sound file and then plays them at random speeds, etc. so you get a very weird reconstructed sound... feed it any sound file that the soundbuf class understands. The main part I'm having trouble with is the main while(true) loop. Could someone help me out to make this thing work without crashing chuck? click here: http://urbanplexus.net/reconstructor.ck
Hi, This is a common mistake. Arrays in ChucK are indexed from 0 -> N-1. So if you have an array that has 256 pieces, like your patch, the indexes are from 0 - 255. The problem you are encountering in your main loop is that std.rand2 is returning a number between 0 and 256 - INCLUDING 256. If you change that line to this: std.rand2(0, pieces-1) => piece; then everything will work out just fine. I have it running and crackling just fine on osx. Happy ChucKing. --art On Oct 18, 2005, at 10:59 AM, Vassili Slessarenko wrote:
Nobody really uses jankyteeth/soup anymore. SO i figured I'd ask here:
I can still not quite figure out how to do random choice wihtout replacement... I seem to have gotten one of the ways of doing it, but need help to make it not crash the spork. Here is the actual code. After all the effects it tries to randomly select pieces out of a sound file and then plays them at random speeds, etc. so you get a very weird reconstructed sound... feed it any sound file that the soundbuf class understands. The main part I'm having trouble with is the main while(true) loop. Could someone help me out to make this thing work without crashing chuck?
click here: http://urbanplexus.net/reconstructor.ck _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
participants (2)
-
Adam R. Tindale
-
Vassili Slessarenko