[chuck-users] Looping Sample Playback

Mike McGonagle mjmogo at gmail.com
Tue Feb 28 13:30:57 EST 2006


Thanks, Adam, this is a good start. I do have all the looping points,
and was wondering how this would look. I  was "afraid" that I would
have to call this every sample, but from the looks of it, that may not
be the case. Just have to account for any changes in frequency, as I
am sure that the time for each sample is based on using the sample
data at pitch for the file.

Mike


On 2/27/06, Adam Tindale <adamtindale at hotmail.com> wrote:
> Hi,
>
> This is part of the wonder of ChucK, you can define this yourself.
> Most often .pos is given the 0 argument to start from the beginning
> of the file. You can give it any int that will refer to an index in
> your sample.
>
> If you know the startpoint and endpoint of the looping for each file
> then you can put in a function like this and then call it for every
> instance of the sample. Then you can expand this to respond to
> noteons and noteoffs and all those other musical things.
>
> I hope this answers your question.
>
> --art
>
> fun void playsample(int startpoint, int endpoint, string filename){
>         sndbuf s => dac;
>
>         filename => s.read;
>
>         0 => s.pos;
>
>         endpoint::samp => now;
>
>         while(true){
>                 startpoint => s.pos;
>                 (endpoint - startpoint)::samp => now;
>         }
> }
>
>
>
> On 27-Feb-06, at 1:17 PM, Mike McGonagle wrote:
>
> > Hello all,
> >
> > I was wondering if there is a ugen that will handle arbitrary looping
> > points? I have some samples for various instruments (ie piano,
> > mellotron strings, etc), and would like to hook them up in ChucK.
> > Basically, if the sndbuf ugen is the starting point for this, then do
> > I need to write my own "looping" function to ensure that it gets back
> > to the proper points within the sample.
> >
> > Or has someone already implemented this functionality and would be
> > interested in "sharing"?
> >
> >
> > Thanks,
> >
> > Mike
> > _______________________________________________
> > chuck-users mailing list
> > chuck-users at lists.cs.princeton.edu
> > https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>


--
Help the Environment, Plant a Bush back in Texas!


More information about the chuck-users mailing list