Author |
Message |
Inventor
Stream Operator

Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Mon Feb 13, 2012 9:17 am Post subject:
Getting started with LiSa and multiple samples |
 |
|
Hi, I am working on a motion controlled sample playback program set and I want to load in many samples and play them each back with multiple voices. Do I need a separate Lisa entity for each sample? I'm having trouble getting started here...
Les _________________ "Let's make noise for peace." - Kijjaz |
|
Back to top
|
|
 |
Antimon
Joined: Jan 18, 2005 Posts: 4145 Location: Sweden
Audio files: 371
G2 patch files: 100
|
Posted: Mon Feb 13, 2012 2:50 pm Post subject:
|
 |
|
You could put seveal samples in sequence in Lisa's buffer if you want, and set the start point to whatever sample you want to play. I personally think it's easier to just as many Lisas as I want. The tricky bit is getting the samples into Lisa, the are examples to follow for that. _________________ Antimon's Window
@soundcloud @Flattr home - you can't explain music |
|
Back to top
|
|
 |
Inventor
Stream Operator

Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Mon Feb 13, 2012 3:22 pm Post subject:
|
 |
|
gotcha, thanks Stefan. Will do like that.
Les _________________ "Let's make noise for peace." - Kijjaz |
|
Back to top
|
|
 |
Inventor
Stream Operator

Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
|
Back to top
|
|
 |
Antimon
Joined: Jan 18, 2005 Posts: 4145 Location: Sweden
Audio files: 371
G2 patch files: 100
|
Posted: Tue Feb 14, 2012 4:08 am Post subject:
|
 |
|
I think the program looks ok. Your Mac should be able to run it fine.
Are you getting a crash, or just some kind of lockup?
Have you tried logging, just to make sure where it crashes? The obvious suspect is the for loop that copies data into Lisa I guess - it will take a while to copy 8*4*44100 samples, and ChucK's clock might run out of sync too much.
I know that this is the way it's done in the tutorials, but maybe having a big locking loop like this makes ChucK feel bad. One trick might be to add a
1::samp => now;
every 10000 iterations or so, to allow the clock to run.
Another solution could be to do it the simplistic way, by chuck each SndBuf to its Lisa instance, and record the sound using Lisa's record function at the start of the program. This means that you need a 4 second program "boot" time (or whatever your longest sample is). _________________ Antimon's Window
@soundcloud @Flattr home - you can't explain music |
|
Back to top
|
|
 |
Inventor
Stream Operator

Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Tue Feb 14, 2012 7:32 am Post subject:
|
 |
|
it does crash occasionally but the main issue is that if too many samples are playing, it will cut off audio and stop the radio broadcast too. Just too much cpu is all because i tried it with 1 second samples and no problem.
so i figure the solution is shorter samples which can be done with the drums, and longer gesture recognition for things like the 30 second thunder samples. that should do it. ty for looking at the code.
Les _________________ "Let's make noise for peace." - Kijjaz |
|
Back to top
|
|
 |
GrandJu
Joined: Jul 04, 2010 Posts: 32 Location: Rennes France
|
Posted: Tue Feb 14, 2012 9:30 am Post subject:
|
 |
|
Hi Les,
I don't understand why you are using Lisa. But Maybe I don't get the real purpose of your script
Just using SndBuf (without Lisa) may save some memory and CPU.
Something like (not tested):
Code: |
.
.
.
for (0=>int i; i<numBins; i++)
{
buf[i]=> dac;
// Put each buf at end to avoid starting
buf[i].samples()=> buf[i].pos;
}
.
.
.
function void playSound(int sel)
{
// get next voice
0 => buf[sel].pos;
2. => buf[sel].rate;
//hang on until it's done...
buf[sel].length => now;
}
.
.
.
|
Ju |
|
Back to top
|
|
 |
Inventor
Stream Operator

Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Tue Feb 14, 2012 11:24 am Post subject:
|
 |
|
Ju,
I am using LiSa because it allows me to have multiple voices per sample so that if someone strikes the same sample twice quickly, both samples will play. That is why.
Les _________________ "Let's make noise for peace." - Kijjaz |
|
Back to top
|
|
 |
GrandJu
Joined: Jul 04, 2010 Posts: 32 Location: Rennes France
|
Posted: Wed Feb 15, 2012 1:36 am Post subject:
|
 |
|
Ok, I understand now
It's true that with my proposal, you might have some kind of freeze effect if samples are trigged several times quickly.
I have to experiment Lisa on my side to know it.
Have Fun!
Ju |
|
Back to top
|
|
 |
Inventor
Stream Operator

Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Wed Feb 15, 2012 11:44 am Post subject:
|
 |
|
Ju, thank you for your input and your interest. How long have you been a ChucKist?
Les _________________ "Let's make noise for peace." - Kijjaz |
|
Back to top
|
|
 |
GrandJu
Joined: Jul 04, 2010 Posts: 32 Location: Rennes France
|
Posted: Thu Feb 16, 2012 2:06 am Post subject:
|
 |
|
I play with ChucK since january 2010. And I learn electronic music this way!
It's fantastic
Cheers,
Ju |
|
Back to top
|
|
 |
Inventor
Stream Operator

Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Thu Feb 16, 2012 3:59 am Post subject:
|
 |
|
Yes I agree, I did the exact same thing, starting in October of 2007. But it does not matter how long you have been a ChucKist, as long as you wield the mighty power of ChucK! Haha!
Les _________________ "Let's make noise for peace." - Kijjaz |
|
Back to top
|
|
 |
|