Psg

Last Modified: 1/15/2021

Plays a frequency or changes the parameters for a Psg sound Channel.

Arguments

NameTypeRequiredDescription
Channel Integer Yes The sound Channel to play the sound on. Valid values range from 0 to 3. Channel 3 is the noise generator.
PsgData Integer Yes This is a 10 bit frequency for a tone Channel.

Noise Generator

If the Channel is set to the noise generator, the PsgData has the following format:

MSB: 0 0 0 0 0 FB NF1 NF2 :LSB

FB Noise Type:
  • 0: Periodic (low frequency tone)
  • 1: White Noise (hiss)
NF1NF0Noise Generator Clock Source
0 0 Clock / 2 (higher pitch)
0 1 Clock / 4
1 0 Clock / 8 (lower pitch)
1 1 Tone Generator #3

Psg Note Table

NotePsgHertzNotePsgHertz
A3 7 110.00 B5 798 493.88
A#3 64 116.54 C6 810 523.25
B3 118 123.47 C#6 822 554.37
C4 169 130.81 D6 834 587.33
C#4 217 138.59 D#6 844 622.25
D4 262 146.83 E6 854 659.26
D#4 305 155.56 F6 864 698.46
E4 345 164.81 F#6 873 739.99
F4 383 174.61 G6 881 783.99
F#4 419 184.99 G#6 889 830.61
G4 453 195.99 A6 897 880.00
G#4 485 207.65 A#6 904 932.32
A4 516 220.00 B6 911 987.77
A#4 544 233.08 C7 917 1046.50
B4 571 246.94 C#7 923 1108.70
C5 596 261.63 D7 929 1174.70
C#5 620 277.18 D#7 934 1244.50
D5 643 293.66 E7 939 1318.50
D#5 664 311.13 F7 944 1396.90
E5 685 329.63 F#7 948 1480.00
F5 704 349.23 G7 953 1568.00
F#5 722 369.99 G#7 957 1661.20
G5 739 391.99 A7 960 1760.00
G#5 755 415.31 A#7 964 1864.70
A5 770 440.00 B7 967 1975.50
A#5 784 466.16 C8 971 2093.00

Example

Syntax: Psg <Channel>, <PsgData>
    Psg 2,516
    PsgVol 2,12

Remarks

The default volume of a Channel is 0 (muted), so you'll need to set the volume with PsgVol.

See Also

PsgVol