Jump to content
IGNORED

Using the Intellivision as a musical instrument


atari2600land

Recommended Posts

Well, I got inspired by the Astrosmash album thing and I decided to try and program a song using nothing but Intellivision sounds. This is the result. I call it "Black Void" and it runs for 3 minutes. If you like it, I'll make more songs using nothing but the Intellivision. Here is the Intellivision ROM to play on an emulator. I'm surprised 3 minutes' worth of music is only 4.5 KB.

bv.bin

  • Like 4
Link to comment
Share on other sites

I cobbled together a basic tone generator/tester program, that supports the 3 main sound channels if you want to get a sense of what a sound is gonna sound like without compiling and running code. I noticed that I'm constantly tweaking pitch and chords just trying to find the perfect note. Let me know if it'd be useful to you. It's crude, but uses the keypad to control the pitch as well as enable/disable each channel, both independently. I may bake in independent volume support but would need to use controller #2 as I'm running out of buttons. :P

 

I'm trying to figure out a simple way to take it one step further and have a primitive piano type setup, so I can make music on the fly. I can write fun stuff in my head and hammer it out with an instrument, but actually putting it down on paper and/or code is something I've never been terribly good at. I tend to lose the tune in the process. There's just not enough available keys (plus the control pad was NEVER intended to be used for something like this, you have to debounce the hell out of it so the response is laggy). I can see myself eventually trying to hack together a music tracker or similar but I really do love generating the sounds/music "live" on the console (emulator), if at all possible.

 

How are you coming up with music? Trial and error? Or are you sheeting it out first? Heck, I may "commission" you for an intro theme for a game, as you seem to be pretty quick in coming up with music. :)

Edited by freeweed
  • Like 1
Link to comment
Share on other sites

First thing I do is play around on my piano. Then, once something I think will make a good tune pops up, I write the notes down on a piece of paper. Then I go to my computer and through trial and error, I get the notes to sound like the song I want to be playing from the piano.

  • Like 2
Link to comment
Share on other sites

Are you using Arnauld's tracker, or are you doing this in IntyBASIC, or something else?

 

I recall Arnauld saying he'd written a crude MOD => ASM converter (if I recall correctly), so you could use a MOD editor to author music, constraining yourself to 3 out of the 4 channels, generate an ASM from that, and then use a version of his tracker library. I think he may have used a flow like that for his Spirit demo.

 

I've been meaning to get a hold of him about that flow. I've found myself getting interesting theme loops stuck in my head that I think would make excellent game music, even if I don't have a game that needs them right at the moment. But, since I've never played much with MOD trackers, I need to get off my rump and actually do something. After I complete LTO Flash! of course. :-)

 

I need to take Warren Buffet's rule of prioritization to heart: Write down the 25 things you'd most like to accomplish. Circle the 5 that are most important to you. The other 20 become the "list of things to avoid at all cost," as they'll distract you from completing your top 5. Music authoring seems to be at about '6' right now.

  • Like 2
Link to comment
Share on other sites

This one I call "Bermuda Breeze."

 

 

Are all of these in the key of "B"? ;-) (Just noticing a pattern.... Black Void, Bring Forth Demons, Bermuda Breeze, Been Difficult)

 

Also, I'm endlessly amused that someone named Atari2600land has a SEGA logo as his avatar, and is writing Intellivision software.

 

(I go by 'intvnut', but if I had an extra helping or 2 of spare time, I'd spend it in the TI-99/4A forums or explore Sega Genesis development, so I'm in no position to judge. I'm just truly amused.)

Edited by intvnut
Link to comment
Share on other sites

BTW, I like these melodies. They're pretty cool. And you're cranking them out quickly!

 

One thing I think that might make a couple of them even better (especially 'Been Difficult') would be a 'bass pad' of some sort. It looks like you're only using channels A and B (at least in the one I fired up in the debugger), and so you could put a low volume, low frequency, low speed bass line on the third channel to really add some atmosphere without drowning the melody. Basically, just a series of anchoring whole notes (or longer) down in the bottom octave.

Link to comment
Share on other sites

Yeah, I've been into different software lately. I'm using IntyBasic to make these. I've been purposely trying to name them with the initial letter B since the first two were not purposely. I am wondering how many sound channels the Intellivision has. Because if I put something like:

MUSIC C3,E3,G3,-

only two notes out of the three play. Or am I just hearing things wrong?

Link to comment
Share on other sites

Yeah, I've been into different software lately. I'm using IntyBasic to make these. I've been purposely trying to name them with the initial letter B since the first two were not purposely. I am wondering how many sound channels the Intellivision has. Because if I put something like:

MUSIC C3,E3,G3,-

only two notes out of the three play. Or am I just hearing things wrong?

 

You need to use the PLAY ALL command to enable the three channels usage.

Link to comment
Share on other sites

Yeah, I've been into different software lately. I'm using IntyBasic to make these. I've been purposely trying to name them with the initial letter B since the first two were not purposely. I am wondering how many sound channels the Intellivision has. Because if I put something like:

MUSIC C3,E3,G3,-

only two notes out of the three play. Or am I just hearing things wrong?

 

Ah ok. :-)

 

