<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 <chuck-users-bounces@lists.cs.princeton.edu> namens Perry Cook <prc@cs.princeton.edu><br>
<b>Verzonden:</b> donderdag 27 februari 2020 19:51<br>
<b>Aan:</b> chuck-users@lists.cs.princeton.edu <chuck-users@lists.cs.princeton.edu><br>
<b>Onderwerp:</b> Re: [chuck-users] SndBuf use of .loop and .interp (herman asked)</font>
<div> </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. 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 => dac;<br>
"special:dope" => s.read; // load homer<br>
s.length() => now; // play him<br>
second => now; // wait a bit<br>
1 => s.loop; // loop homer now<br>
2*second => now; // for 2 seconds<br>
-1 => s.rate; // then play him backward <br>
2*second => now; // for two more<br>
<br>
If you need to loop a specific piece of a sound in SndBuf, <br>
you should either: 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. Then use .pos<br>
and => now to loop it. 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. 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>
> From: herman verbaeten <hverb54@hotmail.com><br>
> <br>
> Hi,<br>
> <br>
> 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>
> Maybe .loop and .interp of SndBuf is a solution here. Anyone who knows how to use them?<br>
> Kind regards,<br>
> Herman<br>
> <br>
> me.sourceDir() + "aeiou.wav" => string filename;<br>
> if( me.args() ) me.arg(0) => filename;<br>
> SndBuf buf => dac;<br>
> filename => buf.read;<br>
> <br>
> fun void looper()<br>
> {<br>
> while(true)<br>
> {<br>
> 1500::samp => now;<br>
> 50000 => buf.pos;<br>
> }}<br>
> spork ~ looper();<br>
> <br>
> 2000::ms => now;<br>
> -------------- 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>