Wednesday, March 04, 2009

Under Clocked SN76489: Let's Change The Duty Cycle!

This is a follow on from a previous post.

Some further experimentation with the under clocked SN76489 revealed that it is possible to change the duty cycle of the sound output without too much effort.

Imagine that we have two periodic waveforms playing, and that they are slightly out of tune with one another. We will hear a phasing effect, because as the two waveforms move from being perfectly in time with one another (ie. peaks and troughs occur for both at the same time) to being completely out of time with one another (ie. while one waveform has a peak, the other has a trough and vice-versa), we hear this continuous phase movement.

Now, imagine that we have two oscillators that have the same waveform and are perfectly in tune with one another. What would happen if we detune one of the oscillators only for a brief moment, only to make it in tune with the other oscillator again? Well, we have effectlively changed the phase relationship between the two oscillators.

The summing at the chip's audio output of the two waveforms that have the same frequency and shape but are out of phase with one another to some extent (not 180˚) will produce different amounts of cancellation and summation, depending on where one waveform is in its cycle in comparison to the other.

I wrote a Max/MSP patch that adjusts the phase of the two oscillators over time. You can listen to what might be the most obvious set of changes here:

Below, you can see the changes in spectrum. The sonogram represents the audio that you can hear in the above audio example:

If you feel like it, you can listen to a full cycle of this discrete changes in phase here (the length is about 5 minutes):

Below, you can see a set of five waveforms taken from throughout the first audio example above:


freezedream said...

Pretty neat that you can actually give the effect of changing the duty cycle using two pulse waves together.