|
From: Vladimir S. <ha...@so...> - 2004-01-08 01:50:06
|
Hi Christian, Everybody!
I'm so glad i found linuxsampler project. My thanks to everybody for making
this great idea a reality.
I am a software engineer now (or at least i was able to trick some
co-workers into thinking that i am :) but i was raised in a family of
musicians and had to play the piano for about 8 hours a day since i was 6
till about 17 so i can still play a little . . .
And now i can play in Linux! Sampler was one of the last apps i needed
windows for. Now i'm almost 100% linux :)
Anyway, long story short the only thing that i didn't enjoy about linux
sampler was that clicking noise that results from no release sample support,
so i've decided to try to do something about it.
I'd like to help out on this project (if i can).
Unfortunately, my coding experience is all in embedded and networking and
not at all in audio so my attempt to solve the clicking problem is more of a
research or an ugly hack that probably has no long term value. That's why i
don't want to send it as a patch but just as a proof of concept, something
to discuss, etc.
Anyway, what i did was:
1) added a private float to class Voice (i called it "Releasing" for lack of
imagination)
it's not actually going to be a float.
2) set that to 0 in the constructor
3) in Voice::RenderAudio() i added this at the beginning:
if (Releasing > 0.9999) {
Releasing = 0;
PlaybackState = playback_state_end;
}
4) added a method to voice class: void Release() { Releasing = 0.000001; }
again, please disregard these weird constants for now.
5) in AudiThread::ReleaseVoice() replaced pVoice->Kill() with
pVoice->Release() just like the comment said. For now i also put return;
right after that but that needs to be implemented correctly.
6) in both stereo and mono Interpolate inline functions, i've added the
following:
effective_volume = effective_volume - (effective_volume *
(Releasing/128));
Releasing = sqrt(Releasing);
sqrt and division by 128 are just here for proof of concept code. they will
not actually be needed.
Releasing doesn't need to be float either. there can just be a precalculated
array and Releasing could be an index in such array and effective volume
could be adjusted based on the value in that array. This way there will be
no need for any conditional stuff in tight loops either.
The point of that code was again just to see if something simple like this
could actually sound OK.
And you know . . . IMHO it does. I have pretty good hearing, pretty good
headphones and i can't hear any clicking at all.
I've compared it to GS and i can't really tell the difference (at least not
with the samples i have).
I've played using a few different samples, with and without sustain, mostly
mono, mostly Soeren Bovbjerg's Steinway sample.
Christian, I think you've asked a while ago somewhere on usenet about free
piano samples. This one is free and IMHO pretty good.
If you don't have it yet, check it out:
http://www.musik.auc.dk/~bovbjerg/piano4.html
CPU utilization on my old 850Mhz Athlon did not seem to change much either
even though it was doing lots of sqrt()s :)
I'd like to know what the pros think about this simple method. So shoot, but
please don't kill.
On the other hand . . . kill, why not? :)
If this was already discussed and decided upon, please don't kick too hard .
. .
About sustain . . . you probably already know this, but anyway. I'm not sure
what the right terminology for this is, but when i quickly release and apply
sustain right back in GS what i get is the sound is still alive. Just like a
real piano. Not in LS though :( As soon as i release the sound is dead. It
may sound insignificant but when you play certain peices like one of
Rachmaninov's preludes or for instance where sustain is used a lot you don't
get the same realistic feel that you do with gs.
What do you guys think?
Regards,
Vladimir.
|