Jump to content

POKEY sound values in 7800 BASIC

Recommended Posts

  • 3 weeks later...

For really basic POKEY music ... we're talking the standard AUDCTL=$00 defaults here, 4 channels, no special settings ...


POKEY distortions work like the TIA ones, but for basic music at the most basic settings, you are looking at $Ax (distortion 10), and $Cx (distortion 12)


So basically, in the 10 distortion, 255 frequency steps, and you can basically hit square notes starting at B2=255 ($FF) and up to about the 6th octave before tuning errors happen


In the 12 distortion, you can get down to the bass frequencies, all the way to C1.  In addition, there are two bass waveforms.  The normal one is a harsh gritty tone, but using frequencies divisible by three makes a more smooth buzzy tone, which gets you down to about G#1.  These are all in my tables, just look for the basic 8-bit 64khz settings.


To make percussion sounds you can use distortion 8, or 0.  0 has a rough whooshing sound to it, where 8 is more like the same distortion in TIA.


Distortion 4 is good for tank engines and rumbles, or teleport fx when played high pitched but in basic settings useless for music. 

Distortion 2 is for deep clangy bell sounds, but can't reliably be used for music in the basic settings.


Each channel allow you to control the volume, with a setting of 0-15.  Don't go above about 6 on each channel though, or you will get horrible distortions. 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 5 months later...
On 7/15/2022 at 1:25 PM, atari2600land said:

So the sample POKEY music for 7800 BASIC are just a whole bunch of numbers. Is there some chart or something that can make sens of the numbers it uses?

Hey @atari2600land I finally got a chance to look at this sample and take it apart, then coded my own version with scales to try to figure things out a bit.

When using psound if we stick with the square wave (10, pure tones) then these numbers works as a basic scale. I didn't finalize the tuning at the very top so those numbers will need a little massaging. But, they are close. After I get used to this I will work on the other waveforms and build out more tables that might help out.


If it would help I could create a graphic with a treble clef/bass clef staff that would have the note values next to each note.


The tempo is set with the variable "frame" and the code: 

if (frame&7)=0 then gosub playnotes


If you want to speed it up change the mod number to be lower or higher to make it slower.  The number next to each pitch is the subdivision or note length value. It can be whatever you want it to be, but think about your composition and set it the be the smallest note division you would need. So, if you have eighth notes as your smallest value then that can be the 1 and the value 2 would be a quarter note, etc.




Below is a quick table to guide you when utilizing the square wave. Oddly enough the lower numbers are higher pitched and vice versa.

To play a D4 with psound using channel 0 to play a square wave the command would be: psound 0, 108, 10, 15 


 33 - A5 *
 37 - G#5/Ab5 *
 40 - G5 *
 42 - F#5/Gb5 *
 44 - F5 *
 47 - E5
 50 - Eb5/D#5
 53 - D5
 57 - C#5/Db5
 60 - C5
 64 - B4
 68 - Bb4/A#4
 72 - A4
 77 - Ab4/G#4
 81 - G4
 85 - F#4/Gb4
 89 - F4
 96 - E4
102 - Eb4/D#4
108 - D4
115 - C#4/Db4
121 - C4
128 - B3
136 - Bb3/A#3
144 - A3
151 - Ab3/G#3
162 - G3
171 - F#3/Gb3
182 - F3
193 - E3
203 - Eb3/D#3
217 - D3
230 - C#3/Db3
243 - C3


* Still need tweaking to be in tune

255 might play close to B2 but 255 is used in the player code to stop the song.

The code also uses 0 as a rest.


Edited by saxmeister
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...