Re: [hatari-devel] Sample frame buffer is incorrectly restarted

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

On 1.2.2024 22.06, Miro Kropáček wrote:
I have a pretty simple test prg: https://pastebin.com/YgVzqwfc (attached).
It takes "en.raw" as input by default or any other file if specified as
argv[1]. It's a raw sample (preferably quite long) 24585 Hz / 16-bit /
stereo.

I saved MP3 as 24585 Hz (signed 16-bit PCM) "en.wav" WAV file from Audacity.

Then converted WAV to RAW:
$ sox en.wav --type raw --encoding signed-integer --endian big --rate 24585 --bits 16 --channels 2 en.raw

This sounds OK on PC:
$ play --type raw --encoding signed-integer --endian big --rate 24585 --bits 16 --channels 2 en.raw


It may look strange at the first sight but it's supposed to emulate one
specific behaviour: direct-from-disk sample playback which occasionally (in
my case always) doesn't make it, i.e. the playback repeat doesn't play a
fresh part from the disk but the same one already present in the buffer.

The idea is to detect this behaviour and if so, disable playback so instead
of the stuttering there will be only silence. And as soon as there's an
opportunity, start the playback again.

This works on real hardware (Falcon030/060). However in Hatari, it behaves
like this:

$ hatari --machine falcon --fpu 68882 ./play.tos

    - sample is played back

Sound quality is rather scratchy, even when played back from GEMDOS HD i.e. zero disk overhead. Using 32Mhz CPU instead of default 16Mhz did not really help.


    - there's a pause for 500 VBLs

I hear only occasional 2s playback (silence) pauses.  2s = ~100 VBLs.


    - after the pause a new buffer is loaded, playback continues
    - but the buffer is played twice (???)

Repeat is for ~500 VBLs though. And unlike pauses, those happen constantly.


It's best audible with some real song as the sample so one can hear
repeated sentences. If you are struggling with generating such a sample,
just let me know, I'll upload it somewhere.

Also, if I'm doing something stupid and it works only by chance on Falcon,
I'm also all ears.

Is it possible that Hatari with just EmuTOS is lacking lacking things that e.g. initialize Falcon sound matrix, that could happen on real machine with lots of SW running at startup (e.g. audio ACC / CPX).


	- Eero



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/