<html><body><div style="color:#000; background-color:#fff; font-family:tahoma, new york, times, serif;font-size:10pt"><div><span>That's a great expla</span><span style="background-color: transparent;">nation, thanks for sharing.</span></div><div><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;">  <div style="font-family: tahoma, 'new york', times, serif; font-size: 10pt;"> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1">  <font size="2" face="Arial"> <b><span style="font-weight:bold;">From:</span></b> Tom Gideon &lt;tegideon@gmail.com&gt;<br> <b><span style="font-weight: bold;">To:</span></b> Ted Stockwell &lt;emorning@yahoo.com&gt; <br><b><span style="font-weight: bold;">Cc:</span></b> "stk@ccrma.stanford.edu" &lt;stk@ccrma.stanford.edu&gt;; Perry Cook &lt;prc@cs.princeton.edu&gt; <br> <b><span style="font-weight:
 bold;">Sent:</span></b> Wednesday, September 11, 2013 4:19 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [Stk] Pops and Crackling on Windows<br> </font> </div> <div class="y_msg_container"><br><div id="yiv2383831881"><div dir="ltr"><div class="yiv2383831881gmail_default" style="font-family: arial, helvetica, sans-serif;">Hi Ted,<br>&nbsp;&nbsp;&nbsp; My approach to finding the problem was the former. (I am an amateur programmer, my background is in mathematics.) I am currently developing a generalization of the STK FM instruments, a modest attempt at building a TX81Z emulator. In this process I observed the same pops and crackling. When looking at the waveforms in Audacity I saw, immediately, that the problem was with a note envelope's onset and release. I then debugged the code using 'oStream_ &lt;&lt; "print something here";' placed at key points. That brought me to the Voicer class. I then noticed that an instantiation of a
 Voicer object required an initial value for decay, it seemed a reasonable guess to augment that value to a value noted elsewhere when I had used grep to find "Voicer(".<br>
&nbsp;&nbsp;&nbsp; I would like to share my work on the TX81Z emulator as soon as I get it working in the best way for all to use.<br>Cheers<br>Tom<br><br><br></div></div><div class="yiv2383831881gmail_extra"><br><br><div class="yiv2383831881gmail_quote">On Tue, Sep 10, 2013 at 9:33 PM, Ted Stockwell <span dir="ltr">&lt;<a rel="nofollow" ymailto="mailto:emorning@yahoo.com" target="_blank" href="mailto:emorning@yahoo.com">emorning@yahoo.com</a>&gt;</span> wrote:<br>
<blockquote class="yiv2383831881gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div style="font-size: 10pt; font-family: tahoma, 'new york', times, serif;"><div><span>Thanks very much!</span></div><div style="font-style:normal;font-size:13px;background-color:transparent;font-family:tahoma,;">
<span><br></span></div><div style="font-style:normal;font-size:13px;background-color:transparent;font-family:tahoma,;"><span>I haven't spent much time looking at the STK code since I'm currently reading Real Sound Synthesis (and this is a side project for me).</span></div>
<div style="font-style:normal;font-size:13px;background-color:transparent;font-family:tahoma,;"><span>I'm curious though how you diagnosed this issue.</span></div><div style="font-style:normal;font-size:13px;background-color:transparent;font-family:tahoma,;">
<span>Was it just a matter of becoming more familiar with the code and making an intelligent guess as to what might make a difference?</span></div><div style="font-style:normal;font-size:13px;background-color:transparent;font-family:tahoma,;">
<span>Or was there a specific tool you used?</span></div><div style="font-style:normal;font-size:13px;background-color:transparent;font-family:tahoma,;"><span>I'm guessing that a debugger is not going to be much help :-).</span></div>
<div><br><blockquote style="border-left:2px solid rgb(16,16,255);margin-left:5px;margin-top:5px;padding-left:5px;">  <div style="font-family:tahoma,;font-size:10pt;"> <div style="font-size:12pt;">
 <div dir="ltr"> <hr size="1">  <font face="Arial"> <b><span style="font-weight:bold;">From:</span></b> Tom Gideon &lt;<a rel="nofollow" ymailto="mailto:tegideon@gmail.com" target="_blank" href="mailto:tegideon@gmail.com">tegideon@gmail.com</a>&gt;<br> <b><span style="font-weight:bold;">To:</span></b> Ted Stockwell &lt;<a rel="nofollow" ymailto="mailto:emorning@yahoo.com" target="_blank" href="mailto:emorning@yahoo.com">emorning@yahoo.com</a>&gt; <br>
