[chuck-users] SndBuf: setting loop
dan trueman
dtrueman at Princeton.EDU
Sat Oct 13 01:45:05 EDT 2007
look for this in the next release:
>>>>>
//ugens
SndBuf buf;
LiSa lisa => dac;
//change this path to your own sample
"/Users/dan/Files/Chuck/LiSa_examples/TomVega.wav" => buf.read;
//set lisa buffer size to sample size
buf.samples() * 1::samp => lisa.duration;
//transfer values from SndBuf to LiSa
for ( 0 => int i; i < buf.samples(); i++ ) {
//args are sample value and sample position (dur)
lisa.valueAt(buf.valueAt(i), i * 1::samp);
}
//party on...
1 => lisa.play;
2. => lisa.rate;
//hang on until it's done...
lisa.duration() * 0.5 => now;
<<<<<
dt
On Oct 11, 2007, at 12:27 PM, Kassen wrote:
>
>
> On 10/11/07, Daniel Trueman <dtrueman at princeton.edu> wrote:
> i believe that SndBuf has a valueAt() method, which you can get
> values with, so all LiSa would need is a similar valueAt() call to
> set values with and we could automatically load sounds into LiSa
> without passing time. i'll take a look at this soon; should be easy
> (whereas loading soundfiles directly into LiSa won't be so easy).
>
>
> That would be nice! Especially with a get method for the same. That
> would be equivalent to my idea of overloading SndBuf.read() to
> accept arrays of floats to be assigned to it instead of pre-
> recorded samples.
>
>
> Great idea.
> Kas.
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20071013/dd085682/attachment.htm
More information about the chuck-users
mailing list