Jump to content
Synthpopalooza

My POKEY experiments using nonstandard settings

Recommended Posts

I have started a thread over on the 7800 forums regarding experimental POKEY music using unusual settings, for purposes of improving 7800 emulation.  By request, I am starting a thread here to port some of these examples to the XL platform.

 

Explanation:  I have been messing with some of the same settings that Analmux (RIP) documented in his earlier experiments.  These will be ongoing, and I will be updating this with new experiments. 

 

The music player code was written by @PacManPlus and modified somewhat by me ... and is what I used to program music for the Bentley Bear 7800 game.

 

To start off with, I am dealing with two nonstandard POKEY settings:

 

* Reverse 16-bit filter

* Two tone mode

 

Reverse 16-bit filter, is like normal 16-bit settings where you join two audio channels.  Normal 16-bit filter usage is to silence channel 0, while channel 1 carries the distortion setting.  Channel 0 plays the low order byte, and channel 1 the high order byte.  Then channel 0 is clocked at 1.79 mhz.  This is commonly used to allow one to play bass on $Ax square wave setting, or reach higher notes with precision.

 

But if you reverse the settings ... play channel 0 while channel 1 is silenced ... the timbre of the sound changes.  I have been playing around with this, and found one of the settings Analmux used in his demo tune.  To enable this:

 

* AUDCTL=$D0 (9-bit poly, 16-bit filter on 0 and 1, clock 0 at 1.79 Mhz)

* AUDC0=$8x (Noise setting, but with 9-bit polycounter)

* AUDC1=$00 (silenced)

* AUDF1=$00 (constant 0 frequency, this never changes)

 

Using these settings, a distorted guitar sound is created.  I had to construct a custom note table for this setting, which I have included in the .s file for the demo here.  There are two tables of frequencies, one of which involves frequencies divisible by 7.  These work in a similar manner as the $Cx frequencies divisible by 3, using the $Cx distortion setting (RMT C Bass).

 

So, I have done a demo of the Rolling Thunder opening theme.  Layout:

 

AUDCTL=$D0 (9-bit poly, 16-bit filter on 0 and 1, clock 0 at 1.79 Mhz)

 

Channel 0 - $8x distortion with 9-bit poly, using reverse 16-bit filter - distorted guitar, custom note table

Channel 1 - Silenced.  Frequency set at constant 0.

Channel 2 - $Cx, no special settings.  RMT E bass

Channel 3 - $Ax square wave, no special settings - accompaniment

 

.xex and source codes attached.  .s file contains the note table I used for this tune. 

 

 

thunder.asm thunder.s thunder.xex

Edited by Synthpopalooza
  • Like 8

Share this post


Link to post
Share on other sites

Next up:  SKCTL two-tone mode.

 

This is achieved by setting SKCTL to $8B.  This setting was originally used for things like Cassette and Disk I/O (The cassette save tone and the disk drive beeps), modem carriers, and touch tone dialing.  But it has musical properties too.

 

To use this:  Store $8B in SKCTL.  Channel 1 is silenced.  Channel 0, in these examples, is set to $Ax square wave.  Channel 1 plays the melody with notes taken from the standard $Ax 8-bit note table.  Channel 0 plays the same melody, but transposed up a number of semitones.  This maintains the pulse width.  The timbre produced here has a saw or pulse wave quality to it.

 

I have two examples.  Example 1 is a rendition of the iconic Super Mario World theme music.  Example 2 is the music from the NES game 3D Worldrunner.

 

Settings ...

 

Mario World:

 

AUDCTL=$00 (no special settings)

SKCTLS=$8B

 

Channel 0: $Ax (two tone modulation from channel 1) - main melody from 1 but transposed up 14 semitones

Channel 1: Silent ... frequency carrier

Channels 2 and 3:  $Ax square wave, no special settings

 

3D worldrunner:

 

AUDCTL=$20 (clocks channel 3 at 1.79 Mhz)

 