I see nanochess replied on the IntyBASIC details.

 

Hardware wise: The PSG has three square wave voices and one white-noise channel. The white noise doesn't get a dedicated output. Rather, each channel has 2 bits of noise/tone select.

 

They mix together like this (repeated for all three channels A, B, and C):

  • channel_X_output = ( tone_generator_X OR tone_enable_X ) AND ( noise_generator OR noise_enable_X )

 

That means a '1' in an enable bit disables the corresponding tone/noise, and a '0' enables it. If you enable both tone and nose, then the two modulate each other. That is, while the tone generator outputs a 0, you get a 0, and while the tone generator outputs a 1, you get the output of the noise generator.

 

This mixing leads to interesting behavior. For example, if you mix a low frequency tone with noise, you get "gritty" noise. The tanks in Armor Battle, the bridge explosions in River Raid, and the rock explosions in Space Patrol all use this effect.

 

If you mix a higher frequency with noise, you're less likely to notice artifacts due to how they're mixed. The noise behaves more like a dedicated channel. So, for simple percussion effects, you may be able to mix them onto a melody channel and have it sound perfectly acceptable. (In a thread on INTVPROG, Arnauld suggested mixing noise-based percussion with bass, but I tend to think mixing it with upper octaves gives a better result.)

 

You can see an example of this in Carl Mueller's SNDTEST. He wrote a version of the Intellivision "cheer" sound effect that plays entirely on one channel! (I've attached the bin+cfg to this post. You'll need to rename SNDTEST.txt to SNDTEST.cfg, because AA inexplicably doesn't allow me to upload .CFG files. I hope Carl doesn't mind; he publicly posted this binary on INTVPROG some years back. Follow the link for instructions on how to use it. Sound effect 5 is the "cheer.")

 

I don't know how IntyBASIC handles the PSG, but clearly there's plenty of potential to unlock in that simple little chip.

SNDTEST.bin

SNDTEST.txt

Link to comment
Share on other sites

 

You need to use the PLAY ALL command to enable the three channels usage.

 

Your manual says "PLAY FULL" for that. ;)

 

 

And while we're on the topic of sound channels, from the manual:

 

SOUND 0,[VALUE 12 bits],[VOL 0-15] Channel A

SOUND 1,[VALUE 12 bits],[VOL 0-15] Channel B

SOUND 2,[VALUE 12 bits],[VOL 0-15] Channel C

SOUND 3,[VALUE 16 bits],[TYPE 0-15] Envolvent

SOUND 4,[NOISE 6 bits],[MIX] Noise and mix register ($38 value by default)

And from the Wiki about the PSG:

Envelope Generator

Period Atak, Cont, Hold, Altr Volume (0-15) 16-bit period value multiplied by two, from 2 PSG clock cycles to $20000

Noise Generator

The random noise generator adheres to the following formula once per PSG clock cycle.

What, exactly, do SOUND 3 and 4 do - and how does one use them? I'm kinda getting a sense on the noise generator that you just turn it on (6 bits of variation) and the MIX bits control which sound channel(s) to mix the noise with? I can't figure out what SOUND 3 does. If it involves the envelope generator, which seems to be about volume and duration and whatnot - why do you have volume controls in each sound channel? Or is this an overall value for all 3 channels?

  • Like 1
Link to comment
Share on other sites

Your manual says "PLAY FULL" for that. ;)

Woops! you're right, I never follow my own advice about never writing a message before going to sleep :)

 

And while we're on the topic of sound channels, from the manual:

 

SOUND 0,[VALUE 12 bits],[VOL 0-15] Channel A

SOUND 1,[VALUE 12 bits],[VOL 0-15] Channel B

SOUND 2,[VALUE 12 bits],[VOL 0-15] Channel C

SOUND 3,[VALUE 16 bits],[TYPE 0-15] Envolvent

SOUND 4,[NOISE 6 bits],[MIX] Noise and mix register ($38 value by default)

 

And from the Wiki about the PSG:

Envelope Generator

Period Atak, Cont, Hold, Altr Volume (0-15) 16-bit period value multiplied by two, from 2 PSG clock cycles to $20000

 

