SN76489 clock frequency?

Discuss the CreatiVision hardware: models, revisions, fixing, hacking and modding.
Post Reply
User avatar
carlsson
Posts: 502
Joined: Fri Jun 13, 2008 7:39 am
Location: Västerås, Sweden

SN76489 clock frequency?

Post by carlsson » Thu Sep 13, 2012 7:15 am

On this page, one can read about the upcoming Super Game Module for the CBS ColecoVision. While it would require the very rare expansion module to run ColecoVision games on a Creativision, I imagine the two systems have plenty in common except the CPU, ROM and connectors.

http://www.colecovision.dk/sem.htm

What strikes me is the passage about the SN76489 in the ColecoVision, which is superceded by a AY-3-8910 in the Super Game Module in order to play MSX music and sounds as intended. I can't recall if the Sega SG-1000 uses SN or AY, but I seem to remember the Sord M5 uses SN (among a number of other, far less similar systems).
When ColecoVision was launched in U.S. in 1982, was it an early "unfinished" MSX-based machine. Right after came the first "finished" SpectraVideo 318 and the successor MSX1. So practically all these "finished" MSX games from the 80's can now be translated back to ColecoVision with very few changes. And that's also include the games from Sega SG-1000.

But the sound chip and the RAM were not the same, and here comes the new Super Game Module. The top sound is coming from the more sophisticated sound chip: AY-3-8910, the same used with almost all MSX computers and many other computers and arcade machines from the 80s. The AY-3-8910 is a step forward from Coleco's own sound chip, namely SN 76489.

The people who created the ColecoVision made a bad mistake with the CV PSG. The CV PSG isn’t bad at all, but they clocked it too high. Because of that, we are limited to frequencies above 110 Hz, which means, that deep bass sounds can not be produced by the CV.

So that is why the Space Invaders Collection marching sound in SIC isn’t as deep as you remembered it, or some music stuff sounds so “high” in the frequency range. The new PSG corrects that, and goes beyond what the Texas CV PSG can do, with volume envelope and better noise generator. The AY helps by offering a wider frequency range and by increasing the total number of channels available.

Additionally both PSGs can be used simultaneously, and all sound is routed to the RF output. (A/V mods can still work if the sound source is taken from the output of the sound mix, just before the RF input).
Although I haven't investigated, does the Creativision also suffer from a SN76489 clocked too high so the really low notes can't be hit? I know the Commodore 16 and Plus/4 TED has a lower limit at 110 Hz, which is a bummer for musicians as A-1 isn't a particularly low note. Or maybe VTech did it right? Other SN-based machines could be used for comparison, if now the chip itself can produce lower notes given a lower input frequency.
User avatar
MADrigal
Site Admin
Posts: 973
Joined: Sun Sep 15, 2013 1:00 pm
Contact:

Re: SN76489 clock frequency?

Post by MADrigal » Sun Sep 16, 2012 3:25 pm

Sadly I have no such tech knowledge to answer your questions

By the way, this forthcoming interface for the ColecoVision looks really promising!
User avatar
carlsson
Posts: 502
Joined: Fri Jun 13, 2008 7:39 am
Location: Västerås, Sweden

Re: SN76489 clock frequency?

Post by carlsson » Tue Oct 02, 2012 9:37 am

Indeed both Sega and Sord used SN76489 initially. It raises the same question about those Z80 based systems, if they clock the PSG at the desired frequency to generate a lower range of notes than the ColecoVision is claimed to do. I suppose to some part it could be investigated through Basic, just trying to play the lowest note possible and see which frequency it is. It doesn't take a lot of music skill to differ 110 Hz from e.g. 55 Hz (one octave lower), and usually Basic wouldn't impose a limitation in those terms compared to what you can do from machine code. However I have a faint memory reading that the TI-99/4A also has a lower end at 110 Hz, so perhaps it was common in order to not keep separate clocks or have a CPU running more dog slow than possible.
Wikipedia wrote:The frequency of the square waves produced at each channel is derived by two factors: the speed of the external clock and a value provided in a control register for that channel (called N). Each channel's frequency is arrived at by dividing the clock by 32 and then dividing the result by N.
On John Kortink's site (BBC B related), it says "if the external clock is 4 MHz and N is 25, the square wave is 5000 Hz". On the SMS Power site, there are some more examples using a 3.58 MHz PAL clock. It says the lowest possible note, using N = $3FF is 109 Hz with a 3.58 MHz clock. The highest possible note is 111861 Hz but it won't be audiable even to bats due to how the audio is mangled on its way from the chip to the audio output. The highest playable note on the SMS is 18643 Hz, an effective range of 10 octaves.

