ZX Spectrum计算机提供两种音频输出方案供开发者选择[1]。其中,1-bit beeper在所有Spectrum型号上均可用,而AY-3-8910合成器芯片则限于128K及以上型号[1]。
Beeper是最基础的音频实现方式,可通过BIOS调用、直接控制或编程方式触发[1]。使用beeper播放音调时,频率代码的计算遵循公式437500/f – 30.125,而音长代码则为f×t[1]。直接控制beeper需要特别注意处理视频电路内存访问的等待状态问题[1]。Beeper主要适用于音效和短铃声的生成[1]。
对于配备AY-3芯片的机型,该合成器在Spectrum上的时钟频率为3.5469 MHz[1],这与其在Atari ST上的4MHz标准频率不同[1]。AY-3的音频频率代码计算公式为3546900/(32f),而包络长度代码为3546900/(512t)[1]。相比beeper的局限,AY-3芯片可用于更复杂的音乐驱动和环境音效制作[1]。教程提供了使用汇编代码实现C大调音阶播放的完整示例[1]。
A detailed technical guide has outlined the audio capabilities and programming methods for the ZX Spectrum computer, covering two distinct sound generation options available on the system [1].
The ZX Spectrum provides two audio output methods: a 1-bit beeper present in all models, and an AY-3-8910 synthesizer chip available in 128K and later variants [1]. For beeper programming, the frequency code is calculated using the formula 437500/f – 30.125, while duration codes follow the formula f×t [1]. Direct beeper control requires careful handling of video circuit memory access wait states [1]. The AY-3 chip operates at a clock frequency of 3.5469 MHz on the Spectrum, differing from the 4MHz used in other systems [1]. Frequency codes for the AY-3 are derived from the formula 3546900/(32f), and envelope length codes use 3546900/(512t) [1].
The guide demonstrates these programming techniques through complete assembly code implementations, including methods for invoking the beeper via BIOS calls and direct control mechanisms [1]. Functionally, the beeper serves primarily for sound effects and brief alert tones, while the AY-3 synthesizer chip enables more sophisticated applications such as music drivers and ambient soundscapes [1].