IGNORED

# POKEY freq. tables

## Recommended Posts

I was having a dabble at music yesterday and found a concise note frequency chart (attached) but I don't understand a small part of it. Namely:

Distortion #12a is for sawtooth/buzzy bass.  Use only frequencies where (freq+1) mod 3 > 0  and (freq+1) mod 5 > 0
Distortion #12b is for sawtooth/smooth bass.  Use only frequencies where (freq+1) mod 3 = 0 and (freq+1) mod 15 > 0

Can someone please clarify the meaning of this, I don't understand MOD or what it's meaning.

##### Share on other sites

mod = modulus, or more simply produces the remainder from dividing by, so 15 mod 5 is 0 and 16 mod 5 is 1 etc

##### Share on other sites

In simple terms:

Frequencies divisible by 3 produce one of three random smooth tones

Frequencies divisible by 5 will intermittently produce a tone or silence

Frequencies divisible by 15 produce silence

All others produce the rough gritty tones.  This is to do with polycounter bit sampling, and the quirks present in the 12 distortion.

##### Share on other sites

Thanks for that both now I understand. I did make these tables myself back in 1994 but only for pure tones, I done the NTSC freq.'s as well as the PAL equivalents (in the TWAUG newsletter disk #26) but I think my note values were wrong (out of tune values), does anyone know where I can get these tables for the PAL as well as the NTSC obiously for all 3 clocks, any help  much appreciated.

There is one other question, I know with POKEY we have 15KHz, 64KHz and 1.7(9 or 7)MHz but when you pair 2 channels for 16-bit reasons if you don't clock them with 1.79MHz will that need to be a further table of values? I.E. With or without the 1.79MHz?

Lastly, is there information anywhere detailing this information requested above and the POLY bit-7 and how it affects the note values?

##### Share on other sites

I can't find @VinsCool's posting, but this is the last version of his sheet I downloaded. I believe there's a v16, but I cannot find it.

##### Share on other sites

5 minutes ago, ivop said:

I can't find @VinsCool's posting, but this is the last version of his sheet I downloaded. I believe there's a v16, but I cannot find it.

Thanks for that, but what do you open this file with?

##### Share on other sites

It's an open document sheet (hence ods). LibreOffice. But I think MS Office Excel will open it, too. It's a spreadsheet. You can even change the base frequency to which stuff is tuned.

Edit: Except for the table generation code at the extreme right of the sheets, everything seems to work with Google Sheets, too. Use Import, and import the file from your local device.

Edited by ivop
##### Share on other sites

There is also my note table in the 7800 programming forum.  As for the info on the polycounter shaping the sound of C distortion,  there is a post by @pavrosthat explains in detail.  Can't remember where it is offhand.

##### Share on other sites

Also on 16-bit:  with standard usage (silence 1 play 2) this is only useful with the 1.79 clock.  Without it, you can't reach those precise high notes needed.

Now with the reverse 16-bit settings (play 1 silence 2, or play 1 and play \$A distortion on 2) there's the possibility of different clocks but that's a whole other ballgame.

##### Share on other sites

4 hours ago, Synthpopalooza said:

In simple terms:

Frequencies divisible by 3 produce one of three random smooth tones

Frequencies divisible by 5 will intermittently produce a tone or silence

Frequencies divisible by 15 produce silence

All others produce the rough gritty tones.  This is to do with polycounter bit sampling, and the quirks present in the 12 distortion.

Could you make it even simpler? ?

Edited by Justin Payne
Forgot the question mark
##### Share on other sites

6 hours ago, ivop said:

I can't find @VinsCool's posting, but this is the last version of his sheet I downloaded. I believe there's a v16, but I cannot find it.

In addition to this I actually have a full table generation set of formulae I wrote in C++ for my RMT fork...

I should make a proper stand alone tuning calculator at some point, because in code this is a huge step above the spreadsheet format, and I even have full 16-bit calculations figured out in that one.

##### Share on other sites

Can anyone tell me the exact frequency's of POKEY's clocks, I know the 64KHz clock = 63921Hz, but I don't know the 15Khz clock exactly and the PAL and NTSC's faster clock 1.7(7 or 9)+ (with the decimal places), thanks.

##### Share on other sites

53 minutes ago, ac.tomo said:

