This example uses four different Atari POKEY noise samples as convolution sources. The results are quite interesting. The second video shows the original four trimmed sample files being played back.
Tuesday, October 30, 2012
On Using Atari POKEY Noise Samples as a Convolution Source
This example uses four different Atari POKEY noise samples as convolution sources. The results are quite interesting. The second video shows the original four trimmed sample files being played back.
Wednesday, January 14, 2009
Saturday, January 10, 2009
Atari POKEY Noise Sample Pack
License
This Atari POKEY Noise Sample Pack by Sebastian Tomczak is licensed under a Creative Commons Attribution-Noncommercial 3.0 Unported License. More information about this license can be viewed here: http://creativecommons.org/licenses/by-nc/3.0/
Download
The sample pack can be downloaded here:
Uncompressed Audio (24.1MB):
http://milkcrate.com.au/_other/downloads/sample_sets/little-scale_atari_pokey_noise_sample_pack.zip
Compressed Audio (3.3MB):
http://milkcrate.com.au/_other/downloads/sample_sets/little-scale_atari_pokey_noise_sample_pack_compressed.zip
Overview
I have created a set of samples that have been recorded directly from an Atari POKEY chip. I have created all of the sounds myself on the hardware (as in, these are not sounds or samples recorded from games or demo programs). The output from the sound chip has been recorded directly.
Samples
There are a total of 316 samples, covering a variety of frequencies and noise characteristics. Pure tones are not included.
Audio Format
The uncompressed audio is presented as 16 bit, 44.1KHz mono .wav files. The compressed audio is presented as 96kbps, mono .mp3 files. The audio has been normalised and trimmed, but not compressed nor equalised in any fashion. Fade-outs have been added to each file.
Thursday, January 08, 2009
Atari Multi POKEY MIDI Update
- a better tuning system for 8-bit mode
- a better tuning system for 16-bit mode
- the ability to set the pitchbend in terms of semitones, via MIDI CC
- the ability to set the octave division in terms of discrete pitches per octave, via MIDI CC
- the ability to set the frequency value for any of the four registers via MIDI CC - handy for filter automation etc
You can see a very basic video of Ableton Live controlling one of the POKEY's here:
http://au.youtube.com/watch?v=mpRBQxRk8_k
A 16-bit filter is demonstrated, as well as noise on four channels as well as some cutesy crap.
Tuesday, January 06, 2009
Chiptuning the Atari POKEY
Using Eight Bits
Below you can see the possible frequencies when using a POKEY in 8-bit mode, with a master clock of 1.843200 MHz. The approximate data values and resulting frequencies for the notes going from C2 to G6 are shown. Naturally, the higher the frequency, the lower the resolution. The lower resolution, the more out of tune the oscillator is.
There are four columns in the table below (sorry about the bad layout). 'Note' is the MIDI note number, '12-TET' is the in tune, ideal frequency for each note, 'Result' is the frequency that the POKEY will play for a give note and 'Difference' is the the difference between the in-tune note and the resulting POKEY note.
Note 12-TET Result Difference
48 130.8128 130.61 -2.66
49 138.5913 138.3 -3.7
50 146.8324 146.94 1.25
51 155.5635 155.26 -3.42
52 164.8138 164.57 -2.55
53 174.6141 174.15 -4.61
54 184.9972 184.91 -0.8
55 195.9977 195.92 -0.7
56 207.6523 207.01 -5.38
57 220.0000 219.43 -4.5
58 233.0819 233.43 2.62
59 246.9417 247.48 3.74
60 261.6256 261.22 -2.66
61 277.1826 276.59 -3.7
62 293.6648 293.88 1.25
63 311.1270 310.51 -3.42
64 329.6276 329.14 -2.55
65 349.2282 350.15 4.57
66 369.9944 369.82 -0.8
67 391.9954 391.84 -0.7
68 415.3047 416.64 5.54
69 440.0000 438.86 -4.5
70 466.1638 463.58 -9.62
71 493.8833 491.26 -9.23
72 523.2511 522.45 -2.66
73 554.3653 557.87 10.91
74 587.3295 587.76 1.25
75 622.2540 621.02 -3.42
76 659.2551 658.29 -2.55
77 698.4565 700.3 4.57
78 739.9888 731.43 -20.14
79 783.9909 783.67 -0.7
80 830.6094 822.86 -16.23
81 880.0000 889.58 18.74
82 932.3275 940.41 14.94
83 987.7666 997.4 16.81
84 1046.5023 1061.75 25.04
85 1108.7305 1097.14 -18.19
86 1174.6591 1265.93 129.55
87 1244.5079 1316.57 97.45
88 1318.5102 1496.1 218.76
89 1396.9129 1567.35 199.3
90 1479.9777 1645.71 183.77
91 1567.9817 1732.33 172.57
92 1661.2188 1936.13 265.12
93 1760.0000 2057.14 270.08
94 1864.6550 2194.29 281.81
95 1975.5332 2351.02 301.25
96 2093.0045 2531.87 329.55
97 2217.4610 2742.86 368.12
98 2349.3181 2992.21 418.76
99 2489.0159 3291.43 483.77
We can represent this difference as a table that compares the POKEY's frequencies for each note to the in-tune frequency.

