[chuck-users] SndBuf use of .loop and .interp (herman asked)

herman verbaeten hverb54 at hotmail.com
Thu Feb 27 15:06:41 EST 2020

Ok. Suppose i set the rate to .1 and i want it to sound smooth. How and where do i set the interp then?

Van: chuck-users-bounces at lists.cs.princeton.edu <chuck-users-bounces at lists.cs.princeton.edu> namens Perry Cook <prc at cs.princeton.edu>
Verzonden: donderdag 27 februari 2020 19:51
Aan: chuck-users at lists.cs.princeton.edu <chuck-users at lists.cs.princeton.edu>
Onderwerp: Re: [chuck-users] SndBuf use of .loop and .interp (herman asked)

.interp doesn’t do what you think it does.  It just specifies the
type of internal interpolation for smoothing of playback (only
applicable for non 1.0 rates).

SndBuf .loop just tells it to start over at the beginning
when it reaches the end (or end after reaching the beginning):

SndBuf s => dac;
"special:dope" => s.read; // load homer
s.length() => now;  // play him
second => now;     // wait a bit
1 => s.loop;            // loop homer now
2*second => now; // for 2 seconds
-1 => s.rate;          // then play him backward
2*second => now; // for two more

If you need to loop a specific piece of a sound in SndBuf,
you should either:  edit that in a sound editor and save/ it as a new file.
Figure out the exact sample points within the wave that
should be your start and end loop points.  Then use .pos
and => now to loop it.  You don’t even need .loop mode
for that, because it will keep playing as long as the start
is within the buffer boundaries.

If you want smooth looping without pops at the edges,
you could maybe use an ADSR to smooth the beginning
and end.  Not sure of your application here, but SndBuf
is not a flexible sample playback UGen that knows about
loops like a SoundFont player would.


> From: herman verbaeten <hverb54 at hotmail.com>
> Hi,
> 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..
> Maybe .loop and .interp of SndBuf is a solution here. Anyone who knows how to use them?
> Kind regards,
> Herman
> me.sourceDir() + "aeiou.wav" => string filename;
> if( me.args() ) me.arg(0) => filename;
> SndBuf buf => dac;
> filename => buf.read;
> fun void looper()
> {
> while(true)
> {
> 1500::samp => now;
> 50000 => buf.pos;
> }}
> spork ~ looper();
> 2000::ms => now;
> -------------- next part --------------

chuck-users mailing list
chuck-users at lists.cs.princeton.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20200227/28fe3deb/attachment.html>

More information about the chuck-users mailing list