Jump to content
IGNORED

YAPT (Yet Another POKEY Table)


Pat Brady

Recommended Posts

Warning: severe music geekiness ahead.

 

I’ve been looking at Synthpopalooza’s POKEY tables, and thinking about what he wrote in the Popeye thread (in 16+8+8 mode using the 16-bit channel for bass, which makes sense after being initially counterintuitive to me) and how some POKEY games don’t sound as good as I think they should.

 

I wanted to look at the errors of various frequencies, meaning the difference between what POKEY produces and what that note ideally should be. The easiest way for me to do that was to roll my own note table.

 

Here’s what I initially noticed:

  1. No surprise in 16-bit mode: errors are very small throughout the range.
  2. 64 kHz clock has a good range of about an octave and a major third. 15 kHz clock has a slightly wider good range, but there are some sketchy combinations (example: E1+B1 and especially E1+E2).
  3. I was hoping to find some cases where using an off-table value would be more correct in certain circumstances. There are a few (examples: with 64 kHz clock D3+B3 chord would be more consonant using $D8 for the D, and with 15 kHz clock some keys would work better using $BD for E1) but not many immediately apparent.

 

My initial plan had been to make tables in different temperaments, but at this point I started wondering: what if we had different pitch tables for different keys? That would let us approximate just intervals. Unlike a piano, a 7800 program can easily change tunings on the fly. And what if we switch the tuning basis from A4=440 to whatever nearby number happens to work well for POKEY 8-bit in that key? A=440 Hz is not a law of nature. The Berlin Philharmonic used to tune to A=448, and I know of commercial recordings done as low as A=392.

 

I started working on B major since 64 kHz clock’s lowest possible note (AUDF=$FF) is a B. Tuning to that (which gives A=449.44) produces numbers that look pretty decent with either clock. The D#2 to E2 interval is not ideal, but in real music it may not be noticeable. If it is, tweaking the E2 value might help.

 

I moved to C major. After a little experimenting, I found something very interesting: with A4=436.11, and D=C*10/9 (a slightly different form of just intonation, hear samples here), the 15 kHz clock gives near-perfection from C1 all the way up to C5. The only bad note is F4. Every other note is right on target. Note that this not only goes much lower than the equal temperament chart with 64 kHz clock, it also provides several more in-tune notes on the high side.

 

That C modulates well to G major, with a similar range. The Ds and F#s get farther off than I’d like but can be tweaked to at least match each other. The other notes in the G scale are correct.

 

When 8-bit bass is unneeded, a higher tuning (A4=443.90) with 64 kHz clock produces a perfect C scale from C3 all the way up to C7 except for F6.

 

Just to be clear: when I say tune to some number, I’m just talking about how I determine the AUDF values for the tables. The tuning itself is not a setting.

 

It’s all theoretical right now, but I hope to put it to use soon. How? Well, the low C scale looks good enough that it could work with 4 channels as-is, avoiding that F4. The G and B scales could also be used that way, but might be better suited to 16+8+8 mode, but instead of using 16 for some specific line, use it for whichever note needs it at the moment. It also might make sense to compose for 4 voices, but drop one voice when another needs 16 bits.

 

Or, could use Synthpopalooza’s preferred 16 (for bass)+8+8 configuration, but with the high-range C tuning. Compared to conventional tuning this provides two extra octaves up top, and tighter intonation to boot.

 

If this works out I will expand it to other keys and other distortion settings.

 

link: Yet Another POKEY Table

Explanations of colors are at the bottom of the 64 kHz columns. The light-colored text can be difficult to read, which is somewhat intentional, considering the meanings of the colors.

Use the bottom tabs to switch keys or to conventional equal temperament.

  • Like 7
Link to comment
Share on other sites

I actually tried a method similar to this in the 80s ... when I only knew how to do 8-bit POKEY.  The problem being when you have to use $Cx bass (either mod 3 or not) and the higher notes are off tune.  I would take the higher note, and then try to retune everything else, including the standard $Ax channels, to be in tune with this note.  Sometimes it doesn't work,  sometimes it does if you can avoid playing problem notes in your music.

  • Like 1
Link to comment
Share on other sites

On 9/2/2020 at 2:59 PM, RevEng said:

