[chuck-users] two similar shreds with different results
Charlie
taos.points at gmail.com
Sun Jan 27 08:58:59 EST 2019
Hey folks, I'm puzzled why these two shreds don't make the same sound. I
created a simple bit crusher using an integer as an index and then using
time as an index; I thought these were equivalent but they aren't. I wonder
if this is because the integer increments at a different rate than the
sampling rate? Any guidance on this gratefully received! Thanks,
Charlie
First shred:
//---------------------------------------------
SinOsc s => dac;
110 => s.freq;
0 => int i;
250 => int iMax;
0 => int jCount;
while (true) {
i++;
// if (i%130 == 0 || i%201 ==0 || i% 737 == 0) 0 =>s.gain;
if (i%iMax > jCount ) 0.0 =>s.gain;
jCount++;
if (jCount > iMax) 0 => jCount;
// 1::samp => now;
.1::ms => now;
1 => s.gain;
}
//---------------------------------------------
second shred:
//---------------------------------------------
SinOsc s => dac;
110 => s.freq;
0::samp => dur jMin;
250::samp => dur iMax;
0::samp => dur jCount;
1::samp => dur jDelta;
while (true) {
if (now%iMax > jCount ) 0.0 =>s.gain;
jCount+jDelta => jCount;
if (jCount > iMax) jMin => jCount;
.1::ms => now;
1 => s.gain;
}
//---------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20190127/c6d1c278/attachment-0001.html>
More information about the chuck-users
mailing list