Sound

Introduction

The PC-Engine can produce sound on 6 channels. A wave can be described by 32 samples with values from 0-31, the envelope must be set by the music player.

Every voice has it's individual volume and panning settings, and there is a global volume for the left and the right channel.

The HuC6280 PSG

Registers

All the PSG's registers are memory mapped, but the voice-depending registers must be selected with the voice-select register.

$0800 Voice Select
$0801 Main Volume
$0802 Frequency (low)
$0803 Frequency (high)
$0804 Channel on/dda/volume
$0805 Pan volume ('balance')
$0806 Wave buffer
$0807 Noise - (only available to voices 5 & 6)
$0808 LFO Frequency
$0809 LFO Control

Global Registers

The voice-dependent registers are selected with the first register. The main volume and the LFO registers are global, too. The volume is set independent for both stereo channel: The lower 4 bit control the volume on the left channel and the upper 4 bits control the volume on the right channel.

$0809 LFO Control

Voice dependent register

These registers control the sound generated by each voice. The played frequency is calculated by dividing the 3.7 MHz system clock by the value of the frequency register, and by dividing this value by the length of the wavebuffer (32).

The panning register controls the stereo position of a voice. The lower 4 bits control the volume on the left channel and the upper 4 bits control the volume on the right channel.

The channel on/dda register controls the playback of a voice. The lower 4 bits control the voice volume. The PSG has no hardware envelope, the musicplayer has to generate one itself by modifying this register. The voice is enabled by bit 7 of this register. Bit 6 of this register resets the pointer into the wavebuffer, and while this bit is set, every value written into the wavebuffer is directly written into the D/A converter. The Wave is generated using a 32 byte circular wavebuffer. The range goes from 0 to 31.

An additional register is available for voice 5 & 6: The Noise register. Bit 7 of this register enables noise, bits 0-4 control the noise frequency.