Instead of looking for best overall tuning, you might also look for tuning for where our ears are most sensitive, aka Perceptual Tuning. This was a game changer for me with TIA... I no longer have to transpose, transpose, and re-transpose, looking for a sweet spot.

 

What I’m doing with key-specific tables is similar in principle, prioritized error minimization. But with POKEY, even in 8-bit mode, we can be considerably more ambitious than we are with TIA. :)

 

The shades of green mark the tonic (darkest), the major third, fourth, and fifth (medium), and the other notes in the scale (light). The white rows are accidentals.

 

My C major tables for 8-bit settings are in tune for every note in the scale for >3 octaves, plus every note except F in the fourth octave, plus a low B.

 

For other keys it’s going to be trickier and I may end up modifying your code to help me find the minimum prioritized errors.

 

1 hour ago, Synthpopalooza said:

I actually tried a method similar to this in the 80s ... when I only knew how to do 8-bit POKEY.  The problem being when you have to use $Cx bass (either mod 3 or not) and the higher notes are off tune.  I would take the higher note, and then try to retune everything else, including the standard $Ax channels, to be in tune with this note.  Sometimes it doesn't work,  sometimes it does if you can avoid playing problem notes in your music.

 

I see the similarity, but I’m trying to create entire tuning systems that give wide ranges and high accuracy for (hopefully) anything in a given key.

 

In your 16+8+8 scheme where you use the 16-bit channel for bass, I expect my “high-range” tables (I should come up with a better name) to provide several advantages over the conventional table:

  1. Wider range (for C major, 3 1/3 octaves instead of 1 1/3) in the 8-bit channels before any note in the scale is noticeably out of tune
  2. Better intonation (for C major, no errors at all) in the 8-bit channels within that range
  3. Just intonation for all 3 channels

More in a bit.

  • Like 2
Link to comment
Share on other sites

As I mentioned earlier, A4=440 Hz is not a law of nature, it was not always a standard, and even today some professional orchestras use other pitches. But it is the modern standard, so it’s not surprising that most POKEY tables are based on A4=440.

 

But POKEY 8-bit $Ax is not particularly good at generating 440 Hz! So most POKEY tables are chasing something POKEY can’t even do. The errors are fairly small in octave 4, but increase noticeably in octave 5.

 

With that in mind, I cooked up a couple of equal-temperament tables that fit better with the notes POKEY can produce (8-bit $Ax clocked at 64 kHz). Both put A4 at or near the pitch that other tables do, but they differ elsewhere. I’d like to choose one of these tables for recommending to people who don’t want to deal with a multitude of tables, but I’m not yet sure which should get that blessing.

 

I also finished the “high-range” G major table. It’s not as good as the C major table but it should be better for G major than any of the equal-temperament tables.

  • Like 1
Link to comment
Share on other sites

Another thing that might prove helpful:

 

Including modified ranges for the 15khz clock (AUDCTL=%???????1) ... this lets you use bass notes in 8-bit mode.  Any channels which use 1.79 clock are unaffected.

 

EDIT:  Never mind, found those in your table already.  This is very useful!

Edited by Synthpopalooza
  • Like 1
Link to comment
Share on other sites

  • 1 month later...

I’ve been slowly adding stuff to this. I added tables for several different keys. Each table now has columns for $Cx in the 3 possible pattern lengths which seems to work, and columns for $2x which do not seem correct. Those columns are mostly automated.

 

I also added columns for TIA values. The frequencies and errors are automated, but I have to enter the AUDC and AUDF values manually, so it’s a lot more work. But I’ve noticed some interesting things.

 

One is that for 8-bit POKEY, the C major (15 kHz basis) table is really nice. The in-scale notes are in tune from B0 all the way up to C5, except for F4. But it turns out that TIA's 0C:0E F4 is perfectly in tune for that scale! I’m looking forward to putting that to use.

 

I started to work on a POKEY scale to match TIA’s A major scale, based around TIA’s 0C:17 A3. But then it turned out that would be identical to the 15 kHz-based A major table I already did.

 

Oh, and one more thing. TIA does have other usable scales, they are just obscured by the popular note table's reliance on equal temperament and A4=440 Hz. I have two in D flat and one in F major. Over on the 2600 development forum I just posted a transcription of a Bach Prelude in F that I am pleased with.

 

I feel like we have only scratched the surface of what is possible with POKEY+TIA.

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.

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

Loading...
  • Recently Browsing   0 members

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