<span class="Apple-style-span" style="border-collapse: collapse; ">Hello chucKsters, <div><br></div><div>I am trying to write a simple program that reassigns four sine oscillator's pitch and volume at each iteration through a while(true) loop. </div>
<div>I decided i didn't want the clicks at the beginning of each note attack, so I thought that I could remove them by just adding an envelope</div><div>to ramp up to the gain value for each event. After trying different values for the Envelope time and rate, I can't seem to figure out </div>
<div>how to remove the clicks. I apologize as this is probably something obvious that I am blind to in my myopic state. My intuition is </div><div>that if I increased the rate of the envelope the ramp up to 1 would be smoother and then my speakers wouldn't click. However I am </div>
<div>unsure how to adjust the rate as I don't know what range it would be in. </div><div><br></div><div>Sorry for my n00bishness</div><div><br></div><div>Ryan.</div><div><div><br></div><div><div>SinOsc s1 => Envelope e=> dac;</div>
<div>SinOsc s2 => e => dac;</div><div>SinOsc s3 => e=> dac;</div><div>SinOsc s4 => e=> dac;</div><div><br></div><div>//....</div></div><div><div><br></div><div> while( true )</div><div> {</div><div> .1 => float t =>e.time;</div>
<div><br></div><div> //reassign gain</div><div><br></div><div> Std.rand2f(0,1) => float g;</div><div> g => s1.gain;</div><div> g => s2.gain;</div><div> g => s3.gain;</div><div> g => s4.gain;</div><div>
<br></div><div> //reassign pitch</div><div><br></div><div> Std.mtof(instrumentSet1[Std.rand2(0,6)]) => s1.freq;</div><div> Std.mtof(instrumentSet1[Std.rand2(0,6)]) => s2.freq;</div><div> Std.mtof(instrumentSet1[Std.rand2(0,6)]) => s3.freq;</div>
<div> Std.mtof(instrumentSet1[Std.rand2(0,6)]) => s4.freq;</div><div><br></div><div> //Advance time by 1 samp</div><div> e.keyOn();</div><div> 1000::ms => now;</div><div> e.keyOff();</div><div>}</div><div><br></div>
</div></div></span><br>-- <br>"Le savant n’étudie pas la nature parce que cela est utile ; il l’étudie parce qu’il y prend plaisir et il y prend plaisir parce qu’elle est belle." - Henri Poincaré<br>