Noise Generator

The random noise generator adheres to the following formula once per PSG clock cycle.

 

What, exactly, do SOUND 3 and 4 do - and how does one use them? I'm kinda getting a sense on the noise generator that you just turn it on (6 bits of variation) and the MIX bits control which sound channel(s) to mix the noise with? I can't figure out what SOUND 3 does. If it involves the envelope generator, which seems to be about volume and duration and whatnot - why do you have volume controls in each sound channel? Or is this an overall value for all 3 channels?

 

SOUND 3 is a kind of global volume envolvent generator, in order to use it in Channel A to C, you change their volume to 16 and these start to use the envolvent generator.

 

That means that if all three channels have volume equal to 16, then all three channels will have exactly the same envolvent.

 

The first parameter for SOUND 3 is the frequency and the second one is the type of envolvent. You can generate very easily helicopter-like or sea waves sounds.

 

And you're right with SOUND 4, just frequency of noise generator and mixing bits.

Link to comment
Share on other sites

Woops! you're right, I never follow my own advice about never writing a message before going to sleep :)

 

 

SOUND 3 is a kind of global volume envolvent generator, in order to use it in Channel A to C, you change their volume to 16 and these start to use the envolvent generator.

 

That means that if all three channels have volume equal to 16, then all three channels will have exactly the same envolvent.

 

The first parameter for SOUND 3 is the frequency and the second one is the type of envolvent. You can generate very easily helicopter-like or sea waves sounds.

 

And you're right with SOUND 4, just frequency of noise generator and mixing bits.

 

 

You can read about the envelope generator (what you're calling the 'envolvent') in the PSG data sheet.

 

NOTE: The AY-3-8914 used in most Intellivision 1s requires you to set both bit 4 and bit 5 of the volume register to get the expected envelope output, rather than just bit 4 as the closely related AY-3-8910 datasheet suggests. I believe later units have a revised chip that only requires setting bit 4. If your software only sets bit 4, the envelope will be very, very quiet. I don't know what IntyBASIC does with volume level 16—does it upgrade it to $30 before writing it to the PSG? If not, then you should use volume level 48 for envelopes, not 16.

 

I have not performed a comprehensive survey of which chips are in which machines.

 

Here is a link to an older, preliminary data sheet for the AY-3-8910 before it was finalized. It actually describes the AY-3-8914 that's in the original Intellivision fairly well. You'll notice that the register order matches the AY-3-8914, and not the final AY-3-8910. (Note: Register offsets are in octal!) Also notice the funky behavior of bits 4/5 in the volume register with respect to envelope generation in the table at the top right of the second page (page 101). If you always set both bits to 1, you'll get the same envelope behavior across all variants of the chip. If you only set bit 4, envelopes will be too quiet on many (most?) Intellivisions.

The fifth page (page 104 above) has a table illustrating all of the envelope patterns. The "one-shot" patterns are are good for gun-shots, crashes, "dings" and so on. If you set the envelope period very short, the repeating patterns make interesting sound effects when mixed with tones. The "brrrrrrrip!" sound you here when the ghost steals presents back was made that way. The RAZZ sound effect is a mix of tones and a fast envelope.

 

For the one-shots, I imagine the IntyBASIC command "SOUND 3" will trigger the one-shot when it writes to the envelope type register ($1FA).

 

My speculation on why the AY-3-8914 exists separately of the AY-3-8910: Mattel designed in GI's system (what they called the GIMINI Deluxe "8900" Programmable Game System) before GI had finalized the PSG. Since APh already had a stack of software programmed to the specs linked above, Mattel probably asked for a part that met the original specs. (Actually, if you dig around the Papa Intellivision site, you'll find that Mattel did ask for other changes as well, such as removing the I/O ports from the AY-3-8914.)

 