Can anyone tell me the exact frequency's of POKEY's clocks, I know the 64KHz clock = 63921Hz, but I don't know the 15Khz clock exactly and the PAL and NTSC's faster clock 1.7(7 or 9)+ (with the decimal places), thanks.

I put them both in the original sheet that Vinscool based his work on: PAL = 1773447 and NTSC = 1789790.

15kHz clock is x/114

64kHZ clock is x/28

##### Share on other sites

I got this formula where you enter H as the true frequency of the note (A above middle C = 440Hz) and P outputs the 64KHz (63921) equivalent pitch value:

10 INPUT H
20 P=63921/H
30 P=(P-1)/2
40 ? P
50 ?
60 GOTO 10

But I need the 15KHz value and also one more question, can I do this for the 1.77MHz clock, ie:

20 P=1773447/H

I don't understand the x/114 and x/28?

##### Share on other sites

30 minutes ago, ac.tomo said:

I got this formula where you enter H as the true frequency of the note (A above middle C = 440Hz) and P outputs the 64KHz (63921) equivalent pitch value:

10 INPUT H
20 P=63921/H
30 P=(P-1)/2
40 ? P
50 ?
60 GOTO 10

But I need the 15KHz value and also one more question, can I do this for the 1.77MHz clock, ie:

20 P=1773447/H

I don't understand the x/114 and x/28?

I got it, I know what you mean now, many thanks for that, the only thing I don't quite get is that my values are slightly different (usually #1 lower) to the values in the original file (can't remember which one) so whereas the one table has a value of #60 (for 15KHz) and #243 (for 64KHz) my value comes at #59.46 and #242.09.

##### Share on other sites

1 hour ago, ac.tomo said:

I got it, I know what you mean now, many thanks for that, the only thing I don't quite get is that my values are slightly different (usually #1 lower) to the values in the original file (can't remember which one) so whereas the one table has a value of #60 (for 15KHz) and #243 (for 64KHz) my value comes at #59.46 and #242.09.

A lot of the old tables in books and magazines were wrong in one way or the other. If you want to understand the inner workings of Pokey, I suggest the Altirra Hardware Manual.

Note that the previous mentioned clocks are the XL clocks. The XE clocks might slightly differ because they divide a 14.something MHz crystal by eight.

Edited by ivop
##### Share on other sites

14 hours ago, ac.tomo said:

I got it, I know what you mean now, many thanks for that, the only thing I don't quite get is that my values are slightly different (usually #1 lower) to the values in the original file (can't remember which one) so whereas the one table has a value of #60 (for 15KHz) and #243 (for 64KHz) my value comes at #59.46 and #242.09.

Can someone tell me if I have to do 2 parts to the formula or just the one, ie:

10 INPUT V

20 P=(1773447/V)/2 or 20 P=((1773447/28)/V)/2 or P=((1773447/114)/V)/2

30 ? V,P: ?

Is this all or do I need to subtract a small number or do anything else to it?

Edited by ac.tomo
##### Share on other sites

1 hour ago, ac.tomo said:

Can someone tell me if I have to do 2 parts to the formula or just the one, ie:

10 INPUT V

20 P=(1773447/V)/2 or 20 P=((1773447/28)/V)/2 or P=((1773447/114)/V)/2

30 ? V,P: ?

Is this all or do I need to subtract a small number or do anything else to it?

For 15kHz and 64kHz:

pitch = clock / 114 / (v+1 ) / 2    (replace 114 by 28 for 64kHz mode)

For 1.8MHz

pitch = clock / (v+7) / 2

Edited by ivop
forgot the /28
##### Share on other sites

3 hours ago, ivop said:

For 15kHz and 64kHz:

pitch = clock / 114 / (v+1 ) / 2    (replace 114 by 28 for 64kHz mode)

For 1.8MHz

pitch = clock / (v+7) / 2

Excellent stuff, thanks ivop.

##### Share on other sites

On 2/26/2022 at 3:26 PM, ivop said:

For 15kHz and 64kHz:

pitch = clock / 114 / (v+1 ) / 2    (replace 114 by 28 for 64kHz mode)

For 1.8MHz

pitch = clock / (v+7) / 2

Can someone help me as to re-arrange the formula, what I want to do is enter the actual frequency (hertz) of the note and output the pitch value (the value you poke into the AUDF register), I know its something to do with formaula transposition or something but I can't remember how.

##### Share on other sites

2 hours ago, ac.tomo said:

