Tuesday, May 20, 2008

SN76489: The CMH Timing Mechanism (1)

Yes, the title of this post sounds like a device out of Doctor Who.

Previously, I have controlled the SN76489 programmable sound generator (the same / very similar chip to the one found within the VDP of the Sega Master System) using MIDI as well as from Ableton Live. These chips were also found in the BBC Micro and the IBM PCjr.

The concept of this post is not my idea - it was suggested to me[1] by someone that it could be useful to modulate the master clock of a SN76489 to get a wider variety of sounds out of the chip. I have now started going down this road. Previously, I used a 74hc14 inverter as a master clock generator in order to time the SN76489.

No, the timing wasn't perfect, but after producing a data to pitch lookup table for the chip at the particular speed that the 74hc14 was running at, the tuning was actually pretty good. Good enough to use in sequences and other musical applications alongside other instruments which have been properly tuned.

The idea with modulating the master clock is that whatever way the signal is modulated, this will have an effect on the sonic output of the chip, because the frequency at which any of the voices are currently playing at is calculated by dividing this master clock signal.

Of course there are limitations and boundaries to this - for example, the master clock needs to be a pulse wave (or at least, the I assume that the clock input on the chip only recognises two states even if a waveform has more than just two states). Also, lower speeds on the clock line will influence the time it takes to perform a read cycle of data.

The SN76489 is currently sitting in a socket as part of a circuit to easily connect it to an Arduino board. In order to even have access to the clock line I had to de-socket the 74hc14 and solder an extra wire with a jumper connection to the clock pin of the Sn76489.

The relatively fat, white wire is connected to the master clock pin of the SN76489. This jumper can then be easily connected to a breadboard that generates the modulated clock signal (as in the picture below - note that this shows the other side of the SN76489 board).

In this first instance of exploring master clock modulation, the setup was pretty simple. A 4093 quad nand gate was used to generate two signals. The first signal (essentially 'the modulator') was fed into the control input of the second signal (essentially 'the carrier').

Only when the modulator is in a high state will the output of the carrier be active. One pot controls the speed of the modulator, whose frequency range is relatively low compared to the carrier. The other pot controls the speed of the carrier.

When the modulator is in its lowest frequency range, it seems that the SN76489 misses data which is sent to it. A possible solution to this would be to throttle the period of the write cycle
from the Arduino to the Sn76489.

Various interesting things happen when the modulator is swept up and down. Here are a number of audio examples. The noise sweeps use different noise shape settings from each other.

Chord Sweep (my favourite example).
Melody Sweep (featuring all four channels).
Noise Sweep 1 (loud and proud).
Noise Sweep 2 (interesting artefacts).
Noise Sweep 3 (the sweep is subtle).
Noise Sweep 4 (more obvious).
Noise Sweep 5 (more broadband than the previous few sweeps).

There are four main ways in which this idea can and will be extended. First of all, by selecting different types and methods of modulation etc with which to control the master clock.

Secondly, by being able to control the speed of the modulator and/or carrier wave using MIDI. This idea interests me, because it would greatly increase the musicality (whatever that means) by linking the manner of control (ie. host computer running a sequencer) between both the SN76489 and the master clock of the SN76489.

The third and fourth methods I will not go into because they might not be successful. I will try them first and see.

[1] Haines, Christian. Conversation (in person). 14 May 2008.


Jeanne said...

Goodness, there's so much effective info above!