We can also represent the amount that the POKEY is out of tune in terms of cents. For this graph, I have chosen a smaller range of values because the tuning becomes ridiculous as the frequency increases too high (this is measured in cents; 100 cents is equal to one semitone).

When sixteen bit mode is active, the tuning range and resolution increases immensely, allowing the chip to have a reasonable range of approx. eight octaves. The frequencies and their tuning in cents in comparison to 12-TET is shown below.
Note 12-TET Result Difference
1 8.6620 14.06 838.75
2 9.1770 14.06 738.75
3 9.7227 14.06 638.75
4 10.3009 14.06 538.75
5 10.9134 14.06 438.75
6 11.5623 14.06 338.75
7 12.2499 14.06 238.75
8 12.9783 14.06 138.75
9 13.7500 14.06 38.75
10 14.5676 14.57 0.02
11 15.4339 15.43 0.03
12 16.3516 16.35 0.01
13 17.3239 17.32 0
14 18.3540 18.35 0.01
15 19.4454 19.45 0.01
16 20.6017 20.6 0
17 21.8268 21.83 0.02
18 23.1247 23.12 0.02
19 24.4997 24.5 0.04
20 25.9565 25.96 0.02
21 27.5000 27.5 0.04
22 29.1352 29.14 0.04
23 30.8677 30.87 0.03
24 32.7032 32.7 0.04
25 34.6478 34.65 0
26 36.7081 36.71 0.01
27 38.8909 38.89 0.01
28 41.2034 41.2 0
29 43.6535 43.65 0.06
30 46.2493 46.25 0.07
31 48.9994 49 0.04
32 51.9131 51.92 0.07
33 55.0000 55 0.04
34 58.2705 58.27 0.1
35 61.7354 61.74 0.03
36 65.4064 65.41 0.04
37 69.2957 69.3 0.07
38 73.4162 73.42 0.01
39 77.7817 77.79 0.08
40 82.4069 82.41 0.08
41 87.3071 87.31 0.14
42 92.4986 92.5 0.07
43 97.9989 98 0.04
44 103.8262 103.83 0.07
45 110.0000 110 0.04
46 116.5409 116.55 0.21
47 123.4708 123.47 0.03
48 130.8128 130.82 0.04
49 138.5913 138.61 0.2
50 146.8324 146.85 0.15
51 155.5635 155.57 0.08
52 164.8138 164.84 0.24
53 174.6141 174.64 0.3
54 184.9972 185.02 0.24
55 195.9977 196 0.04
56 207.6523 207.66 0.07
57 220.0000 220 0.04
58 233.0819 233.14 0.43
59 246.9417 246.95 0.03
60 261.6256 261.67 0.29
61 277.1826 277.26 0.46
62 293.6648 293.69 0.15
63 311.1270 311.14 0.08
64 329.6276 329.73 0.55
65 349.2282 349.36 0.63
66 369.9944 370.12 0.59
67 391.9954 392 0.04
68 415.3047 415.32 0.07
69 440.0000 440.11 0.45
70 466.1638 466.4 0.87
71 493.8833 493.89 0.03
72 523.2511 523.34 0.29
73 554.3653 554.51 0.46
74 587.3295 587.38 0.15
75 622.2540 622.28 0.08
76 659.2551 659.7 1.17
77 698.4565 698.71 0.63
78 739.9888 740.24 0.59
79 783.9909 784.34 0.77
80 830.6094 831.02 0.85
81 880.0000 880.23 0.45
82 932.3275 932.79 0.87
83 987.7666 987.78 0.03
84 1046.5023 1047.27 1.27
85 1108.7305 1109.03 0.46
86 1174.6591 1175.51 1.25
87 1244.5079 1245.41 1.25
88 1318.5102 1320.34 2.41
89 1396.9129 1398.48 1.94
90 1479.9777 1481.67 1.98
91 1567.9817 1570.02 2.25
92 1661.2188 1663.54 2.42
93 1760.0000 1762.14 2.11
94 1864.6550 1865.59 0.87
95 1975.5332 1977.68 1.88
96 2093.0045 2094.55 1.27
97 2217.4610 2220.72 2.54
98 2349.3181 2351.02 1.25
99 2489.0159 2490.81 1.25
100 2637.0205 2640.69 2.41
101 2793.8259 2801.22 4.57
102 2959.9554 2963.34 1.98
103 3135.9635 3145.39 5.2
104 3322.4376 3327.08 2.42
105 3520.0000 3531.03 5.42
106 3729.3101 3731.17 0.87
107 3951.0664 3955.36 1.88
108 4186.0090 4189.09 1.27
109 4434.9221 4452.17 6.72
110 4698.6363 4702.04 1.25
111 4978.0317 4981.62 1.25
112 5274.0409 5296.55 7.37
113 5587.6517 5619.51 9.84
114 5919.9108 5945.81 7.56
115 6271.9270 6312.33 11.12
116 6644.8752 6678.26 8.68
117 7040.0000 7089.23 12.06
118 7458.6202 7492.68 7.89
119 7902.1328 7944.83 9.33
120 8372.0181 8378.18 1.27
121 8869.8442 8947.57 15.11
122 9397.2726 9404.08 1.25
123 9956.0635 10017.39 10.63
124 10548.0818 10593.1 7.37
125 11175.3034 11239.02 9.84
126 11839.8215 11968.83 18.76
127 12543.8540 12624.66 11.12
Once again, we can show the pitch versus the ideal pitch as note against frequency. Notice how the 12-TET line completely obscures the resultant frequency line - this is becasue the Atari POKEY is now much more in tune than if we were using eight bits of data!!

