<div dir="ltr">Finally, an actual Stk question!<div><br></div><div>Looks like I set the frequency with setFrequency, and the rate at which the read back value changes with setRate?  I&#39;m using the LFO to slowly change the center frequency of a BiQuad filter, and doing so at sample rate within the tick() method.<div><br></div><div>By the way, it sounds great!</div><div><br></div><div>Nothing particularly wrong with this.<br><br>Now I&#39;d like to get simultaneous sin and cos off this filter.  I see there are addPhase and addPhaseOffset methods, which are described very subtly different, but I cannot actually tell what the difference between them is.</div><div><br></div><div>Seems like to get cos immediately after sin I&#39;d need to add Phase or the Phase offset, do another tick, and read the lastOut.  Then I&#39;d need to set the phase offset back to zero for the nest time around reading the sin value.</div><div><br></div><div>Is this anywhere close to being correct?</div><div><br></div><div>GSW<br><br><br><br><div style="font-stretch:normal;font-size:14px;line-height:19px;font-family:roboto,sans-serif;padding:0px;margin-bottom:10px;margin-right:5px;width:1883px;color:rgb(0,0,0);display:table"><div style="font-weight:bold;font-stretch:normal;border-top:1px solid rgb(168,184,217);border-left:1px solid rgb(168,184,217);border-right:1px solid rgb(168,184,217);padding:6px 0px;color:rgb(37,53,85);border-top-right-radius:4px;border-top-left-radius:4px;background-image:url(&quot;http://nav_f.png&quot;);background-color:rgb(226,232,242);background-repeat:repeat-x"><br><br><br><table style="font-weight:400;font-stretch:normal"><tbody><tr><td style="width:1840px;padding:0px"><table style="font-weight:bold;font-stretch:normal;font-family:roboto,sans-serif;margin-left:6px"><tbody><tr><td style="margin-left:6px;vertical-align:bottom">void stk::SineWave::setRate</td><td style="vertical-align:bottom">(</td><td style="white-space:nowrap;vertical-align:bottom">StkFloat </td><td style="color:rgb(96,32,32);white-space:nowrap;vertical-align:bottom">rate</td><td style="vertical-align:bottom">)</td><td style="vertical-align:bottom"></td></tr></tbody></table></td><td style="vertical-align:bottom;padding:0px;white-space:nowrap"><span style="margin-left:8px"><span style="border-width:1px;border-style:solid;border-color:rgb(83,115,180) rgb(196,207,229) rgb(196,207,229) rgb(83,115,180);color:white;margin-right:4px;padding:2px 3px;border-radius:3px;font-size:7pt;vertical-align:middle;background-color:rgb(114,141,193)">inline</span></span></td></tr></tbody></table></div><div style="font-stretch:normal;border-width:0px 1px 1px;border-bottom-style:solid;border-bottom-color:rgb(168,184,217);border-left-style:solid;border-left-color:rgb(168,184,217);border-right-style:solid;border-right-color:rgb(168,184,217);padding:6px 10px 2px;border-bottom-left-radius:4px;border-bottom-right-radius:4px;background-image:url(&quot;http://nav_g.png&quot;);background-repeat:repeat-x"><p style="font-stretch:normal">Set the data read rate in samples. The rate can be negative.</p><p style="font-stretch:normal">If the rate value is negative, the data is read in reverse order.</p><div style="font-stretch:normal;padding:4px;margin:4px;border:1px solid rgb(196,207,229);background-color:rgb(251,252,253)"><div style="font-stretch:normal;font-size:13px;line-height:1;font-family:monospace,fixed;min-height:13px;white-space:pre-wrap;word-wrap:break-word;padding-left:53px;padding-bottom:0px;margin:0px"><a name="m_-1238317231996039433_l00041" style="color:rgb(61,87,140)"></a><span style="padding-right:4px;text-align:right;border-right:2px solid rgb(0,255,0);white-space:pre-wrap;background-color:rgb(232,232,232)">   41</span> { rate_ = rate; };</div></div></div></div><a style="color:rgb(61,87,140);font-family:roboto,sans-serif;font-size:14px;line-height:19px"></a><span style="color:rgb(0,0,0);font-family:roboto,sans-serif;font-size:14px;line-height:19px"></span><div style="font-stretch:normal;font-size:14px;line-height:19px;font-family:roboto,sans-serif;padding:0px;margin-bottom:10px;margin-right:5px;width:1883px;color:rgb(0,0,0);display:table"><div style="font-weight:bold;font-stretch:normal;border-top:1px solid rgb(168,184,217);border-left:1px solid rgb(168,184,217);border-right:1px solid rgb(168,184,217);padding:6px 0px;color:rgb(37,53,85);border-top-right-radius:4px;border-top-left-radius:4px;background-image:url(&quot;http://nav_f.png&quot;);background-color:rgb(226,232,242);background-repeat:repeat-x"><table style="font-stretch:normal;margin-left:6px"><tbody><tr><td style="margin-left:6px;vertical-align:bottom">void stk::SineWave::setFrequency</td><td style="vertical-align:bottom">(</td><td style="white-space:nowrap;vertical-align:bottom">StkFloat </td><td style="color:rgb(96,32,32);white-space:nowrap;vertical-align:bottom">frequency</td><td style="vertical-align:bottom">)</td><td style="vertical-align:bottom"></td></tr></tbody></table></div><div style="font-stretch:normal;border-width:0px 1px 1px;border-bottom-style:solid;border-bottom-color:rgb(168,184,217);border-left-style:solid;border-left-color:rgb(168,184,217);border-right-style:solid;border-right-color:rgb(168,184,217);padding:6px 10px 2px;border-bottom-left-radius:4px;border-bottom-right-radius:4px;background-image:url(&quot;http://nav_g.png&quot;);background-repeat:repeat-x"><p style="font-stretch:normal">Set the data interpolation rate based on a looping frequency.</p><p style="font-stretch:normal">This function determines the interpolation rate based on the file size and the current <a href="https://ccrma.stanford.edu/software/stk/classstk_1_1Stk.html#a5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate." style="color:rgb(70,101,162);font-weight:bold" target="_blank">Stk::sampleRate</a>. The <em>frequency</em> value corresponds to file cycles per second. The frequency can be negative, in which case the loop is read in reverse order.</p></div></div><a style="color:rgb(61,87,140);font-family:roboto,sans-serif;font-size:14px;line-height:19px"></a><span style="color:rgb(0,0,0);font-family:roboto,sans-serif;font-size:14px;line-height:19px"></span><div style="font-stretch:normal;font-size:14px;line-height:19px;font-family:roboto,sans-serif;padding:0px;margin-bottom:10px;margin-right:5px;width:1883px;color:rgb(0,0,0);display:table"><div style="font-weight:bold;font-stretch:normal;border-top:1px solid rgb(168,184,217);border-left:1px solid rgb(168,184,217);border-right:1px solid rgb(168,184,217);padding:6px 0px;color:rgb(37,53,85);border-top-right-radius:4px;border-top-left-radius:4px;background-image:url(&quot;http://nav_f.png&quot;);background-color:rgb(226,232,242);background-repeat:repeat-x"><table style="font-stretch:normal;margin-left:6px"><tbody><tr><td style="margin-left:6px;vertical-align:bottom">void stk::SineWave::addPhase</td><td style="vertical-align:bottom">(</td><td style="white-space:nowrap;vertical-align:bottom">StkFloat </td><td style="color:rgb(96,32,32);white-space:nowrap;vertical-align:bottom">phase</td><td style="vertical-align:bottom">)</td><td style="vertical-align:bottom"></td></tr></tbody></table></div><div style="font-stretch:normal;border-width:0px 1px 1px;border-bottom-style:solid;border-bottom-color:rgb(168,184,217);border-left-style:solid;border-left-color:rgb(168,184,217);border-right-style:solid;border-right-color:rgb(168,184,217);padding:6px 10px 2px;border-bottom-left-radius:4px;border-bottom-right-radius:4px;background-image:url(&quot;http://nav_g.png&quot;);background-repeat:repeat-x"><p style="font-stretch:normal">Increment the read pointer by a normalized <em>phase</em> value.</p><p style="font-stretch:normal">This function increments the read pointer by a normalized phase value, such that <em>phase</em> = 1.0 corresponds to a 360 degree phase shift. Positive or negative values are possible.</p></div></div><a style="color:rgb(61,87,140);font-family:roboto,sans-serif;font-size:14px;line-height:19px"></a><span style="color:rgb(0,0,0);font-family:roboto,sans-serif;font-size:14px;line-height:19px"></span><div style="font-stretch:normal;font-size:14px;line-height:19px;font-family:roboto,sans-serif;padding:0px;margin-bottom:10px;margin-right:5px;width:1883px;color:rgb(0,0,0);display:table"><div style="font-weight:bold;font-stretch:normal;border-top:1px solid rgb(168,184,217);border-left:1px solid rgb(168,184,217);border-right:1px solid rgb(168,184,217);padding:6px 0px;color:rgb(37,53,85);border-top-right-radius:4px;border-top-left-radius:4px;background-image:url(&quot;http://nav_f.png&quot;);background-color:rgb(226,232,242);background-repeat:repeat-x"><table style="font-stretch:normal;margin-left:6px"><tbody><tr><td style="margin-left:6px;vertical-align:bottom">void stk::SineWave::addPhaseOffset</td><td style="vertical-align:bottom">(</td><td style="white-space:nowrap;vertical-align:bottom">StkFloat </td><td style="color:rgb(96,32,32);white-space:nowrap;vertical-align:bottom">phaseOffset</td><td style="vertical-align:bottom">)</td><td style="vertical-align:bottom"></td></tr></tbody></table></div><div style="font-stretch:normal;border-width:0px 1px 1px;border-bottom-style:solid;border-bottom-color:rgb(168,184,217);border-left-style:solid;border-left-color:rgb(168,184,217);border-right-style:solid;border-right-color:rgb(168,184,217);padding:6px 10px 2px;border-bottom-left-radius:4px;border-bottom-right-radius:4px;background-image:url(&quot;http://nav_g.png&quot;);background-repeat:repeat-x"><p style="font-stretch:normal">Add a normalized phase offset to the read pointer.</p><p style="font-stretch:normal">A <em>phaseOffset</em> = 1.0 corresponds to a 360 degree phase offset. Positive or negative values are possible.</p></div></div></div></div></div>