Can someone help me as to re-arrange the formula, what I want to do is enter the actual frequency (hertz) of the note and output the pitch value (the value you poke into the AUDF register), I know its something to do with formaula transposition or something but I can't remember how.

No worries, I've worked this out now, but there is a question I have:

All musical notes have a particular frequency, yes, and the pure tones (dist. #10 in POKEY) are tuned according to the 'real' Hertz of the note, for example: A above middle-C is 440Hz so to get the A note then its pitch value has to be as near as possible to this amount of hertz, yes, ok, so why do the frequencies differ with different distortions? Exactly how do you get the distortion -12 pitch values since they obviously ain't ruled by the Hertz of the note.

Edited by ac.tomo
##### Share on other sites

That's because distortion 12 is not a simple oscillator and a frequency divider, like distortion 10 is. The value you write as AUDF is not a frequency BTW, but a divider. SID has frequency values, hence they perform poorly in the bass sounds.

Also note that A=440Hz is totally arbitrary. You can also pick 445Hz or 443Hz, or whatever you want. Some orchestra's tune almost a semitone higher or lower.

Edited by ivop
##### Share on other sites

2 hours ago, ivop said:

That's because distortion 12 is not a simple oscillator and a frequency divider, like distortion 10 is. The value you write as AUDF is not a frequency BTW, but a divider. SID has frequency values, hence they perform poorly in the bass sounds.

Also note that A=440Hz is totally arbitrary. You can also pick 445Hz or 443Hz, or whatever you want. Some orchestra's tune almost a semitone higher or lower.

yes, thanks for that. I do understand about the temperement of the scale just not how to get the distortion 12 values.

##### Share on other sites

16 minutes ago, ac.tomo said:

yes, thanks for that. I do understand about the temperement of the scale just not how to get the distortion 12 values.

As a famous old Dutch statesman would have said, in the first place, two things:

1. there's no simple formula to go from [0-255] distortion 12 at, say, 64kHz, to the frequency of the note, but see below.

2. the temperament of distortion 12 is fixed, unlike distortion 10, which you can vary, but see belower.

Below: @VinsCool is working on such formulas for his RMT fork if I'm not mistaken. For the mod 3, 5, and 15 notes there should be a relationship between the AUDF value and the resulting frequency.

Belower: His new RMT tuning tables are combination of just tuning, 12-tet and trying to be in tune with the dist 12 basses as much as possible, without sacrificing too much proper harmonies, like thirds and fifths.

Edited by ivop
• 1
• 1
##### Share on other sites

1 hour ago, ivop said:

Below: @VinsCool is working on such formulas for his RMT fork if I'm not mistaken. For the mod 3, 5, and 15 notes there should be a relationship between the AUDF value and the resulting frequency.

This is correct.

I have actual formulae for most of those, except for the unstable tones (I think that is the mod3 ones? I just know they have 1/2 chance to output silence so I purposefully avoid them in my tables).

There is also the Distortion 4 that I have no idea how it works, yet.

Unstable tones aside, my Registers View code outputs accurate Notes, Octaves and even Cents off from the standard 440Hz tuning for all the modes I currently have figured out the formula at some point.

Due to technical reasons, even if I actually have the functional code from RMT to adjust the pitch based on the region, I simply display pitch as it is from a PAL machine.

Anyway, back to Distortion C, turns out there *is* a pattern for all of the combinations, and based on this, I can accurately predict the Distortion C pitches and timbre that is output based on the AUDF and AUDCTL bits alone!

For most of the Distortion C output , it makes use of something like a pattern of 6-3-3-3 AUDF values, where on the 6 is a buzzy tone, and 3 is a gritty tone.

There are always few unstable tones in between the gritties, but I currently have ignored them in my calculations.

Even better, the 1.79mhz mode, and 16-bit mode, use the exact same pattern, only shifted at a different AUDF value.

The exception is 15khz mode, which seems to only output buzzy tones, so I did not bother finding a pattern for it yet.

I'm not on my PC currently, but like I said the other day, I do have the C++ code written from scratch for all of the formulae I have figured out, so I think I should do what I said and make a stand alone program to generate all the known pitches, that will be separate from RMT so I could at least have a proper github repo for that stuff alone.

The VUPlayer project alone has been draining me a bit so doing a bit of C++ again tonight is not a bad idea... ?

## 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.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.