Jump to content
IGNORED

Questions About the Sound Capability of the Atari 2600


Captain Jack

Recommended Posts

Hi! I've been working on a video that chronicles the development of video game console sound capabilities, I had a few questions regarding the Atari 2600 as the documentation on its audio hardware is much harder to come by than, say, the SNES. I thought who better to ask than people who actually make Atari games. All I know at this point it that the TIA generates "two channels of one-bit sound. Each channel provides for 32 pitch values and 16 possible bit sequences. There is a 4 bit volume control." (Wikipedia) 

 

From this available info I have a few questions:

 

Because it has "32 pitch values" this means it can play 32 different "notes" correct?

 

If it has "two channels of one-bit sound" why do games like Pitfall 2 have music? I heard about extra chips?

 

Later on in the Wikipedia Article for the TIA it states that the Atari can generate "pulse and noise output" is that any similar to the pulse and noise channels the NES has? (I'm guessing so). 

 

And lastly, why are is so much of the music found in Atari games completely out of tune? 

 

 

Thanks in advance, even if you only know a moderate amount of information about the subject I would appreciate an attempted answer, the video I am making is for a general viewer who isn't particularly tech savvy so I will be simplifying it anyway. I've also been reading Racing The Beam looking for possible answers. Not a programmer in the slightest.

Link to comment
Share on other sites

I'm not really an expert, but I'm up late at night avoiding the work i should be doing so I'll give this a shot!

41 minutes ago, Captain Jack said:

 

Because it has "32 pitch values" this means it can play 32 different "notes" correct?

 

Yes, that's right.

43 minutes ago, Captain Jack said:

If it has "two channels of one-bit sound" why do games like Pitfall 2 have music? I heard about extra chips?

Yes, Pitfall 2 had a custom chip called the DPC so it could do fancier audio.

45 minutes ago, Captain Jack said:

Later on in the Wikipedia Article for the TIA it states that the Atari can generate "pulse and noise output" is that any similar to the pulse and noise channels the NES has? (I'm guessing so). 

Not sure about NES, but yeah, the 2600 can do different tones (pure tone, square wave, white noise etc).  I think there are 16 of them... though some of them may be duplicates? Uh... maybe someone else can step in and explain that in more detail. I'm still learning this stuff.

Anyway, you can also change the volume.

 

So it's... two channels, each with registers for volume (values 0-15), pitch (values 0-31), and tone (values 0-15). That's basically what you're working with, audio wise.

50 minutes ago, Captain Jack said:

And lastly, why are is so much of the music found in Atari games completely out of tune? 

The available pitches just don't perfectly align with the notes on a keyboard. So people do the best they can with what they have (except for Pitfall 2, which can do more).

Link to comment
Share on other sites

2 hours ago, somebooks said:
3 hours ago, Captain Jack said:

Because it has "32 pitch values" this means it can play 32 different "notes" correct?

 

Yes, that's right.

I wouldn't call them "notes". It's just a base frequency divided by 1..32. And some of the dividers just happen to be close to real notes.

  • Like 1
Link to comment
Share on other sites

3 hours ago, Captain Jack said:

If it has "two channels of one-bit sound" why do games like Pitfall 2 have music? I heard about extra chips?

More accurately, I would say it has two channels of 4-bit sound. The 4 bits refers to the resolution of the volume registers. By varying the volume very quickly you can essentially shape the sound waveform into new sounds.

 

The DPC chip basically spits out numbers, it doesn't directly generate sound. The programmer reads the DPC chip and stores the number to a volume register on the 2600 by the code, and you generally have to do this on every scanline (so it makes for somewhat difficult programming!) The numbers are calculated by the chip so that when stored to the volume register, they create a composite waveform of three (square wave) voices.

 

  • Like 2
Link to comment
Share on other sites

21 hours ago, Captain Jack said:

Because it has "32 pitch values" this means it can play 32 different "notes" correct?

 

It has 32 pitch settings.

 

It also has multiple "distortion" settings, each of which provides a mapping from pitch setting to generated frequency. I have not calculated the exact number of unique frequencies, but it is much greater than 32 (but not all of them are musically useful together).

Link to comment
Share on other sites

I'm no expert, but Atari has two sound channels, one tone, and one noise. It was designed to basically beep and fart and that's about it. Of course, skilled people can get it to sing still, like you mentioned, pitfall 2. If your not opposed to trying weirder newer stuff, look up marble craze, which has five different amazing (imo) tunes.

 

It's clever trickery, the extra chip in pitfall doesn't actually make music, it actually keeps time, so the console doesn't have to. Most games use refreshing a scanline as timing for music and sound effects, though tracking this actually does eat some of the ataris limited ram and clock cycles.

 

While it sound awesome, it's also reliant on human perception of sound. If you listen carefully, pitfall doesn't ever play more than two sounds at once, you can even hear the drum line switch off when the system plays an effect (jumping, collecting items, hitting checkpoints)

Link to comment
Share on other sites

1 hour ago, Video said:

I'm no expert, but Atari has two sound channels, one tone, and one noise.

That's not correct, both channels are 100% identical.

 

1 hour ago, Video said:

It's clever trickery, the extra chip in pitfall doesn't actually make music, it actually keeps time, so the console doesn't have to.

Actually the DPC fills a queue with data for the CPU at a given speed. In case of Pitfall 2 this is sound data. The CPU then simply reads the next byte from the queue using a fixed address. So it doesn't have to care e.g. about addressing the data.

  • Like 1
Link to comment
Share on other sites

MiniDig has links to useful Atari 2600 information, such as Eckhard Stolberg's Frequency/Waveform Guide in the Docs section.

 

The page it links to is gone, but you can use Wayback Machine to retrieve it.

 

http://web.archive.org/web/20161018144537/http://home.arcor.de/estolberg/texts/freqform.txt

 

I copied the contents into TextEdit on my Mac. If you're on Windows the formatting of the tables might be messed up if you open with Notepad, if so try using WordPad.

 

freqform.txt

Link to comment
Share on other sites

2 hours ago, Jstick said:

@Captain Jack You might also want to check out the "Berzerk VE" hack which adds speech to the game on regular hardware.

 

As does Quadrun. Really you can play *anything* given enough ROM and CPU cycles. Note that these two games only play their samples while the screen is completely blank.

Link to comment
Share on other sites

13 hours ago, SpiceWare said:

MiniDig has links to useful Atari 2600 information, such as Eckhard Stolberg's Frequency/Waveform Guide in the Docs section.

 

The page it links to is gone, but you can use Wayback Machine to retrieve it.

 

http://web.archive.org/web/20161018144537/http://home.arcor.de/estolberg/texts/freqform.txt

 

I copied the contents into TextEdit on my Mac. If you're on Windows the formatting of the tables might be messed up if you open with Notepad, if so try using WordPad.

 

freqform.txt 19.07 kB · 1 download

Ill check that out. You made the legendary Medieval Mayhem? Really!?

Link to comment
Share on other sites

25 minutes ago, Deteacher said:

I would love it if someone could expand on the last question as to why the music was out of tune.  I was a music teacher for 20+ years and I always wondered why the pitches couldn't be tuned to a 12-pitch chromatic scale.

I tried to answer this in my first reply. 

 

You only have a base frequency which is then divided by 1, 2, 3, .. 32. The result is usually not a real note, but just a frequency which may or may not be close to a real note.

  • Like 1
Link to comment
Share on other sites

7 hours ago, Deteacher said:

I would love it if someone could expand on the last question as to why the music was out of tune.  I was a music teacher for 20+ years and I always wondered why the pitches couldn't be tuned to a 12-pitch chromatic scale.

Thomas addressed this, but I will give a more detailed answer. The main reason that DPC (and, for that matter, the TIA) isn't aligned to music notes is because it only has 8-bit granularity. It uses an 8-bit divisor with a base frequency of 20 kHz. The formula is something like F=20000 Hz/X where X=1 to 255.

 

This is easy to implement in hardware. Just need the frequency clocked into a binary counter with a match register. Unfortunately, if you graph F vs. X, it makes for a steep curve at the low end that flattens out quickly and doesn't match as many music notes as it seems it should.

 

(The reason is because when you graph the music notes, the curve is far more gentle than this.)

 

DPC+, on the other hand, uses an alternative way of generating notes. The formula is F=(X/b)*20000 Hz, with b being the granularity (e.g., 8 bits would be 2^8, 32 bits would be 2^32.) If this were done in hardware, the method would be an adder circuit clocked at 20 kHz, with the carry of the adder circuit being the output frequency.

 

The benefit of doing a sound circuit this way is the graph of F vs. X is a straight line! It's also not that much more difficult to do in hardware, if you were to (of course, this is done in ARM code on DPC+.)

 

In addition, DPC+ uses a 32-bit value, which allows for a very high level of granularity. Because of this, you can represent all of the music notes accurately.

  • Like 2
Link to comment
Share on other sites

12 hours ago, batari said:

Thomas addressed this, but I will give a more detailed answer. The main reason that DPC (and, for that matter, the TIA) isn't aligned to music notes is because it only has 8-bit granularity. It uses an 8-bit divisor with a base frequency of 20 kHz. The formula is something like F=20000 Hz/X where X=1 to 255.

 

...

 

DPC+, on the other hand, uses an alternative way of generating notes. The formula is F=(X/b)*20000 Hz, with b being the granularity (e.g., 8 bits would be 2^8, 32 bits would be 2^32.) If this were done in hardware, the method would be an adder circuit clocked at 20 kHz, with the carry of the adder circuit being the output frequency.

 

The benefit of doing a sound circuit this way is the graph of F vs. X is a straight line! It's also not that much more difficult to do in hardware, if you were to (of course, this is done in ARM code on DPC+.)

 

In addition, DPC+ uses a 32-bit value, which allows for a very high level of granularity. Because of this, you can represent all of the music notes accurately.

 

TIA frequency dividers are 5-bit. Changing the distortion setting effectively provides a few different base frequencies, but still not 8 bits worth of values.

 

Frequency division works fairly well at 8 bits (e.g. POKEY in 4-channel mode) and very well with 10+ bits (SN76489, AY-3, POKEY in 2-channel mode, NES).

 

A straight line is not ideal, because musical notes occur on exponentially increasing frequencies. Adder circuit generators are relatively good (granular) at the treble end and relatively bad at the bass end of their range, the opposite of frequency dividers. IMO the real advantage of adder circuits is they make it easier to get different waveforms.

 

Either approach will work very well with 32 bits.

 

Sorry if this is overboard! I like this stuff.

Link to comment
Share on other sites

2 hours ago, Pat Brady said:

 

TIA frequency dividers are 5-bit. Changing the distortion setting effectively provides a few different base frequencies, but still not 8 bits worth of values.

 

Frequency division works fairly well at 8 bits (e.g. POKEY in 4-channel mode) and very well with 10+ bits (SN76489, AY-3, POKEY in 2-channel mode, NES).

 

A straight line is not ideal, because musical notes occur on exponentially increasing frequencies. Adder circuit generators are relatively good (granular) at the treble end and relatively bad at the bass end of their range, the opposite of frequency dividers. IMO the real advantage of adder circuits is they make it easier to get different waveforms.

 

Either approach will work very well with 32 bits.

 

Sorry if this is overboard! I like this stuff.

True, the TIA is 5-bit, I forgot to clarify that I was only talking of DPC frequency dividers.

 

However, I disagree with the idea that a divider is better. Music notes are a curve but it's a gently-climbing exponential. In general, the divider method doesn't match this well.

 

Here is a graph showing the shape of the DPC and POKEY curves, frequency vs divider value.

 

image.thumb.png.ec0e3bd2efc9ed09cd02ba1773e56971.png

 

For comparison, here is a graph of music notes, frequency vs note (12 point scale).

image.thumb.png.4e1051a2db7179fb0a0dc3d8526c84bc.png

 

I won't plot a straight line, as you know what that looks like :)

 

The DPC divider method is a *very* poor match. It flattens at the low end and steepens at the upper end. The POKEY is marginally better given its 64 kHz base frequency but it's still not that great except on the lower end.

 

I won't graph a straight line, but the music curve is closer to a straight line than either of the divider curves above.

 

While a divider method does better at the lower end, an adder is superior at the upper end. I had some math here with equivalence points but I edited it out because I think I made a mistake with it :o

 

I think at best you might have a draw at 8 bits. At higher resolution, though, the adder method quickly becomes superior. At 16 bits there shouldn't be a question, and at 32 bits it's not even close.

 

A 32-bit divider may not even be usable with a divider method, frankly. The reason is that the base frequency has to be in the GHz range for it to be even useful and even then, the majority of values are above or below the range of human hearing and thus unusable.

 

At 32 bits, the DPC+ adder has a granularity of 0.000004 Hz. A divider with a base frequency of 1 Ghz only beats that below around 60 Hz which is too low to even worry about. Even at 1 GHz, though, barely 1% of the 32-bit values are within the range of human hearing, while in the adder method, a good 75% are. There is pretty much no way to make a 32-bit divider perform anywhere near as well.

Link to comment
Share on other sites

4 hours ago, batari said:

However, I disagree with the idea that a divider is better. Music notes are a curve but it's a gently-climbing exponential. In general, the divider method doesn't match this well.

...

While a divider method does better at the lower end, an adder is superior at the upper end. I had some math here with equivalence points but I edited it out because I think I made a mistake with it :o

 

I think at best you might have a draw at 8 bits. At higher resolution, though, the adder method quickly becomes superior. At 16 bits there shouldn't be a question, and at 32 bits it's not even close.

 

To clarify, I did not intend to suggest that a divider is better in general. Neither method distributes values ideally.

 

And I agree that the clock needs to be matched to the number of bits, for both types.

 

Point conceded about 32 bits. Well, a hypothetical 32-bit frequency divider could work and sound great, but you're correct that it would be a pointless waste of bits even at modern clock speeds.

 

I disagree that the adder is clearly superior at 16 bits. 16-bit POKEY goes down to 14 Hz, and every conventional note is within 5 cents of ideal all the way up to F9 at 11.2 kHz, more than an octave past the top of a standard piano. The worst audible note is C#10 which is 15 cents sharp. A 16-bit adder circuit clocked at, say, 28 kHz has a few notes in octave 1 (32-64 Hz) that are between 5 and 10 cents off, then a few notes in octave 0 (i.e. subwoofer territory) that are 12 cents off. If anything, I expect the adder's errors are more likely to occur and more likely to be noticed than POKEY's — but really, that's nitpicky. Both of these chips will work very well to most human ears. I still think the adder's real advantage is that it can produce a greater variety of waveforms.

Link to comment
Share on other sites

  • 2 weeks later...

Possibly off topic, but I'm really confused about sound data.. 

 

When I think of 2 chanels, I think stereo sound. But also 2 separate tracks. 

 

But the Atari seems to have stereo sound but only one track? As the data for both chanels always must be embedded together- is that correct? 

 

Like if I only want 60 seconds of notes playing from C0, but I want the option to use C1 for other sounds later, it appears to create almost twice the code via the 0,0,0 for C1 for that full 60 seconds even if I don't use it. Unless I'm wrong? 

 

My idea was to have a perpetual drum loop on C0, with a randomized melody on C1 that periodically plays on top of that. But the way both chanels intertwine data into one stream seems like 2 separate and simultaneous tracks is not possible. 

 

Am I understanding this wrong? Because I'd really REALLY like the option to randomly drop one short mono track on C0 over another mono track on C1. 

 

Can this be done? I'm less concerned about saving memory. I'd like a perpetual loop with a track that can drop in on top of that loop but without interrupting that loop. Theoretically this should be possible..

 

But the two chanels embed into one data stream with MusicMaker. 

Edited by freshbrood
Link to comment
Share on other sites

The Atari has two sound channels, so you can play two sounds at once.  On an un-modded system, these two channels are mixed together and output in mono.

 

The TIA chip outputs the two sound channels separately, so some people have modded their systems to have stereo sound with one channel outputting on the left, and the other on the right.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

7 hours ago, freshbrood said:

But the Atari seems to have stereo sound but only one track? As the data for both chanels always must be embedded together- is that correct? 

 

Like if I only want 60 seconds of notes playing from C0, but I want the option to use C1 for other sounds later, it appears to create almost twice the code via the 0,0,0 for C1 for that full 60 seconds even if I don't use it. Unless I'm wrong? 

 

My idea was to have a perpetual drum loop on C0, with a randomized melody on C1 that periodically plays on top of that. But the way both chanels intertwine data into one stream seems like 2 separate and simultaneous tracks is not possible. 

 

Am I understanding this wrong? Because I'd really REALLY like the option to randomly drop one short mono track on C0 over another mono track on C1. 

 

Can this be done? I'm less concerned about saving memory. I'd like a perpetual loop with a track that can drop in on top of that loop but without interrupting that loop. Theoretically this should be possible..

 

But the two chanels embed into one data stream with MusicMaker. 

 

To add on to what @splendidnut said:

 

The two channels are programmed completely independently. It is possible, for example, to play music in one channel and game-triggered sound effects in the other. But I don't know if any of the available tracker packages support that. The one I use, @Paul Slocum's Music Kit, always drives both channels as part of its song AFAIK.

  • Thanks 1
Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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