[hatari-devel] STE sound breakage with lower sound frequencies

Nicolas Pomarède npomarede at corp.free.fr
Sun Feb 13 20:10:06 CET 2011


Le 08/02/2011 20:07, Eero Tamminen a écrit :
> Hi,
>
> On tiistai 08 helmikuu 2011, Nicolas Pomarède wrote:
>> Le 07/02/2011 23:15, Eero Tamminen a écrit :
>>> I tried Utopos demo.
>>>
>>> If I use "--sound 11025" or "--sound 16000", there's just a short
>>> "dup"[1] sound and then no sound at all.  With e.g. 22kHz or 48kHz,
>>> sound works fine for STE emulation too.
>>>
>>> The issue happens also for Hatari from end of december and for Hatari
>>> v1.4. Keyclick on STE TOS works for Hatari v1.4 even at 11025Hz
>>> though.
>>
>> Yes, I can reproduce similar issues ; not related to my latest changes,
>> certainly there since a long time and specific to dma sound.
>>
>> It seems that if Hatari starts with a too low freq then there's no sound
>> (changing sound freq with F12 don't correct it). But if I start Hatari
>> in default mode (44.1 kHz) in my case and change freq with F12 to 11025,
>> I still get sound.
>> Do you have the same behaviour ?
>
> Yes.  If I change the freq from options, there's no problem.
>
>
>> So, it's not the freq change, but probably some inits based on the
>> starting sound freq that are not correct.
>>
>> I'll try to give it a look later.

Hello,

I found the cause of the problem, it's the bass/treble filter.

In previous version of Hatari (1.4) it was only applied when DMA sound 
was on, but in rev 3159 laurent applied the patch submitted by david to 
also apply the filter when DMA sound is off too and only ym2149 is used 
(-> key sound under gem)

This is the correct behaviour to apply the filter in all case, the 
problem is that according to the comment by David "The tone control's 
sampling frequency must be at least 22050 Hz to sound good".
It seems that at 16 kHz or less, it just sound empty in fact :)

You can test this is the cause :
1) in dmaSnd.c comment lines 355/356 to get key sound under gem again 
when running "./hatari --machine ste --sound 16000"

2) in dmaSnd.c comment lines 491/492 to get dma sound under utopos for 
example when running "./hatari --machine ste --sound 16000"


David, is there a way to have the filter behave better when sound freq 
is less that 22050 Hz without changing too much code ?

We could build other filter tables in DmaSnd_Init_Bass_and_Treble_Tables 
for lower ouput freq, but I'm not sure this is necessary.

Sound under 44 kHz is anyway rather ugly most of the time, so if no one 
objects, I think I will add a change to apply IIR filters only for 
"quality" output freq >= 44 kHz. Applying filters to lower output freq 
will just alter a sound that is already of poor quality (especially in 
ym mode only).


Nicolas





More information about the hatari-devel mailing list