It seems to me that Coleco had no other choice unless they'd divide the PAL clock by two. It also seems Sega's various machines, and most probably Sord M5 too will have the same musical limitation. However the Creativision runs at 2 MHz, so I don't know if a 3.58 MHz PAL clock is in play there as well or if the generated audio rather will depend on the CPU clock. If that is so, its SN76489 would produce lower notes than all its Z80 based siblings.
User avatar
carlsson
Posts: 502
Joined: Fri Jun 13, 2008 7:39 am
Location: Västerås, Sweden

Re: SN76489 clock frequency?

Post by carlsson » Fri Oct 05, 2012 8:58 am

Hm. I saw that the VTech Laser 2001 entry on Old-Computers says its lowest frequency is 245 Hz. That one is also clocked at 2 MHz 6502. While information on that site shouldn't be considered carved in stone, it should have some legitimity to include a number. As you realize, 245 is more than twice as high as 110 which should indicate at least the 2001 and perhaps even Creativision have even bigger troubles hitting the bass notes than the Z80 computers. Actually I thought the otherwise might be true... hm, methinks I should investigate and try it some day.

The question then is if you were to get a different sound chip with the Creativision, what would you aim for? AY, SID, FM/OPL, something even newer? Would you even think the sound needs to be improved, compared to all the other parts of the console hardware?
User avatar
MADrigal
Site Admin
Posts: 973
Joined: Sun Sep 15, 2013 1:00 pm
Contact:

Re: SN76489 clock frequency?

Post by MADrigal » Tue Oct 16, 2012 4:43 pm

There's many informations on the SN76489 here:

http://www.smspower.org/Development/SN7 ... 2af56807f1

Quoting:
Tone range

The lowest possible tone, using register value $3ff, is 109Hz (assuming an input clock of 3579545Hz), which corresponds to MIDI note A2 -10 cents.

The highest possible tone, using register value $001, is 111861Hz, which corresponds to MIDI note D10 -14 cents. However, in practice, smoothing capacitors and other, perhaps less deliberate, imperfections in the output mean that such a high note is not audible; in tests on an SMS2, the highest note that gave any audible output was register value $006, giving frequency 18643Hz (MIDI note A12 -12 cents). Thus, there is effectively a range of 10 octaves.
Edit: whops, just noticed it's the same webpage you linked already. I suggest you to peek into the official TI Datasheets.
User avatar
carlsson
Posts: 502
Joined: Fri Jun 13, 2008 7:39 am
Location: Västerås, Sweden

Re: SN76489 clock frequency?

Post by carlsson » Tue Oct 23, 2012 1:27 pm

Yes, the case in point is the input clock frequency. Apparently the Z80 systems feed the CPU clock frequency 3.58 MHz which happens to be the PAL (or is it NTSC?) display frequency too, or whatever it is called.

It leaves us with at least two "oddballs" which use the same or variants of the chip:

TI-99/4A: TMS-9900 @ 3.0 MHz, sound from TMS9919 (SN94624) identical to SN76489.
According to Wikipedia, it generates sound from 110 Hz to 115 kHz. It seems logical, as 3.0 MHz is not far from 3.58 MHz. Perhaps I'd expect the range slightly lower.

Creativision & Laser 2001: 6502 @ 2.0 MHz.
According to Old-Computers, they generate sound from 245 Hz and upwards, but so far it is an unverified statement.

If the SN76489 independent of input clock has a lower limit at 110 Hz, the claim on the ColecoVision page is partly false as Coleco then had no other option to implement the sound chip for a different range of sounds.

It strikes me that the SN76489 is used in the BBC Micro too, which also is a 2 MHz 6502. I've got a couple of those as well, and there should be documentation enough about its musical range. Furthermore it is found in IBM PCjr which has a 4.77 MHz 8088, so the relation between input clock and frequency range should be possible to look up.

This page claims the BBC Micro from Basic (!) can produce 256 different notes from A#1 to D-7.
http://8bs.com/othrdnld/manuals/musicma ... _mm_01.htm

It seems to me the chip has 12 bit frequency resolution, but perhaps they omitted the top four bits as those sounds are inaudiable anyway. If the middle C-3 (value 53) has an actual frequency of 261.625 Hz, one octave lower C-2 is 130.812 Hz and the A#1 probably clocks in around the same 109-110 Hz as already diagnosed. Thus I'm leaning towards the fact that either all of these systems feed the exact same clock to the SN76489, or it really doesn't matter, it can't produce lower notes than so no matter the system.

Hm, this page actually already says it:
The SN76489 is connected to a clock signal, which is commonly 3579545Hz for NTSC systems and 3546893Hz for PAL/SECAM systems (these are based on the associated TV colour subcarrier frequencies, and are common master clock speeds for many systems). It divides this clock by 16 to get its internal clock. The datasheets specify a maximum of 4MHz.
http://www.smspower.org/Development/SN76489

