[chuck-users] putting samples in array

Adam Tindale adamtindale at hotmail.com
Sun Jun 25 20:47:08 EDT 2006


Hi Atte,

You could use one sndbuf! Instead of starting the sndbuf at 0  
(measured in samples) for each chunk you could just start the sample  
at different points. If you know that your sample is exactly 16 beats  
then you can divide the sample by sixteen and you can do everything  
from there.

mysample.samples() / 16 => int 16th;

// play the 5th sixteenth note
// 0-15 instead of 1-16
4*16th => mysample.pos;
16th::samps => now;

To play the whole file you would do the classic:

0=> mysample.pos;
mysample.samples()::samps => now;

Please forgive me if I have made a syntax error. I am on  a machine  
without ChucK.

I hope this helps! Any other ideas?

--art


On 25-Jun-06, at 3:58 PM, Atte André Jensen wrote:

> Hi
>
> I've got a breakbeat that I chopped up at every 16note. Now I'd  
> like to
> play these samples one after another. Could set up 16 sndbuf's each
> connected to the dac, but wouldn't that be inefficient?
>
> I'm thinking it might be smarter to load the samples into an array and
> play a different one on each pass, but is this possible.
>
> Or whould there be a really bright way to go about this?
>
> -- 
> peace, love & harmony
> Atte
>
> http://www.atte.dk      | quartet:      http://www.anagrammer.dk
> http://www.atte.dk/gps  | compositions: http://www.atte.dk/ 
> compositions
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users




More information about the chuck-users mailing list