<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&#39;s pitch and volume at each iteration through a while(true) loop. </div>
<div>I decided i didn&#39;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&#39;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&#39;t click. However I am </div>
<div>unsure how to adjust the rate as I don&#39;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 =&gt; Envelope e=&gt; dac;</div>
<div>SinOsc s2 =&gt; e =&gt; dac;</div><div>SinOsc s3 =&gt; e=&gt; dac;</div><div>SinOsc s4 =&gt; e=&gt; dac;</div><div><br></div><div>//....</div></div><div><div><br></div><div> while( true )</div><div> {</div><div>  .1 =&gt; float t =&gt;e.time;</div>
<div><br></div><div>  //reassign gain</div><div><br></div><div>  Std.rand2f(0,1) =&gt; float g;</div><div>  g =&gt; s1.gain;</div><div>  g =&gt; s2.gain;</div><div>  g =&gt; s3.gain;</div><div>  g =&gt; s4.gain;</div><div>
<br></div><div>  //reassign pitch</div><div><br></div><div>  Std.mtof(instrumentSet1[Std.rand2(0,6)]) =&gt; s1.freq;</div><div>  Std.mtof(instrumentSet1[Std.rand2(0,6)]) =&gt; s2.freq;</div><div>  Std.mtof(instrumentSet1[Std.rand2(0,6)]) =&gt; s3.freq;</div>
<div>  Std.mtof(instrumentSet1[Std.rand2(0,6)]) =&gt; s4.freq;</div><div><br></div><div>  //Advance time by 1 samp</div><div>  e.keyOn();</div><div>  1000::ms =&gt; now;</div><div>  e.keyOff();</div><div>}</div><div><br></div>
</div></div></span><br>-- <br>&quot;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.&quot; - Henri Poincaré<br>