We can also show the tuning of each note in cents. The following graph shows the range from MIDI note 10 to MIDI note 110, a huge pitch range. The POKEY is much more in tune.
Saturday, January 03, 2009
Go Go Atari! DualPOKEY MIDI

Current features include:
• Control up to all 16 channels of up to 4 POKEY chips via MIDI
• POKEY 1 appears on channels 1 to 4
• POKEY 2 appears on channels 5 to 8
• POKEY 3 appears on channels 9 to 12
• POKEY 4 appears on channels 13 to 16
• Select the distortion / noise for each voice (set via MIDI CC)
• For each chip, clock it using 15.3 Khz instead of 65.8 Khz (set via MIDI CC)
• For each chip, use ch 2 as a high pass filter, clocked by ch 4 (set via MIDI CC)
• For each chip, use ch 1 as a high pass filter, clocked by ch 3 (set via MIDI CC)
• For each chip, use channels 3 and 4 together in 16-bit mode (set via MIDI CC)
• For each chip, use channels 1 and 2 together in 16-bit mode (set via MIDI CC)
• The 16-bit mode increases the frequency resolution and range of the ganged channels of the chip.
• For each chip, clock channel 3 using 1.8432MHz instead of 65.8 Khz (set via MIDI CC)
• For each chip, clock channel 1 using 1.8432MHz instead of 65.8 Khz (set via MIDI CC)
• For each chip, use 9 bit poly for noise instead of 17 bit poly (set via MIDI CC)
Saturday, January 26, 2008
Soft MIDI Pokey
The Pokey chip is a forty pin IC whose main functions include read keys and analog sensors, outputting serial data and generating audio. The audio section of the chip includes four oscillators which can operate in a number of modes which make it quite versatile (and it sounds great!)
Information on how to control the Pokey chip (ie. registers and functions) comes from a document by Bryan Edewaard. This project would obviously not be possible without fantastic work such as this!
The way that data is read or written to the chip is by the control of four address lines (A0 to A3, that control the register being written to or read from) and eight data lines (D0 to D7, that control the information that is sent to or retrieved from the chip).
Since we are interested in sound generation, let's focus on the relevant registers.
Registers 00 to 08 are responsible for all sounds that this chip can produce.
Registers 00 (0000), 02 (0010), 04 (0100) and 06 (0110) control the frequency of the four voices. The value is between 0 and 255 (00000000 and 11111111 in binary, where each bit represents one of the eight data lines).
Registers 01 (0001), 03 (0011), 05 (0101) and 07 (0111) control the timbral and volume aspects of each voice. The three most significant bits (xxx00000) control the timbre (whether the tone is a 'pure' square wave-type sound or has distortion of some sort).Bit four (000x0000) is used in digital to analog conversion, and should not be set to high for audio generation normally. Bits 0 to 3 (0000xxxx) set the volume of that voice.
Register 08 (1000) sets 'global' parameters that effect the way in which audio is generated. Here is the overview of each bit:
• Bit 7: Changes the type of noise
• Bit 6: Use the undivided clock to time voice 1
• Bit 5: Use the undivided clock to time voice 3
• Bit 4: Combine the frequency registers for voices 1 and 2, creating a single 16-bit oscillator
• Bit 3: Combine the frequency registers for voices 3 and 4, creating a single 16-bit oscillator
• Bit 2: Voice 1 is in high pass mode, set frequency with voice 2
• Bit 1: Voice 3 is in high pass mode, set frequency with voice 4
• Bit 0: Use a divide-by-120 clock or a divide-by-28 clock
So, in order to write data to the Pokey, at least 12 separate digital output lines are required in a circuit.
Updated Circuit and Code
I have been improving the method of controlling the Pokey chip. The improvements i have made are based almost completely on a schematic by Michael Hill. Without people like him, such projects would not be possible also!
I have adapted the schematic to suite the Arduino board. The code has also been re-written to accommodate for the extra chips. The Max/MSP patch now incorporates real-time MIDI controller (hence the title of this post -- the MIDI control is done in the host computer software, not embedded hardware).
The new circuit (thanks to Michael Hill for posting his design) employs two octal flip flops. In my case, i have used a pair of 74hc374 because this IC was readily available. The chip is named "octal edge triggered d-type flip flops with three state outputs". Basically, it consists of eight separate flip flop functions. A flip flop is an electronic device or circuit that changes its binary (ie. either high or low) output (Q) to match the state of the input (D) only when it is triggered by a clock signal (C).
We can say that a flip flop stores a single bit of memory, because unless the flip flop is actually triggered, the output will remain the same regardless of the input. When the flip flop is triggered, the output will be updated to reflect the input.The 374 IC is "edge triggered". Thus, the output (Q) is only updated to match the input state (D) when the clock signal (C) makes a transition from low to high. It follows that if the clock signal is either high or low, but not moving from a low to a high state, the output (Q) will not change (and will stay the same as when the output was last triggered). It should be noted that ll eight flip flops on the 374 share the same clock signal (that is, they all update at the same time).