EDIT: Here are a couple other PSG programming tips, as long as I'm on a roll:

 

  • Set the volume to 0 on unused audio channels. When you disable tone and noise on an unused audio channel, that channel outputs a digital '1' that gets scaled to the voltage specified by the volume register. If you set the volume to, say, 15 on these unused channels, those channels are "screaming silence". This causes the audio amp to saturate, and the overall output volume for the enabled channels drops. (I know of at least one person who has run into this.) For the curious, I've attached the volume table that someone else measured on an AY-3-8910 PSG that shows this saturating behavior.

     

    The attached volume table shows the voltage output of the PSG for all combinations of volume levels across channels A, B and C, scaled to the range 000 .. 3FF. There are 16 tables of 16x16 values. You can think of each table as a different volume level for channel A, each row in a table as a different volume level for channel B, and each column as a different volume level for channel C. It goes in descending order, so the first entry is 15,15,15, and the last entry is 0,0,0.

  • Set the tone period to something other than 0 on disabled tone channels. For example, program in '1' instead. Even if you disable tone output on a channel, its oscillator continues to run. If you zero out the tone period, you're asking for an extremely low frequency (27 Hz, IIRC). The PSG won't reload its tone count until the down-counter expires. This will prevent other tones from "kicking in" as soon as they should. I made this mistake in 4-Tris' sound engine, which is why many of the notes in the music are much more staccato on real hardware than they were in the emulator.

     

    I've seen many, many PSG references on the net suggest that the PSG implements a comparator and an up-counter to prevent this issue from happening. If you dig around long enough at the Papa Intellivision website, you'll find out that the AY-3-8914 does not and that this change was suggested to the GI engineers. The AY-3-8914 may have subsequently been modified, but I don't know.

PSG_volume_table.txt

Edited by intvnut
  • Like 2
Link to comment
Share on other sites

Wow, that's a lot of info to absorb. Sound processing is something that I have a hard time wrapping my brain around but I hope to understand this better with a ton of experimentation.

 

I've also run into the "screaming silence" problem. But that just makes intuitive sense in the same way that you have to "zero out" your sprite displays if you want them off the screen, even if you think you've completely cleared everything. Hardware generally keeps doing what you've asked it to do, until you tell it to stop.

 

Now I have to see about the audio clipping you describe, because I've noticed a similar effect and it's been pissing me off. It would explain why I've been having very specific sound issues - nice to catch before I experiment on real hardware.

Link to comment
Share on other sites

You can read about the envelope generator (what you're calling the 'envolvent') in the PSG data sheet.

 

NOTE: The AY-3-8914 used in most Intellivision 1s requires you to set both bit 4 and bit 5 of the volume register to get the expected envelope output, rather than just bit 4 as the closely related AY-3-8910 datasheet suggests. I believe later units have a revised chip that only requires setting bit 4. If your software only sets bit 4, the envelope will be very, very quiet. I don't know what IntyBASIC does with volume level 16—does it upgrade it to $30 before writing it to the PSG? If not, then you should use volume level 48 for envelopes, not 16.

Ok, I see, in fact just I've noted I don't have added this to the IntyBASIC manual.

 

I have not performed a comprehensive survey of which chips are in which machines.

 

Here is a link to an older, preliminary data sheet for the AY-3-8910 before it was finalized. It actually describes the AY-3-8914 that's in the original Intellivision fairly well. You'll notice that the register order matches the AY-3-8914, and not the final AY-3-8910. (Note: Register offsets are in octal!) Also notice the funky behavior of bits 4/5 in the volume register with respect to envelope generation in the table at the top right of the second page (page 101). If you always set both bits to 1, you'll get the same envelope behavior across all variants of the chip. If you only set bit 4, envelopes will be too quiet on many (most?) Intellivisions.

I'm in awe, the AY-3-8914 in fact could select a kind of exponential envelope volume! :)

 

I'll take care to put links to these pages in the IntyBASIC manual. Thanks a lot!

 

The fifth page (page 104 above) has a table illustrating all of the envelope patterns. The "one-shot" patterns are are good for gun-shots, crashes, "dings" and so on. If you set the envelope period very short, the repeating patterns make interesting sound effects when mixed with tones. The "brrrrrrrip!" sound you here when the ghost steals presents back was made that way. The RAZZ sound effect is a mix of tones and a fast envelope.

 

For the one-shots, I imagine the IntyBASIC command "SOUND 3" will trigger the one-shot when it writes to the envelope type register ($1FA).

That's right, the envelope type register is the last one written.

 

My speculation on why the AY-3-8914 exists separately of the AY-3-8910: Mattel designed in GI's system (what they called the GIMINI Deluxe "8900" Programmable Game System) before GI had finalized the PSG. Since APh already had a stack of software programmed to the specs linked above, Mattel probably asked for a part that met the original specs. (Actually, if you dig around the Papa Intellivision site, you'll find that Mattel did ask for other changes as well, such as removing the I/O ports from the AY-3-8914.)

Quite probably.

 

