SecondBASIC Documentation v3

Home / Command Reference / Psg

Psg

Description: Plays a frequency or changes the parameters for a Psg sound <Channel>.

Syntax:

Psg <Channel>, <Data>

Part Description
<Channel> Required. Channels range from 0 to 3. 0 to 2 are the tone channels and 3 is the noise generator.
<Data> Required. This is a 10 bit frequency for a tone channel. If using the noise generator, <Data> has the following parameters:

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

FB Noise Type:
  • 0: Periodic (low frequency tone)
  • 1: White (hiss)

NF1NF2Noise Generator Clock Source
00Clock / 2, higher pitch
01Clock / 4
10Clock / 8, lower pitch
11Tone Generator #3

 

Note PSG Hertz Note PSG Hertz
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:

    Psg 3,1
    PsgVol 3,12