|
From: Marek P. <ma...@na...> - 2004-02-08 22:38:42
|
Hi Vladimir & all, just wanted to ask, is there any reason why linuxsampler can't have just one voice per note? For example suppose i've got a huge lib loaded with long samples that need to be streamed from disk, currently AFAIK if i press a note and then press the same note again, i end up with 2 streams. But if you imagine an instrument such as a piano, a hammer which hits a string at a given time is going to completely dampen the previous string resonance at that time while causing a new resonance. That seems like dismissing the old stream completely at the time i hit a note and starting a new one hence you end up with a nice 1 voice per note optimisation. Perhaps i'm wrong, just my imagination... Marek On Sun, 2004-02-08 at 19:50, Vladimir Senkov wrote: > Hi Everybody, > > I've been thinking about note stealing or as i'd like to call it "voice > stealing". > So far the following comes to mind: > 1) When number of voices reaches max there will not be any time to > release them, so we have to start releasing them earlier. I'm > introducing AUDIO_VOICES_THRESHOLD. It should be set to be a certain > percentage of MAX_AUDIO_VOICES depending on how long the release phase > is. If it's set to the same value as MAX_AUDIO_VOICES or higher, then > voice stealing will be disabled. > 2) When number of voices reaches the threshold and a new key is pressed, > ls will try the following: > a) locate voices on that same key and release all but the last one of them > b) if that didn't yeld any results, go thru all keys and try same > c) if that didn't work either, try same as above but be more aggressive > i.e. free the last voice as well. > > What do you guys think? Any better ideas? > I've been playing around with it and it seems to work OK. With max > voices set to 64 i've set the threshold to 48 and it seems to take care > of most situations. Depending on how long the release phase is, it may > need to be set to something lower (or max voices will have to be > increased). At some point we could add a clever algorithm to calculate > the threshold automatically based on how long the release phase is > (average release time for all samples?) > > I'm including a patch against latest CVS. This patch also includes some > command line and EG changes. Christian will likely review those (but not > the voice stealing part) next weekend and it might make it in some shape > of form into the CVS, so please give it some testing also, if you have > time. If you have trouble with voice stealing and just want to play > around with the EG you can turn off voice stealing by setting > AUDIO_VOICES_THRESHOLD to be same as MAX_AUDIO_VOICES in audiothread.h. > > Regards, > Vladimir. > |