electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » ChucK programming language
Getting started with LiSa and multiple samples
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [12 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 5978
Location: San Antonio, Tx, USA
Audio files: 258

PostPosted: Mon Feb 13, 2012 9:17 am    Post subject: Getting started with LiSa and multiple samples Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Send e-mail
Antimon



Joined: Jan 18, 2005
Posts: 3711
Location: Sweden
Audio files: 271
G2 patch files: 96

PostPosted: Mon Feb 13, 2012 2:50 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 5978
Location: San Antonio, Tx, USA
Audio files: 258

PostPosted: Mon Feb 13, 2012 3:22 pm    Post subject: Reply with quote  Mark this post and the followings unread

gotcha, thanks Stefan. Will do like that.

Les

_________________
"Let's make noise for peace." - Kijjaz
Back to top
View user's profile Send private message Send e-mail
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 5978
Location: San Antonio, Tx, USA
Audio files: 258

PostPosted: Tue Feb 14, 2012 12:25 am    Post subject: Reply with quote  Mark this post and the followings unread

OK, here is what I have so far. Don't download it because you can't run it without the samples and a Gyration Air Mouse - but you can look at the code. This program has only eight samples of four seconds each, yet it totally thrashes the cpu on my mac mini. Granted, the computer is three years old and ready for replacement, however it should be able to handle this. Does anyone have any idea what I am doing wrong here?

Thanks,

Les


OSC Receiver Drums 1.ck
 Description:
Osc receiver for drum samples

Download
 Filename:  OSC Receiver Drums 1.ck
 Filesize:  2.9 KB
 Downloaded:  139 Time(s)


_________________
"Let's make noise for peace." - Kijjaz
Back to top
View user's profile Send private message Send e-mail
Antimon



Joined: Jan 18, 2005
Posts: 3711
Location: Sweden
Audio files: 271
G2 patch files: 96

PostPosted: Tue Feb 14, 2012 4:08 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 5978
Location: San Antonio, Tx, USA
Audio files: 258

PostPosted: Tue Feb 14, 2012 7:32 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Send e-mail
GrandJu



Joined: Jul 04, 2010
Posts: 32
Location: Rennes France

PostPosted: Tue Feb 14, 2012 9:30 am    Post subject: Reply with quote  Mark this post and the followings unread

Hi Les,

I don't understand why you are using Lisa. But Maybe I don't get the real purpose of your script Laughing

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
View user's profile Send private message
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 5978
Location: San Antonio, Tx, USA
Audio files: 258

PostPosted: Tue Feb 14, 2012 11:24 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Send e-mail
GrandJu



Joined: Jul 04, 2010
Posts: 32
Location: Rennes France

PostPosted: Wed Feb 15, 2012 1:36 am    Post subject: Reply with quote  Mark this post and the followings unread

Ok, I understand now Very Happy

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
View user's profile Send private message
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 5978
Location: San Antonio, Tx, USA
Audio files: 258

PostPosted: Wed Feb 15, 2012 11:44 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Send e-mail
GrandJu



Joined: Jul 04, 2010
Posts: 32
Location: Rennes France

PostPosted: Thu Feb 16, 2012 2:06 am    Post subject: Reply with quote  Mark this post and the followings unread

I play with ChucK since january 2010. And I learn electronic music this way!
It's fantastic Very Happy

Cheers,
Ju
Back to top
View user's profile Send private message
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 5978
Location: San Antonio, Tx, USA
Audio files: 258

PostPosted: Thu Feb 16, 2012 3:59 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [12 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
e-m mkii

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use