Channel 0: $Ax (two tone modulation from channel 1) - main melody from 1 but transposed up 17 semitones

Channel 1: Silent ... frequency carrier

Channel 2:  $Cx, clocked at 1.79 Mhz ... very high saw wave ranging from A#4 to G6. 

Channel 3:  $Ax square wave, no special settings - emulates the NES triangle bass channel

 

Notes for Channel 2 are taken from my Distortion 12A table, 1.79 mhz.  You can play as low as A#4, and up to the 6th octave before tuning errors become apparent.

 

 

 

worldrunner.asm worldrunner.s worldrunner.xex marioworld.asm marioworld.s marioworld.xex

  • Like 6

Share this post


Link to post
Share on other sites

As a reference, the current version of my POKEY note table can be accessed here.  It only contains normal 8-bit settings, 16-bit, and on some distortions, values for 15Khz and 1.79 Mhz clocks.  The special settings I am experimenting with will be documented in seperate POKEY tables.  Values are for:

 

$Ax square wave (8-bit, 16-bit, and 8-bit 15 khz clock)

$Cx saw wave (8-bit, 16-bit, RMT E and C bass, plus a 1.79 Mhz setting for the C setting)

$2x triangle wave (8-bit, 16-bit, 1.79 mhz)

$8x with 9-bit polycounter

$4x using 1.79 clock, two settings.

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Good work, some notes we've not really heard from Pokey before... though 2-tone isn't used in disk IO BTW and I'm not sure there's been any modem type implementations as it's an output only thing.

Share this post


Link to post
Share on other sites

I've written some short BASIC programs for stepping through frequencies in these modes, for purposes of tuning and generating note tables.  Might make the processes easier.  There is a lot unexplored.  Will post those tomorrow.

Share this post


Link to post
Share on other sites

I guess the formulas to determine frequency, pulsewidth etc should be fairly simple - I remember doing tables for the saw/triangle waves by adjacent frequencies of 1.79 MHz mode, it was just a case of subtract one from the other.

Share this post


Link to post
Share on other sites

A long time ago, in a far far away Galaxy…...

 

Evil Darth emkay was asking for a development tool , a real POKEY Tracker with full synthesizing features, running on the PC, to store all settings and giving examples for developing better music for the Atari.

But the Rebels defended bravely ….

 

 

  • Like 1

Share this post


Link to post
Share on other sites
5 hours ago, Rybags said:

I guess the formulas to determine frequency, pulsewidth etc should be fairly simple - I remember doing tables for the saw/triangle waves by adjacent frequencies of 1.79 MHz mode, it was just a case of subtract one from the other.

In the $4x + 1.79 mhz + SKCTL mode I am trying to do (AUDCTL=$40, or $41 if you want 15 mhz on the carrier channel) it's incredibly complex.  There are several different timbres that produce musical notes and I haven't yet discerned a pattern.  But it produces some ferocious guitar sounds.

Share this post


Link to post
Share on other sites
8 hours ago, emkay said:

A long time ago, in a far far away Galaxy…...

 

Evil Darth emkay was asking for a development tool , a real POKEY Tracker with full synthesizing features, running on the PC, to store all settings and giving examples for developing better music for the Atari.

But the Rebels defended bravely ….

 

 

To weigh in ...

 

It's a real good idea, hampered by one thing:  There are a lot of possible settings, not all of them necessarily compatible with each other because of different AUDCTL settings, SKCTL, etc.

 

And also, so much of this hasn't even been documented and tested... something I hope my experiments can rectify.  Once everything ... or most of it ... has been documented and tested, an updated tracker will become a bigger possibility.  There is so much we don't know.  Here is what we do know ...

 

POKEY has 6 waveforms:

 

$0x - pink noise, can use 9-bit

$2x triangle 

$4x - 5 plus 4 bit ... two iterations

$8x - white noise, can use 9-bit

