Problem
When multiple sounds are active at once the result sounds different from the original game. The character and timbre of combined sounds — engine + fire, engine + low-fuel, explosion overlapping engine — diverge noticeably from the ZX Spectrum original.
Research
The original ZX Spectrum has a single 1-bit speaker. The interrupt handler dispatches sound routines in a fixed order: fire → engine → low-fuel → bonus-life → explosion. All active routines execute sequentially within the same 20 ms window. The speaker output for one interrupt is a single continuous waveform — the concatenation of each routine's pulses in dispatcher order. Sounds cannot overlap: they share one channel and one time budget per frame.
The current implementation plays each sound on a separate audio.Player. When multiple sounds are active their waveforms are summed simultaneously by the audio system, which does not match the original single-channel sequential output.
Potential solution
Implemented a sequential mixer was. For each 20 ms, contribute the active portion of each sound in dispatcher order, then fill the remainder with silence.
Temporary workaround
Disable the engine sound:
|
if !s.activeEngine.IsPlaying() { |
|
// s.activeEngine.Play() |
|
} |
Problem
When multiple sounds are active at once the result sounds different from the original game. The character and timbre of combined sounds — engine + fire, engine + low-fuel, explosion overlapping engine — diverge noticeably from the ZX Spectrum original.
Research
The original ZX Spectrum has a single 1-bit speaker. The interrupt handler dispatches sound routines in a fixed order: fire → engine → low-fuel → bonus-life → explosion. All active routines execute sequentially within the same 20 ms window. The speaker output for one interrupt is a single continuous waveform — the concatenation of each routine's pulses in dispatcher order. Sounds cannot overlap: they share one channel and one time budget per frame.
The current implementation plays each sound on a separate
audio.Player. When multiple sounds are active their waveforms are summed simultaneously by the audio system, which does not match the original single-channel sequential output.Potential solution
Implemented a sequential mixer was. For each 20 ms, contribute the active portion of each sound in dispatcher order, then fill the remainder with silence.
Temporary workaround
Disable the engine sound:
river-raid-ebiten/pkg/audio/sound.go
Lines 127 to 129 in d2ea39a