The circuit makes use of this function by first clocking out the four bits required to set an address for a register of the Pokey to one of the 74hc374s and then clocking out the eight bits of data to the second 74hc374. The two 74hc374 have separate clocks. Then, the Pokey's chip select line is enabled and thus the data is written to the Pokey.The basic principle of writing data to the chip is as follows:
• For each change, two bytes are sent from the host computer to the Arduino at a baud rate of 57600.
• The first byte that is sent is a number between 0 and 8, signifying the register to write data to.
• The second byte that sent is a number between 0 and 255, signifying the data to write into the previously selected register.
• First, the eight data lines are set the register byte. Then, the '374 that is connected to the register lines is pulsed so that the outputs of the IC set the correct register at the Pokey. However, because the other '374 is not strobed, the data lines are left unchanged.
• Next, the eight data lines are set to the data byte.
• The twelve LED's show the current register and data bytes. Then, the '374 that is connected to the data lines is pulsed so that the outputs of the IC set the correct data value at the Pokey.
• Finally, the chip select line actually writes allows the Pokey to read the data that has been sent to it.
MIDI Mapping
The Pokey chip is controlled by MIDI via a Max/MSP patch in the following way:
• Pitch is scaled from 0 to 127 to 0 to 255 and is mapped to frequency for channels 1 to 4
• MIDI CC#2 is scaled from 0 to 127 to 0 to 15 and is mapped to volume for channels 1 to 4
• MIDI CC#1 is scaled from 0 to 127 to 0 7 and is mapped to tone for channels 1 to 4
• MIDI CC#27 is scaled from 0 to 127 to a toggled state (on or off) for distortion type
• MIDI CC#26 is scaled from 0 to 127 to a toggled state (on or off) for undiv. clock voice 1
• MIDI CC#25 is scaled from 0 to 127 to a toggled state (on or off) for undiv. clock voice 3
• MIDI CC#24 is scaled from 0 to 127 to a toggled state (on or off) for 16 bit mode voices 1 and 2
• MIDI CC#23 is scaled from 0 to 127 to a toggled state (on or off) for 16 bit mode voices 3 and 4
• MIDI CC#22 is scaled from 0 to 127 to a toggled state (on or off) for high pass mode voice 1
• MIDI CC#21 is scaled from 0 to 127 to a toggled state (on or off) for high pass mode voice 3
• MIDI CC#20 is scaled from 0 to 127 to a toggled state (on or off) for clock div. 120 or div. 28