$Ax - square wave

$Cx - saw wave, 2 iterations

 

Three clocks:  64 khz, 15 khz, 1.79 mhz

 

Four filters:

 

Hi pass (2 --> 0, 3 --> 1)

16- bit (0 --> 1, 2 --> 3)

Reverse 16-bit (1 --> 0, 3 --> 2)

Two tone (1 --> 0)

 

Some of these can be stacked.  So there's a lot to explore.

  • Like 2

Share this post


Link to post
Share on other sites

Actually, we know that "Hi Pass" is not a "High Pass" , it's just an inversion of the generator frequencies, resulting in a higher pitched sound. In fact it is an active modulation feature. 

 

Modulation is something POKEY is always doing, as the channels were directly bounded and add in a plain physical way. 

 

The tune is programmed (RMT) in one VBI. The modulation gets interesting at 0:36 , you may check out what the waveform shows. 

 

 

  • Like 2

Share this post


Link to post
Share on other sites

Also:

 

The adjustment for active modulations could be easy to explain, if such a Tracker existed. 

You just could set the values and make them usable for all interested. 

 

 

Share this post


Link to post
Share on other sites
1 hour ago, Synthpopalooza said:

Hi pass (2 --> 0, 3 --> 1)

16- bit (0 --> 1, 2 --> 3)

Reverse 16-bit (1 --> 0, 3 --> 2)

Two tone (1 --> 0)

 

Don't understand the reverse 16-bit thing. What setting does it use ?

Share this post


Link to post
Share on other sites

Normal 16-bit filter ($10 in AUDCTL) silences channel 0.  Channel 1 plays the music.  This is usually accompanied by a 1.79 clock ($40 AUDCTL) on 0 to transpose the channels up into a playable range. 

 

Reverse 16 bit filter is same settings, but instead channel 1 is silenced and 0 is played.  This may or may not require the 1.79 mhz clock depending on distortion usage.  This changes the timbre of the sound.

Share this post


Link to post
Share on other sites
2 minutes ago, Synthpopalooza said:

Normal 16-bit filter ($10 in AUDCTL) silences channel 0.  Channel 1 plays the music.  This is usually accompanied by a 1.79 clock ($40 AUDCTL) on 0 to transpose the channels up into a playable range. 

 

Reverse 16 bit filter is same settings, but instead channel 1 is silenced and 0 is played.  This may or may not require the 1.79 mhz clock depending on distortion usage.  This changes the timbre of the sound.

$10 in AUDCTL is not really a filter. It just merges channels 1 and 2 into one 16 bit counter. You are right though, it does create special sound.

 

Whenever the low byte goes to 0, it flips channel 1. And when the whole 16 bit number hits zero, the channel is reset. So basically if you set frequency $140 ($40 in audf0 and $1 in audf1) you will get one pulse of length $40 and another pulse of length $100.

The low byte controls length of the first pulse, the high byte controls number of $100 long pulses after that. With $A0 distortion it's best used with normal 64k. Not sure how it can be useful in music, but it might add some flavor to the bass. Can't see how RMT could be easily hacked to test it though. I need 16 bit tables for 64kHz, and different AUDC settings, compared to what RMT normally uses.

Share this post


Link to post
Share on other sites

I know very little about sound but I've to say the Rolling thunder tune almosts sounds like an adlib card!

 

Are you more limited by the number of simultaneous voices compared to regular tunes or is the just the style of those tunes ?

Share this post


Link to post
Share on other sites

In addition, the other two tunes using SKCTL also require silencing 1, although in this case one could also let 1 play the frequency too, since it mirrors what 0 is doing ... it can add depth to the sound being played. 

Share this post


Link to post
Share on other sites

These were some short programs that I wrote in TurboBASIC to step through some of these modes.

 

Use the arrow keys to step through AUDF0 and AUDF1.  Use + or - to step through the standard $Ax 8-bit scale for reference.  I have been using this to construct note tables.

 