EDIT: Here are a couple other PSG programming tips, as long as I'm on a roll:

  • Set the volume to 0 on unused audio channels. When you disable tone and noise on an unused audio channel, that channel outputs a digital '1' that gets scaled to the voltage specified by the volume register. If you set the volume to, say, 15 on these unused channels, those channels are "screaming silence". This causes the audio amp to saturate, and the overall output volume for the enabled channels drops. (I know of at least one person who has run into this.) For the curious, I've attached the volume table that someone else measured on an AY-3-8910 PSG that shows this saturating behavior.

     

    The attached volume table shows the voltage output of the PSG for all combinations of volume levels across channels A, B and C, scaled to the range 000 .. 3FF. There are 16 tables of 16x16 values. You can think of each table as a different volume level for channel A, each row in a table as a different volume level for channel B, and each column as a different volume level for channel C. It goes in descending order, so the first entry is 15,15,15, and the last entry is 0,0,0.

     

  • Set the tone period to something other than 0 on disabled tone channels. For example, program in '1' instead. Even if you disable tone output on a channel, its oscillator continues to run. If you zero out the tone period, you're asking for an extremely low frequency (27 Hz, IIRC). The PSG won't reload its tone count until the down-counter expires. This will prevent other tones from "kicking in" as soon as they should. I made this mistake in 4-Tris' sound engine, which is why many of the notes in the music are much more staccato on real hardware than they were in the emulator.

     

    I've seen many, many PSG references on the net suggest that the PSG implements a comparator and an up-counter to prevent this issue from happening. If you dig around long enough at the Papa Intellivision website, you'll find out that the AY-3-8914 does not and that this change was suggested to the GI engineers. The AY-3-8914 may have subsequently been modified, but I don't know.

 

Pretty interesting the volume thing. I learnt the hard way to overcome the pop's sound, sound output going to 1 because I deactivate mixer in Princess Quest, until I leaved it active and only put zeros to volume.

 

I keep frequencies the same, just because I save cycles not writing to zero the frequency, but it's a very important info.

 

Thanks for sharing your wisdom! :) :thumbsup:

 

I'm pretty sure a lot of IntyBASIC developers will appreciate this information.

  • Like 2
Link to comment
Share on other sites

OK, here's a fun IntyBASIC question.

 

I've got 2 chunks of music (songs) in my game. However, the exact pitch of my newest song seems to change depending on where I have it in my code.

 

ie, when the code looked like this:

song1: DATA 6

MUSIC C4,A4#W,C5,M1

etc

MUSIC REPEAT

song2: DATA 8

MUSIC G2,G3,G4

etc

MUSIC STOP

 

song2 never sounded quite right. Every note/chord was slightly off. So I moved song2 to be first listed, and now it's perfect. song1 sounds identical regardless of position in the code. The calling code is identical (well it is now that I've ruled every other possibility out), the only thing changed is the position of song1 vs song2. Is this a "duh" moment, or am I not understanding something? They're both being called the same, PLAY FULL. I keep my music data at the end of the file along with the bitmaps and other graphic data.

 

I realize these aren't loops but I thought that chunks of data like this were isolated and had no effect on each other.

Edited by freeweed
Link to comment
Share on other sites

I realize these aren't loops but I thought that chunks of data like this were isolated and had no effect on each other.

The instruments setting in MUSIC carries from one MUSIC statement to the other, so the bottom one is interpreted like whatever instruments have you left set, it could be:

 

MUSIC G2X,G3W,G4Z
The right way to start a MUSIC statement is with your default instrument set:

 

MUSIC G2W,G3W,G4W
I'll correct this in the manual, isn't clear enough yet.
Link to comment
Share on other sites

The instruments setting in MUSIC carries from one MUSIC statement to the other, so the bottom one is interpreted like whatever instruments have you left set, it could be:

 

MUSIC G2X,G3W,G4Z
The right way to start a MUSIC statement is with your default instrument set:

 

MUSIC G2W,G3W,G4W
I'll correct this in the manual, isn't clear enough yet.

 

 

Ah, cool - thanks! While I can see what the various instruments sound like, I'm not sure I fully understand what these commands tell the PSG to do. Makes sense though, given how a lot of hardware handling works. I just haven't run into multi-segmented music yet, with different instruments.

Link to comment
Share on other sites

 

Ah, cool - thanks! While I can see what the various instruments sound like, I'm not sure I fully understand what these commands tell the PSG to do. Makes sense though, given how a lot of hardware handling works. I just haven't run into multi-segmented music yet, with different instruments.

The music player juggles with the volume (attack-sustain) and frequency (vibrato) of each voice for the selected instrument in each frame 50 times per second.

 

This way you can get very realistic piano, bass, flute and clarinet. "Pure" sound instruments are very easily achieved with this technique.

Link to comment
Share on other sites

  • 1 month later...

I am back doing this again. Here is the fifth song. I call it "Boogeyman's Boogie" (even though it's not really a boogie, just continuing the B title theme.)

 

 

That sounds... oddly familiar. I can't point my finger on it... but I know I've heard it.

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