It only leaves me with one more question: would it be possible and meaningful for those systems that apparently have at least two clocks in range to feed something else than the NTSC/PAL colour frequiences to the sound chip? In this case the 6502 based systems.
User avatar
carlsson
Posts: 502
Joined: Fri Jun 13, 2008 7:39 am
Location: Västerås, Sweden

Re: SN76489 clock frequency?

Post by carlsson » Mon Feb 04, 2013 11:11 pm

Hm, I just found this comment by Kurt in the Titanic demo:
The sound generator is clocked at 2 MHz, which means that the lowest achievable frequency should be 2000000/1023/32 = 61,09 Hz. The note scale I used starts at this frequency and goes up by one half-tone each step. Actually, this isn't properly "tuned"... the frequency of 61,09 HZ ist about 18 cents unter a "B". See more on that below in the note table.

Note: it's possible to get even lower frequencies by setting channel 3 to output "periodic noise" at the frequency of channel 2, which actually makes it output a square wave with a 1/15 duty cycle at a frequency that's 1/15 of the "normal" channel 2 frequency, which is a bit under 4 octaves lower. However, I don't use this trick here, but I did use it in a TI-99 game to give a "punchy" bass line.
User avatar
carlsson
Posts: 502
Joined: Fri Jun 13, 2008 7:39 am
Location: Västerås, Sweden

Re: SN76489 clock frequency?

Post by carlsson » Sun Feb 17, 2013 1:47 am

Tonight I have invented a program to study the white noise and "periodic" noise, also known as duty cycle. I have used this document to base my program on.

What it does is to produce noise and/or play notes using either Tone 2 or the duty cycle of the noise register. It is worth noticing that while the tone registers of 76489 mostly seem to output square waves (pulse), the sound generated by setting the noise register to duty cycle seems rather more sawtooth, or at least a much more narrow pulse wave. This is based on how sound is generated in FunnyMu though.

You can download the binary here:
sound.zip
Keys that set the noise register to duty cycle
Z, C, B = value counter fixed at $10
A, D, G = value counter fixed at $20
Q, E, T = value counter fixed at $40
2, 4, 6 = value counter to frequency of Tone 2

Keys that set the noise register to white noise
X, V = value counter fixed at $10
S, F = value counter fixed at $20
W, R = value counter fixed at $40
3, 5 = value counter to frequency of Tone 2

Keys that change the volume of Tone 2 and the noise register
O = Decrease noise volume
P = Increase noise volume
K = Decrease Tone 2 volume
L = Increase Tone 2 volume

The volume displayed on screen is 15 - register volume, due to the SN76489 uses xxxx1111 for silence and xxxx0000 for maximum volume, and it might be confusing for the user to see that the value increases as the volume decreases.

Right joystick (Player 1 ??) movements that alter the Tone 2 frequency
Up = Increase low 4 bits of the frequency register
Down = Decrease low 4 bits of the frequency register
Right = Increase top 8 bits of the frequency register
Left = Decrease top 8 bits of the frequency register

The frequency values displayed are the same as feed to the Tone 2 register. It means $3F $0F = $03FF = lowest possible note and $0000 = highest possible note (actually it is said to be $0001).

The result is that if we silence Tone 2 and use the duty cycle mode, just like Kurt mentioned we get very low bass notes, although in a different kind of waveform. I believe that by alternating the noise register between duty cycle and white noise, we could use the same channel to handle both bass & drums, given that not both are played at the same time of course. It leaves Tone 0 and Tone 1 for regular music down to 110 Hz or if it really is 61 Hz on the CreatiVision.
You do not have the required permissions to view the files attached to this post.
User avatar
MADrigal
Site Admin
Posts: 973
Joined: Sun Sep 15, 2013 1:00 pm
Contact:

Re: SN76489 clock frequency?

Post by MADrigal » Sun Feb 17, 2013 10:45 am

I tested the program and hey it works great! Not as good as "Music Maker" though hahaha (kidding!)

Seriously speaking, it's a superb program! :-)
User avatar
Mobsie
Posts: 476
Joined: Fri Jun 13, 2008 10:38 am
Location: Weinheim, Germany

Re: SN76489 clock frequency?

Post by Mobsie » Sun Jun 02, 2013 7:52 am

Hi Carlson, is nice your Sound App. I like that way to play with the chip.
6 month ago i have order one SGM (the Super Game Module for the CBS ColecoVision).
Last week i got it, they did a great job. The hardware and also the manual and box are great.
But i have not time to test because i really enjoy to dev. for the CreatiVision.
Post Reply