EDIT: Fixed a line bug that caused a crash.

 

Also, these modes are used:

 

FTESTC16:  $Cx, Reverse 16 setting, no SKCTL or AUDCTL

FTESTC8B:  $Cx, 1.79 mhz clock, SKCTL, no 16 bit setting

FTEST48B:  $4x, 1.79 mhz clock, SKCTL, no 16 bit setting

FTEST88B:  $8x, 1.79 mhz, 9-bit poly, Reverse 16-bit, SKCTL

 

It's easy to change these to whatever you like, just edit line 20.

 

FTESTC8B.TUR FTESTC16.TUR

FTEST48B.TUR FTEST88B.TUR

Edited by Synthpopalooza
  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Also ... feel free to construct any note tables on your own if you like and post them here.  Maybe we can make it a team effort.  Include the AUDCTL and SKCTL settings you used.

Share this post


Link to post
Share on other sites

Also, these are the beginnings of note tables ... in the case of $4x, I have only scratched the surface ... I wrote down notes which I identified by ear, but without octave identifiers.  Might be a start.

 

The $Ax bell is mostly complete, but there is a second sawtooth timbre here which I am trying to document.  I believe this to be the very famous CSAVE setting, with the sonorous bell tone which is made when you are about to save to cassette.

atari $4x guitar AUDCTL=$40 SKCTL=$8B.txt atari $Ax bell.txt

  • Like 3

Share this post


Link to post
Share on other sites

The other thing I forgot to mention ... the POKEY examples above that used SKCTL (Mario and Worldrunner) will only run properly on a genuine POKEY.  The new POKEYOne clone which is out currently does not support any of the SIO functions, including 2-tone mode.  I'm told that the creator of POKEYOne is working on that functionality now.

Share this post


Link to post
Share on other sites
On 9/8/2019 at 8:06 PM, Synthpopalooza said:

POKEY has 6 waveforms:

 

$0x - pink noise, can use 9-bit

$2x triangle 

$4x - 5 plus 4 bit ... two iterations

$8x - white noise, can use 9-bit

$Ax - square wave

$Cx - saw wave, 2 iterations

 

Three clocks:  64 khz, 15 khz, 1.79 mhz

 

Four filters:

 

Hi pass (2 --> 0, 3 --> 1)

16- bit (0 --> 1, 2 --> 3)

Reverse 16-bit (1 --> 0, 3 --> 2)

Two tone (1 --> 0)

 

So we have tringle, two different saw waves and square wave with fixed duty cycle, right? And if I understood correctly with Two tone method it is possible to get square waves with variable duty cycles. So if we combine square waves with variable duty cycles with pdm https://en.wikipedia.org/wiki/Pulse-density_modulation we should be able to get sine waves as well or am I completely wrong?

 

 

 

660px-Pwm.png

Edited by patjomki

Share this post


Link to post
Share on other sites

Two tone can't get you variable duty cycle. Not with full control. And you certainly can't control duty cycle every period of your high-frequency signal.

And if you are willing to change something every period of your base signal, you can set amplitude directly. It's called soft-synth and it can do sine with no problems. Except it takes all CPU power.

Share this post


Link to post
Share on other sites
50 minutes ago, R0ger said:

Two tone can't get you variable duty cycle. Not with full control. And you certainly can't control duty cycle every period of your high-frequency signal.

And if you are willing to change something every period of your base signal, you can set amplitude directly. It's called soft-synth and it can do sine with no problems. Except it takes all CPU power.

Taking all CPU power is prohibited. 😀

 

So, how can I get variable duty cycle?

 

Or is there a mistake in the wikipedia article?

 

https://en.wikipedia.org/wiki/POKEY#Features

"Per-channel volume, frequency, and waveform (square wave with variable duty cycle or pseudorandom noise)"

 

Share this post


Link to post
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.

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