<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Ok. Suppose i set the rate to .1 and i want it to sound smooth. How and where do i set the interp then?</div>
<div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Van:</b> chuck-users-bounces@lists.cs.princeton.edu &lt;chuck-users-bounces@lists.cs.princeton.edu&gt; namens Perry Cook &lt;prc@cs.princeton.edu&gt;<br>
<b>Verzonden:</b> donderdag 27 februari 2020 19:51<br>
<b>Aan:</b> chuck-users@lists.cs.princeton.edu &lt;chuck-users@lists.cs.princeton.edu&gt;<br>
<b>Onderwerp:</b> Re: [chuck-users] SndBuf use of .loop and .interp (herman asked)</font>
<div>&nbsp;</div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">.interp doesn’t do what you think it does.&nbsp; It just specifies the<br>
type of internal interpolation for smoothing of playback (only <br>
applicable for non 1.0 rates).<br>
<br>
SndBuf .loop just tells it to start over at the beginning<br>
when it reaches the end (or end after reaching the beginning):<br>
<br>
SndBuf s =&gt; dac;<br>
&quot;special:dope&quot; =&gt; s.read; // load homer<br>
s.length() =&gt; now;&nbsp; // play him<br>
second =&gt; now;&nbsp;&nbsp;&nbsp;&nbsp; // wait a bit<br>
1 =&gt; s.loop;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // loop homer now<br>
2*second =&gt; now; // for 2 seconds<br>
-1 =&gt; s.rate;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // then play him backward <br>
2*second =&gt; now; // for two more<br>
<br>
If you need to loop a specific piece of a sound in SndBuf, <br>
you should either:&nbsp; edit that in a sound editor and save/ it as a new file.<br>
Figure out the exact sample points within the wave that<br>
should be your start and end loop points.&nbsp; Then use .pos<br>
and =&gt; now to loop it.&nbsp; You don’t even need .loop mode <br>
for that, because it will keep playing as long as the start<br>
is within the buffer boundaries.<br>
<br>
If you want smooth looping without pops at the edges, <br>
you could maybe use an ADSR to smooth the beginning <br>
and end.&nbsp; Not sure of your application here, but SndBuf<br>
is not a flexible sample playback UGen that knows about<br>
loops like a SoundFont player would.<br>
<br>
PRC<br>
<br>
&gt; From: herman verbaeten &lt;hverb54@hotmail.com&gt;<br>
&gt; <br>
&gt; Hi,<br>
&gt; <br>
&gt; In my attempt to loop-play 1 portion of the soundbuffer for a certain periode time(2000 milliseconds in my example) i get a kind of clicking when the geginning of the sample pos is different from the ending..<br>
&gt; Maybe .loop and .interp of SndBuf is a solution here. Anyone who knows how to use them?<br>
&gt; Kind regards,<br>
&gt; Herman<br>
&gt; <br>
&gt; me.sourceDir() &#43; &quot;aeiou.wav&quot; =&gt; string filename;<br>
&gt; if( me.args() ) me.arg(0) =&gt; filename;<br>
&gt; SndBuf buf =&gt; dac;<br>
&gt; filename =&gt; buf.read;<br>
&gt; <br>
&gt; fun void looper()<br>
&gt; {<br>
&gt; while(true)<br>
&gt; {<br>
&gt; 1500::samp =&gt; now;<br>
&gt; 50000 =&gt; buf.pos;<br>
&gt; }}<br>
&gt; spork ~ looper();<br>
&gt; <br>
&gt; 2000::ms =&gt; now;<br>
&gt; -------------- next part --------------<br>
<br>
_______________________________________________<br>
chuck-users mailing list<br>
chuck-users@lists.cs.princeton.edu<br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
</div>
</span></font></div>
</div>
</body>
</html>