[hatari-devel] LMC1992 and Microwire emulation

Laurent Sallafranque laurent.sallafranque at free.fr
Wed Mar 10 00:36:57 CET 2010


Hi David,

 > - The LMC1992 is present on the STE and TT.
 > - The LMC1992 is not present on the Falcon.

That's already mapped into hatari. (via the iomem...c code)

 > - The LMC1992 controls the overall volume, bass
 >  and treble as the last stage before the sound
 > ...

I've implemented a very preview of volume emulation.
Everything should be rewritten as you describe, but I'm really not a 
specialist of filters, mathematics formulas, ...

Perhaps you could write something that would emulate this, and if it 
takes too much CPU, we could add this as an option in the parameters.

Best regards

Laurent



David Savinkoff a écrit :
> Hi Laurent,
>
> I did some digging and discovered the following:
> - The LMC1992 is present on the STE and TT.
> - The LMC1992 is not present on the Falcon.
> - The LMC1992 controls the overall volume, bass
>   and treble as the last stage before the sound
>   is output, thus, if Hatari can communicate
>   volume and tone settings to the computer or an
>   External Application, extra processing can be
>   avoided.
> - The LMC1992 uses first order analog filters
>   where the first order bass filter can be combined
>   with the first order treble filter to make a
>   single second order IIR shelving filter, thus
>   saving a multiply. It should be possible to make
>   an exact stereo emulation of the filter with
>   5 floating point multiplies per channel per sample
>   (441000 multiplies per second at 44100Hz).
>   A small look up table will hold pre-calculated
>   filter coefficients. An extra multiply is needed
>   to control the final volume.
> - A moving average filter uses integer math with
>   no multiplies, will sound different and will have
>   at best +6/-12 dB boost/cut (LMC1992 has +/- 12dB).
>   However 3 multiplies are needed to control bass,
>   treble and volume.
>
> I'm thinking that an external application that uses
> an IIR filter is the way to go.
>
>
> Mar 8, 2010 11:48:27 PM, laurent.sallafranque at free.fr 
> <mailto:laurent.sallafranque at free.fr> wrote:
>
>     Hello David,
>
>     First, thanks for the help.
>
>     Filters and sound theory are not really what I understand the best.
>     I'm a bit lost with this.
>
>     Would you enjoy to help us and give it a try by yourself ?
>     You could add the Falcon and Ste filters for volume and
>     Bass/Treble (Ste).
>     All the componet emulation is coded, there's just the filters to add.
>
>     This would help and would be done much better than if I do it myself.
>
>     At least, if you can't, would you describe me the algorithm to
>     implement ?
>     (I would translate it to C language).
>
>     Best regards,
>
>     Laurent
>
>
>
>     David Savinkoff a écrit :
>     > Hi laurent,
>     >
>     > I'm reasonably sure that the Falcon codec would use a second order,
>     > infinite impulse response ( IIR ) shelving filter because that
>     is what is
>     > used on other codecs with tone controls. What I wrote earlier
>     implied
>     > that the moving average filter is what the codec uses. The moving
>     > average filter is a simplified finite impulse response ( FIR )
>     filter.
>     >
>     > Volume is usually done after filtering so that you can cut and boost
>     > the bass and treble and mix in unfiltered sound.
>     >
>     > By the way, as a first approximation for the number of samples to
>     > use in the filter try:
>     > Sampling frequency / Cutoff frequency = Averaging length
>     > eg.
>     > 44100Hz / 630Hz = 71 averaged samples (or 65 for 2^n)
>     > It is Imperative that an Odd number of samples be used.
>     >
>     >
>     > Mar 8, 2010 02:33:59 PM, laurent.sallafranque at free.fr
>     <mailto:laurent.sallafranque at free.fr>
>     > laurent.sallafranque at free.fr
>     <mailto:laurent.sallafranque at free.fr>> wrote:
>     >
>     > Another question :
>     >
>     > Is there an order for effects computing ?
>     >
>     > Should I compute volume before and IIR after, or IIr before and
>     sound
>     > after ?
>     >
>     > Regards
>     >
>     > Laurent
>     >
>     >
>     >
>     > David Savinkoff a écrit :
>     > > Hi,
>     > >
>     > > A FFT is not the solution, an IIR filter is required. See:
>     > > http://www.dspguide.com/
>     > > for a freely downloadable book.
>     > > My recommendation is to use a running average filter.
>     > > This is similar to a FIFO, but where you add samples into
>     > > a variable and subtract an old sample out every time you
>     > > add a new one in. How many samples are averaged depends
>     > > on the cut off frequency desired (this is a low pass filter) and
>     > > the sampling frequency. To make a treble filter, subtract an
>     > > averaged value from an input value. Note that the delay of
>     > > the filter is considered to be half of the averaging length.
>     > >
>     > >
>     > > Mar 7, 2010 09:18:03 AM, laurent.sallafranque at free.fr
>     <mailto:laurent.sallafranque at free.fr>
>     > laurent.sallafranque at free.fr <mailto:laurent.sallafranque at free.fr>>
>     > > laurent.sallafranque at free.fr <mailto:laurent.sallafranque at free.fr>
>     > laurent.sallafranque at free.fr
>     <mailto:laurent.sallafranque at free.fr>>> wrote:
>     > >
>     > > Hello,
>     > >
>     > > I've added LMC1992 and Microwire emulation to hatari.
>     > >
>     > > For now, Master volume, left volume and right volume are emulated.
>     > > Still to do : Bass and Treble.
>     > > Does it need a FFT and FFT -1 transformation or are there
>     specifics
>     > > algorythms for bass and treble ?
>     > >
>     > > I've done my tests with protracker Ste.
>     > >
>     > > I think there's a problem anyway for both falcon volume table
>     > and ste
>     > > volume table :
>     > >
>     > > I've used a linear volume table to calculate values from the min
>     > > to the max.
>     > > I think values should be calculated with a logarythmic algo.
>     > > (There's only values in the volume_table to change, nothing else)
>     > >
>     > > Do you agree ?
>     > >
>     > > Could somebody compare volume in protracker in hatari and on a
>     > > real ste ?
>     > >
>     > > Regards
>     > >
>     > > Laurent
>     > >
>     > > _______________________________________________
>     > > hatari-devel mailing list
>     > > hatari-devel at lists.berlios.de
>     <mailto:hatari-devel at lists.berlios.de>
>     > hatari-devel at lists.berlios.de
>     <mailto:hatari-devel at lists.berlios.de>>
>     > hatari-devel at lists.berlios.de
>     <mailto:hatari-devel at lists.berlios.de>
>     hatari-devel at lists.berlios.de <mailto:hatari-devel at lists.berlios.de>>>
>     > > https://lists.berlios.de/mailman/listinfo/hatari-devel
>     > >
>     >
>




More information about the hatari-devel mailing list