<b><span style="font-weight:bold;">Cc:</span></b> Perry Cook &lt;<a rel="nofollow" ymailto="mailto:prc@cs.princeton.edu" target="_blank" href="mailto:prc@cs.princeton.edu">prc@cs.princeton.edu</a>&gt;; "<a rel="nofollow" ymailto="mailto:stk@ccrma.stanford.edu" target="_blank" href="mailto:stk@ccrma.stanford.edu">stk@ccrma.stanford.edu</a>" &lt;<a rel="nofollow" ymailto="mailto:stk@ccrma.stanford.edu" target="_blank" href="mailto:stk@ccrma.stanford.edu">stk@ccrma.stanford.edu</a>&gt; <br>
 <b><span style="font-weight:bold;">Sent:</span></b> Tuesday, September 10, 2013 6:52 PM<div><div class="yiv2383831881h5"><br> <b><span style="font-weight:bold;">Subject:</span></b> Re: [Stk] Pops and Crackling on Windows<br> </div></div>
</font> </div><div><div class="yiv2383831881h5"> <div><br><div><div dir="ltr"><div style="font-family: arial, helvetica, sans-serif;">Hi<br></div><div style="font-family: arial, helvetica, sans-serif;">&nbsp;&nbsp;&nbsp; I'm new to this mailing list and STK. I think I have found the problem with regard to "Pops and Crackling ..." In the
 file "demo.cpp" there is a line that reads<br>
<br>&nbsp; data.voicer = (Voicer *) new Voicer( 0.0 );<br><br></div><div style="font-family: arial, helvetica, sans-serif;">I changed the 0.0 to 0.2 and the pops and crackling disappered. The pops and crackling seemed to be the result of the release time not being activated and the waveform had a "discontinuity" at the end of each note, and this seemed, sometimes, to carry over to the beginning of the next note.<br>

</div><div style="font-family: arial, helvetica, sans-serif;">I hope this helps.<br></div><div style="font-family: arial, helvetica, sans-serif;">Tom Gideon<br><br>...<br></div></div><div>
<br><br><div>On Fri, Aug 30, 2013 at 10:18 PM, Ted Stockwell <span dir="ltr">&lt;<a rel="nofollow" ymailto="mailto:emorning@yahoo.com" target="_blank" href="mailto:emorning@yahoo.com">emorning@yahoo.com</a>&gt;</span> wrote:<br><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div><div style="font-size:10pt;font-family:tahoma,;"><div><span>Thanks very much for the hints, I will try all of them.</span></div><div>
<span>Actually, I did see a couple of messages about exceeding +/- 1.0....</span></div><div><br><blockquote style="border-left:2px solid rgb(16,16,255);margin-left:5px;margin-top:5px;padding-left:5px;">  <div>
 <div style="font-size:12pt;"> <div dir="ltr"> <hr size="1">  <font face="Arial"> <b><span style="font-weight:bold;">From:</span></b> Perry Cook &lt;<a rel="nofollow" ymailto="mailto:prc@CS.Princeton.EDU" target="_blank" href="mailto:prc@CS.Princeton.EDU">prc@CS.Princeton.EDU</a>&gt;<br>

 <b><span style="font-weight:bold;">To:</span></b> Ted Stockwell
 &lt;<a rel="nofollow" ymailto="mailto:emorning@yahoo.com" target="_blank" href="mailto:emorning@yahoo.com">emorning@yahoo.com</a>&gt; <br><b><span style="font-weight:bold;">Cc:</span></b> "<a rel="nofollow" ymailto="mailto:stk@ccrma.stanford.edu" target="_blank" href="mailto:stk@ccrma.stanford.edu">stk@ccrma.stanford.edu</a>" &lt;<a rel="nofollow" ymailto="mailto:stk@ccrma.Stanford.EDU" target="_blank" href="mailto:stk@ccrma.Stanford.EDU">stk@ccrma.Stanford.EDU</a>&gt; <br>

 <b><span style="font-weight:bold;">Sent:</span></b> Friday, August 30, 2013 5:41 PM<br> <b><span style="font-weight:bold;">Subject:</span></b> Re: [Stk] Pops and Crackling on Windows<br> </font> </div><div><div>
 <div><br>Hey Ted,<br><br>I'm doing some STK on RPi already!&nbsp; It works quite well if you<br>pay attention to how much computation you're asking for at<br>any given time.<br><br>Since it happens the same way at the same instant, it could<br>

