VOGONS


Sound Blaster Pro stereo bug

Topic actions

Reply 20 of 23, by mkarcher

User metadata
Rank l33t
Rank
l33t
superfury wrote on 2025-05-25, 10:48:

Doesn't that de-sync the left and right audio? Since in that case, the left and right audio outputs are always half a sample out-of-sync, time-wise (left half a sample too early or right half a sample too late)?

It does. As the only two rates that are specified for stereo output are 11kHz or 22kHz (while mono is allowed for a wide range of sample rates up to 44kHz), "half a sample" is less than 50µs. I think people didn't care about that issue. Another consequence of the SB Pro stereo approach is less than optimal stereo separation, which is more often brought up as drawback than the half-a-sample delay. If you are synthesizing sound specifically for playback on the SB Pro, you could compensate for the delay - again, I don't know whether anyone did.

Reply 21 of 23, by superfury

User metadata
Rank l33t++
Rank
l33t++
mkarcher wrote on 2025-05-25, 15:12:
superfury wrote on 2025-05-25, 10:48:

Doesn't that de-sync the left and right audio? Since in that case, the left and right audio outputs are always half a sample out-of-sync, time-wise (left half a sample too early or right half a sample too late)?

It does. As the only two rates that are specified for stereo output are 11kHz or 22kHz (while mono is allowed for a wide range of sample rates up to 44kHz), "half a sample" is less than 50µs. I think people didn't care about that issue. Another consequence of the SB Pro stereo approach is less than optimal stereo separation, which is more often brought up as drawback than the half-a-sample delay. If you are synthesizing sound specifically for playback on the SB Pro, you could compensate for the delay - again, I don't know whether anyone did.

So should I make it explicitly perform the sync (latch left until the right sample arrives, then apply both to the outputs once the right sample is obtained (it's currently emulated behaviour)) or perform the half-sample left unsynched to the right channel (both are simply handled when the DMA transfer writes the sample right now)? Though both samples are also affected by DMA transfer slowness (so if the CPU interrupts it, by not acknowledging yet (when the CPU is in cycle-accurate mode), it will affect the timing of the outputted samples to be slightly late as well).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 22 of 23, by mkarcher

User metadata
Rank l33t
Rank
l33t
superfury wrote on 2025-05-25, 15:30:

So should I make it explicitly perform the sync (latch left until the right sample arrives, then apply both to the outputs once the right sample is obtained (it's currently emulated behaviour)) or perform the half-sample left unsynched to the right channel (both are simply handled when the DMA transfer writes the sample right now)? Though both samples are also affected by DMA transfer slowness (so if the CPU interrupts it, by not acknowledging yet (when the CPU is in cycle-accurate mode), it will affect the timing of the outputted samples to be slightly late as well).

I don't have original Creative Labs SBPro hardware at hand to test it, but I am quite confident given the design information about the SB Pro stereo mode that unsynchronized playback is the correct approach.

Reply 23 of 23, by superfury

User metadata
Rank l33t++
Rank
l33t++

OK. For now adjusted the DMA transfers of the Sound Blaster Pro to behave like a direct DAC in stereo mode. So whenever the DMA transfer sends a byte, either the left or right channel outputs are updated (like the Direct DAC command does).
Mono mode is still synchronized in the old way (being buffered, like all other mono rendering modes (including the ADPCM modes)).

Although that way, the DMA transfers will impact audio sample timing, as delays by the CPU (DMA being randomly shifted due to transfers being randomly blocked by the CPU on a busy bus) will move the sample to a different position in time (mono samples will rendering timed as usual, as they're buffered, timed by the DREQ signal effectively (or rather what drives DREQ on the emulating hardware)).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io