<div class="gmail_quote">On Tue, Oct 5, 2010 at 2:33 PM, Tom Lieber <span dir="ltr"><<a href="mailto:tom@alltom.com">tom@alltom.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
2010/10/5 Mat Schaffer <<a href="mailto:mat@schaffer.me">mat@schaffer.me</a>>:<br>
<div class="im">> - The SinOsc seems to click whenever I stop or disconnect it. I've tried<br>
> moving the gain to 0.1, then 0, but it still seems to click. Is there some<br>
> technique for avoiding this?<br>
<br>
</div>Typically you'd use an envelope to avoid clicks by slowly ramping the gain.<br>
<br>
For example, you could use an Envelope:<br>
<br>
  SinOsc s => Envelope e => dac;<br>
  50::ms => e.duration;<br>
  while(1) {<br>
      e.keyOn(1);<br>
      second => now;<br>
      e.keyOff(1);<br>
      second => now;<br>
  }<br>
<br>
Or ADSR, which lets you give it a little kick:<br>
<br>
  SinOsc s => ADSR e => dac;<br>
  e.set(50::ms, 50::ms, .4, 50::ms);<br>
  while(1) {<br>
      e.keyOn(1);<br>
      second => now;<br>
      e.keyOff(1);<br>
      second => now;<br>
  }</blockquote><div><br></div><div>Thanks, Tom! Just noticed you also did Ruck which I was looking at. Good luck on the project! I'd love something like ChucK that had a more full-featured language driving it.</div>
<div><br></div><div>Thanks again,</div><div>Mat </div></div>