Schematic

Breadboard




Code
/*
Soft MIDI Controlled Pokey Chip
by Sebastian Tomczak
26 January 2007
*/
// Pokey Pins
int pokeyCS0 = 12; // chip select
// 74HC374 Pins
int addressClock = 10;
int dataClock = 11;
// d0 to d7 are on pins 2 - 9
// a0 to a3 are on pins 2 - 5
int strobe_wait = 100;
byte registerP;
byte dataP;
void writePortByte(byte PortByte) {
PORTD = PortByte << 2;
PORTB = PortByte >> 6 | B00010000; // OR pin 12 high because of CS0 inverse logic
}
void setup() {
Serial.begin(57600);
DDRD = DDRD | B11111110;
DDRB = DDRB | B00111111;
digitalWrite(pokeyCS0, HIGH); // CS0 has inverse logic (active low)
digitalWrite(addressClock, LOW);
digitalWrite(dataClock, LOW);
}
void loop() {
if(Serial.available() > 1) {
registerP = Serial.read();
dataP = Serial.read();
writePortByte(registerP);
digitalWrite(addressClock, HIGH);
delayMicroseconds(strobe_wait);
writePortByte(dataP);
digitalWrite(dataClock, HIGH);
delayMicroseconds(strobe_wait);
digitalWrite(pokeyCS0, LOW);
delayMicroseconds(strobe_wait);
digitalWrite(pokeyCS0, HIGH);
digitalWrite(dataClock, LOW);
digitalWrite(addressClock, LOW);
}
}
Thursday, January 24, 2008
Pokey: nested 'for' statements

An Atari Pokey sound chip is controlled directly via bus and data lines from an Arduino using three nested 'FOR' statements.
The results are much more complex (and musically interesting) than the code would lead one to believe - a minimalist / maximalist approach.
URL: http://youtube.com/watch?v=aRCPOhP-V7M
Saturday, January 19, 2008
Adventures with Pokey


I am managing to control the sounds of the Pokey chip a little bit more. The main problem that i was having initially was that the fact that the chips seems to reset the channel registers when the master audio control register had been updated. This took some time to track down (it didn't seem like obvious behaviour to me).
So. The first example is the Pokey being controlled through the Arduino using Max/MSP in a sequencer-like fashion.
Download the riff: http://milkcrate.com.au/_other/downloads/mp3s/pokey_sequenced.mp3
I am very happy with these initial results, and feel that this chip warrants further creative exploration.
Demo video: http://www.youtube.com/watch?v=Gc3HexrFpsQ
"Controlling an Atari Pokey chip with an Arduino board using Max/MSP. This is an initial test of a pair of oscillators in one of the combined modes.
The master clock is generated by a 74HC14, so it is a variable clock making for a larger range of frequencies. "
Schematic:

With the audio examples above i didn't use use the data line D-0 (least significant bit). In the schematic, Arduino pin 12 (labeled 13 on the diagram) is connected to D0. The reason is that in the Arduino code, i simply set PORTD (Arduino pins 7 to 0) to the incoming serial data byte, and connected Pokey lines D7 - D1 to Arduino pins 7 to 1.
However, since Arduino pin 0 is used as the host computer to Arduino serial RX pin, the lowest bit / pin of the Pokey is not set. Th data itself coming from the computer was from 0 - 127 and then simply left-shifted by one bit place (to give the even numbers from 0 to 255, thereby ignoring pin 0 of the Arduino / Pokey setup).


