<div dir="ltr">Hi Gary,<br>Thanks for the response. I&#39;m changing the frequency like this:<br><br>plucked-&gt;noteOn(freq, 1.0);<br><br>Which internally on Plucked.cpp does:<br><br>this-&gt;setFrequency( frequency );<br>

this-&gt;pluck( amplitude );<br><br><br>I understand that the length of the delay line controls the frequency, so I&#39;ve printed out the parameter to  &quot;delayLine_.setDelay(delay);&quot; in the setFrequency method of Plucked.cpp and the parameter is always the same, even when the instrument is out of tune.<br>

<br>Another interesting bit of information is that this issue would not happen on an iPhone 4, but it is prominent on an iPhone 5. Any clues?<br><br>Thanks,<br><br><br>Hector</div><div class="gmail_extra"><br><br><div class="gmail_quote">

On Fri, Mar 8, 2013 at 6:16 AM, Gary Scavone <span dir="ltr">&lt;<a href="mailto:gary@ccrma.stanford.edu" target="_blank">gary@ccrma.stanford.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi Hector,<br>
<br>
If the note is out of tune, then there must be a problem with the delay line length.  That is, it should not matter whether, or in what way, the delay line is filled with noise (though if the delay line is not filled with noise, it may not produce any sound because it won&#39;t have much energy left inside).  This code is fairly old and we haven&#39;t noticed any problems over the years, so perhaps you are using it (updating the control parameters) in some way that was not expected.  How are you changing the plucked note number or frequency?<br>


<br>
Regards,<br>
<br>
--gary<br>
<div><div class="h5"><br>
On 2013-03-06, at 4:38 PM, Hector Urtubia &lt;<a href="mailto:urtubia@mrbook.org">urtubia@mrbook.org</a>&gt; wrote:<br>
<br>
&gt; Hi All,<br>
&gt; I&#39;m having issues with the Plucked instrument on iOS where sometimes notes get completely out of tune.<br>
&gt; I took a look at the Sitar instrument, which uses a similar algorithm and doesn&#39;t show the same issue and I isolated the problem to the following lines on the &quot;pluck&quot; method of Plucked:<br>
&gt;<br>
&gt;   for ( unsigned long i=0; i&lt;delayLine_.getDelay(); i++ )<br>
&gt;     // Fill delay with noise additively with current contents.<br>
&gt;     delayLine_.tick( 0.6 * delayLine_.lastOut() + pickFilter_.tick( noise_.tick() ) );<br>
&gt;<br>
&gt;<br>
&gt; If I don&#39;t fill the delay buffer after changing the frequency, then the notes stay in tune, but then I have to modify the tick method where the timbre of the instrument is not the same at all.<br>
&gt; Any ideas?<br>
&gt; Regards,<br>
&gt;<br>
&gt; Hector<br>
</div></div>&gt; _______________________________________________<br>
&gt; Stk mailing list<br>
&gt; <a href="mailto:Stk@ccrma.stanford.edu">Stk@ccrma.stanford.edu</a><br>
&gt; <a href="http://ccrma-mail.stanford.edu/mailman/listinfo/stk" target="_blank">http://ccrma-mail.stanford.edu/mailman/listinfo/stk</a><br>
<br>
</blockquote></div><br></div>