be clipping for some reason.&nbsp; The CPU spiking might be <br>something inside STK checking for exceeding of +/- 1.0.<br><br>I'd try changing the gain (downward) just a bit.&nbsp; This could <br>be done in a variety of places, including right in the main <br>

program.&nbsp; Find a nice place where the Instrument.tick() method<br>is being called, and
 multiply that times your test gain hack.<br><br>Something like:&nbsp; dac.tick(myRev.tick(0.5*myInstrument.tick())));<br>where you add in that 0.5.&nbsp; <br><br>Another thing to try would be to run the demo with the GUI<br>and see if things click any.&nbsp; Wish I could help more.&nbsp; <br>

<br>PRC<br><br>On Aug 30, 2013, at 2:59 PM, Ted Stockwell wrote:<br><br>&gt; Hi All,<br>&gt; <br>&gt; I'm a programmer that is totally new to sound synthesis and STK.<br>&gt; I've built the demo project on Windows XP, I'm playing with it, and I have some questions... <br>

&gt; <br>&gt; When I play a SKINI file in realtime I hear a lot of pops and crackling/buzzes at specific times in the sequence (demo Clarinet -or -if scores/bookert.ski).<br>&gt; The pops and crackling always happens at the same points in the sequence.<br>

&gt; I've noticed that my CPU usage tops out when the crackling starts (BTW, I have 3.4 Ghz Pentium 4 CPU).<br>&gt; If I generate a .wav file
 instead and play the .wav file then I don't hear any crackling (demo Clarinet -if scores/bookert.ski -ow clarinet.wav) .<br>&gt; I figure the issue must be related to the realtime synthesis of the sound (but I suppose it could be the actual playing of the sound).<br>

&gt; <br>&gt; I've tried increasing RT_BUFFER_SIZE from 512 to 4096 but that made no difference.<br>&gt; Can anybody suggest a remedy?<br>&gt; My ultimate goal is too use STK on a Raspberry Pi so I'll need to understand/solve this issue in order to be comfortable moving forward.<br>

&gt; <br>&gt; Thanks in advance,<br>&gt; <br>&gt; -ted stockwell<br>&gt; <br>&gt; <br>&gt; PS: I've ordered a copy of Real Sound Synthesis for Interactive Applications but I haven't received it yet, so I don't understand how any of this stuff works :-).<br>

&gt; <br>&gt; _______________________________________________<br>&gt; Stk mailing list<br>&gt; <a rel="nofollow" ymailto="mailto:Stk@ccrma.stanford.edu" target="_blank" href="mailto:Stk@ccrma.stanford.edu">Stk@ccrma.stanford.edu</a><br>&gt; <a rel="nofollow" target="_blank" href="http://ccrma-mail.stanford.edu/mailman/listinfo/stk">http://ccrma-mail.stanford.edu/mailman/listinfo/stk</a><br>

<br><br></div> </div></div></div> </div> </blockquote></div>   </div></div><br>_______________________________________________<br>
Stk mailing list<br>
<a rel="nofollow" ymailto="mailto:Stk@ccrma.stanford.edu" target="_blank" href="mailto:Stk@ccrma.stanford.edu">Stk@ccrma.stanford.edu</a><br>
<a rel="nofollow" target="_blank" href="http://ccrma-mail.stanford.edu/mailman/listinfo/stk">http://ccrma-mail.stanford.edu/mailman/listinfo/stk</a><br>
<br></blockquote></div><br></div></div><br><br></div> </div></div></div> </div> </blockquote></div>   </div></div></blockquote></div><br></div></div><br><br></div> </div> </div> </blockquote></div>   </div></body></html>