fluid-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[fluid-dev] Re: Changes checked into CVS


From: Mihail Zenkov
Subject: [fluid-dev] Re: Changes checked into CVS
Date: Wed, 22 Nov 2006 02:57:01 +0200

On Tue, 21 Nov 2006 21:36:16 +0000
Josh Green <address@hidden> wrote:

> I just checked in some changes into CVS.
> 
> Including:
> - Dithering now performed for 16 bit output (thanks to Zenkov Mihail)
> - Bug fix to 100% CPU consumption problem with "default" ALSA device
> - Some minor bug fixes to ALSA sequencer code
> - Other minor stuff not worth mentioning
> 
> 
> Some info/questions for Zenkov Mihail concerning the dithering:
> 
> I modified your patch a bit for several reasons and I wanted to check
> with you to make sure I didn't break something in the process.
> 
> A variable "dither_index" was added to the fluid_synth_t structure, so
> that the dithering buffer index is per synth instead of a static var in
> a function (would be a problem if multiple synths were running).
> 
> - I re-enabled the call to dev->callback in fluid_alsa_audio_run_s16
> since this is part of the API (don't want to break it if someone is
> using it)

But it have big overhead: many buffers, many purposeless copy of memory.

> - A new function fluid_synth_dither_s16() is now used to do the float to
> 16 bit conversion (with dithering) in fluid_alsa_audio_run_s16, this
> function is not part of the public API
> 
> - The test for the dither index wrap around was (if nr > DITHER_SIZE),
> which I think should be (if nr >= DITHER_SIZE)
> 

Yes, you right.

> - I removed the roundf calls since they seem to require a special
> -std=c99 compiler switch, which makes me doubt it works in Windows.

Without roundf() 0.5f (or 0.9f) = 0.
We can do dithering without roundf():
- d = rand() / (float)RAND_MAX - 0.5f;
+d = rand() / (float)RAND_MAX * 2.0f - 1.0f;
but it have worse THD.
> Instead the float sample is just multiplied by 32767.0 and
> rand_table[0][di] is added and then the value gets clipped to the range
> -32768 - 32767 and finally the value is integer truncated when it gets
> assigned to the 16 bit value.  Hopefully that is OK?

Better multiple by 32767 - max_dither_amp
with roudf() max_dither_amp = 1
without roudf() max_dither_amp = 2

> I must admit, I had trouble hearing the difference between the new
> changes and the old.  There does seem to be something different, but I
> can't quite point it out.  Perhaps I don't have very good musically
> trained ears ;)  Then again, perhaps I broke something when making
> changes to your patch, although I did also test your patch directly.

It not very complicate. Just set gain very low (0.0001) and set maximum
loudness in amp and mixer ;)

> I did discover another bug in the process.  There seems to be a rather
> explosive audio problem with some instruments played at very high notes.
> I suspect a filter issue (there were several similar issues in the
> past).  Not sure at this point how to fix it though.

I try reproduce this tomorrow. Can you describe way to reproduce this
(sound font - better link to download, instrument, other settings)?

> Thanks again for the contribution.  Cheers!
>       Josh Green
> 
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]