Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

Ads

#1 2008-03-02 18:12:52

Awol
Member
Registered: 2008-02-25
Posts: 23
Website

5th Sound Channel on Game Boy?!

I just read this on the 8bc wiki's Game Boy article.

Sound
The channels
This is the most interesting section for us musicians. wink The Game Boy family has five channels.

    * Two quadrangular channels. (Aka square wave or pulse wave) Both these channels have a volume envelope, a 4 mode pulse width (12.5%, 25%, 50% and 75%) and a frequency register that ranges from the note C-3 to above what human being can hear. The first pulse channel additionally has a frequency envelope which can be used for things like portamento, special effects or drum synthesis.
    * One wave channel with user-definable waveform. This channel has a bank of 32 samples of 4-bit depth. When used with a wave form, this channel can play notes one octave lower than the pulse channel, IE down to C-2. It can also play back samples by writing a wave sample to its register, one bank at a time.
    * One pseudo-random noise channel. The noise channel is probably the most unique channel the Game Boy has to offer. Apart from white and brown noise, this channel can produce noise with a much more melodic character. More information about how the noise is generated is available in the [Lord Nightmare's Comprehensive GB sound document].
    * One external sound channel. This is the fifth and least known channel of the Game Boy. It's an analogue input that allow external synthesis on cartridge to be mixed with the rest of the sound. To this date, no cartridges are known to use this functionality. However one freeware games uses the residual voltage on the pin to create a wave sound by quickly turning the channel on and off.

Is that true? Does the DMG-01 have a fifth sound channel? That is the only place that I have read that. Can someone please clarify exactly what it does? It sounds to me like it takes sound from external devices and runs it through the Game Boy's sound chip. Is that correct? If it does exist, would it allow me to create my dream program that lets one use a guitar or other instrument to control the GB? If it does exist, my first major project will be to write a GB program that uses this legendary fifth channel!


Formerly Grey_and_Purple.

Offline

 

#2 2008-03-02 19:39:50

nitro2k01
Administrator
Registered: 2008-02-22
Posts: 249

Re: 5th Sound Channel on Game Boy?!

(Hey, I wrote that article on the 8bc wiki smile )
The 5th channel is an external sound input from pin 31 on the cartridge port. It is there so you can place a synth chip or sample playback chip on a cartridge. However, sound cannot be sampled through this channel, it can only routed. As such it's like the other channels, it can be hard panned to the left or right, or muted or playing on both channel. The best you could as a guitar effect is a gate or a simple (And very CPU-intensive) ring modulator by turning the volume on and off many times per second. Though I imagine that input on this channel will be pretty noisy, and that there will be some voltage spikes when turning the sound on or off for the channel.


Blog: Gameboy Genius
"A journey of a thousand miles begins with one small step"
Old Chinese Proverb

Online

 

#3 2008-03-02 20:35:14

Awol
Member
Registered: 2008-02-25
Posts: 23
Website

Re: 5th Sound Channel on Game Boy?!

I'm really new to this (still learning the basics of C, haven't yet tried to write anything specifically for GB hardware) so most of what you said went way over my head.

nitro2k01 wrote:

It is there so you can place a synth chip or sample playback chip on a cartridge. However, sound cannot be sampled through this channel, it can only routed.

What is routing? Can you clarify for a n00b?

Since this 5th sound channel is a feature of the Game Boy that appears to have been hitherto unexploited, and because it is an extremely common misconception that the GB only has 4 channels, I really want to do a project that takes advantage of it. As someone who is already experienced in GB development, what ideas or possibilities can you see for programs that make use of the fifth channel?

By the way - nice article! It's pretty comprehensive, even though it says it is under construction! smile

Last edited by Awol (2008-03-02 20:40:03)


Formerly Grey_and_Purple.

Offline

 

#4 2008-03-02 20:55:05

nitro2k01
Administrator
Registered: 2008-02-22
Posts: 249

Re: 5th Sound Channel on Game Boy?!

Both your questions were actually answered in my previous post.
Clarification: Routing in this case means that there's one input, which you can choose to route to the left or right channel, or both, or neither.
As for effects, the simplest thing you can do is a gate, ie turn the sound hard on or hard off. This can be done rhythmically. Or, by turning it on and off 440 times per second, or any frequency you want, you get a simple ring modulator. If you dedicate the left or the right channel to this, you can even use the 7 step volume setting for the left or right channel to make more complex waveforms than a squarewave for this ringmod thing. This will require extreme precision in timing though!
But it's an interesting idea to say the least.


Blog: Gameboy Genius
"A journey of a thousand miles begins with one small step"
Old Chinese Proverb

Online

 

#5 2008-03-02 21:17:47

Awol
Member
Registered: 2008-02-25
Posts: 23
Website

Re: 5th Sound Channel on Game Boy?!

Ah ok, I get it now. Thanks a lot! smile
I'm afraid I have some more n00bish questions though sad ...
You said earlier that an extra sample playback chip could be put in the cartridge for use with the 5th channel. What would the advantage be in doing that when samples can be already played back in the wave channel from an unmodified cartridge? Would it just allow more space for samples to be placed on the cart, and an extra channel to play them back on? But you said sound cannot be sampled through the 5th channel. Is sampling through a channel different from playing a sample from a chip through a channel?

I'm really really sorry if I'm bugging you with all these questions that make me look so stupid and n00bish...

EDIT: Also, what is the name of the freeware game mentioned in the 8bc wiki article?

Last edited by Awol (2008-03-02 22:34:54)


Formerly Grey_and_Purple.

Offline

 

#6 2008-03-03 09:33:08

nitro2k01
Administrator
Registered: 2008-02-22
Posts: 249

Re: 5th Sound Channel on Game Boy?!

Don't worry, this forum was created for discussions like this one.
The advantage would be better sound quality. Even though nobody wants to admit it, the sound quality of channel 3 is mediocre for sample playback with its 4-bit sound and the sample playback bug that adds a tonal component to the samples. (Especially on GBA's) A synth chip or a 16-bit or even 8-bit sample playback chip would open a whole new world of possibilites. Hmmm, maybe someone ought to design an OPL tracker for the GB with an OPL chip on the cart. big_smile

Sampling means to give the ability for a GB program to read and record the sound. Which this channel can't do. This also eliminates most possibilities to modify the sound as well.
What this channel does is just forward a sound signal and act like a simple mixer. You could just as well connect a microphone to that pin for all I know.


Blog: Gameboy Genius
"A journey of a thousand miles begins with one small step"
Old Chinese Proverb

Online

 

#7 2008-03-03 10:38:11

Awol
Member
Registered: 2008-02-25
Posts: 23
Website

Re: 5th Sound Channel on Game Boy?!

Thanks a lot! That clears everything up. I'm still learning C (and afterwards I gotta learn ASM), but now I have some ideas for cool projects I can look forward to doing once I'm done learning the ropes! big_smile


Formerly Grey_and_Purple.

Offline

 

#8 2008-04-13 16:09:44

Lamarre
New member
Registered: 2008-04-12
Posts: 4

Re: 5th Sound Channel on Game Boy?!

nitro2k01 wrote:

. Hmmm, maybe someone ought to design an OPL tracker for the GB with an OPL chip on the cart. big_smile

So I wasn't so damn fool thinking it was possible (thoug I tought maybe using the third channel). So it could be possible linking an OPL3 (FM synth) mix it all with the GB and  for a pure heavenly sound?

Offline

 

#9 2008-04-13 20:02:09

nitro2k01
Administrator
Registered: 2008-02-22
Posts: 249

Re: 5th Sound Channel on Game Boy?!

Provided someone designs the cartridge. wink


Blog: Gameboy Genius
"A journey of a thousand miles begins with one small step"
Old Chinese Proverb

Online

 

#10 2008-10-12 01:46:55

CrazyJoe
New member
Registered: 2008-10-12
Posts: 3

Re: 5th Sound Channel on Game Boy?!

I don't know if I'll be able to find the time/resources, but I'd love to help build a prototype OPL cartridge for the gameboy. Knowing that there is a definite interest out there, it gives me some motivation to continue research!

The one thing that's been bugging me is that OPL-2, OPL-3, and even POKEY all require clock rates that are *slightly* different than what I could get by multiplying the CLK pin (4MHz / 4 = ~1MHz). Of course, it just means that one would have to calculate new frequency tables for the various notes, so it's not impossible. The problem with the OPL chips is that I think they both require their own special DAC to output analog, so that takes up a lot of room on the cart. I think the POKEY doesn't need any external DAC and will gladly take ~1MHz clock, so it may be a nice thing to make a test run with to see if it's possible.

I'd really like to have an OPL-3 cart, as it would be much more fun and convenient than hooking up my old DOS computer!

Offline

 

#11 2008-10-12 06:51:20

nitro2k01
Administrator
Registered: 2008-02-22
Posts: 249

Re: 5th Sound Channel on Game Boy?!

I think an FPGA could be useful here. It could be used as an MBC, as well as a DAC, and other things if needed. And yeah, I've already thought about the clock iseues of the GB, but sort of the other way around. (About clocking the GB with a "normal" clock crystal) The problem is that the GB is using a base 2 frequency clock crystal, not a base 10 one. Ie, 1MiHz = 1024*1024 Hz = 1048576 Hz, where "normally" you'd use 1 MHz = 1000000 Hz. But that's easy to overcome with new frequency tables.
The problem however is the sound levels that the VIN signal is maixed at:
http://gameboygenius.8bitcollective.com … Vin_Mixing

The cartridge connector includes a sound input called Vin. When enabled via NR50, it is mixed in before the master volume controls. On the DMG and MGB, 0.847 volts gives equivalent to 0 on a channel DAC, and 3.710 volts is equivalent to 15 on a DAC, with other values linearly distributed between those voltages. On the CGB, the range is 1.920 volts to 2.740 volts, a quarter of the DMG range, thus sound fed to the CGB's Vin is significantly louder. When nothing is connected to Vin, it naturally floats at the middle voltage (silence).


Blog: Gameboy Genius
"A journey of a thousand miles begins with one small step"
Old Chinese Proverb

Online

 

#12 2008-11-08 23:37:33

CrazyJoe
New member
Registered: 2008-10-12
Posts: 3

Re: 5th Sound Channel on Game Boy?!

I've been poking around, and it looks like the voltage issues can be solved with a simple op-amp. Ideally one should also have a direct output from the OPL-3's DAC if they wanted to mix it separately. It looks like the 14MHz clock is a requirement for the OPL-3, so that will take up a bit of room, but not much.

I'm still trying to figure out what format the OPL-3 outputs to its DAC (sadly the OPL-3 requires an external DAC, unlike, say the YM2610, which has it built-in). Hopefully I'll have some time to make some sort of parallel port interface to an OPL-3 for testing interfacing, clock stuff, and output levels - should be able to be bread-boarded pretty easy aside from the OPL-3 chip.

Perhaps most of these solutions could be found in the VRC-6 and VRC-7 carts that Konami used on the Famicom?

Offline

 

#13 2009-04-08 19:22:59

Keaton_Blue
Member
From: WI
Registered: 2009-04-07
Posts: 13

Re: 5th Sound Channel on Game Boy?!

Nanoloop 1.5 uses the 5th sound channel for minimal pulse channel stuff.  The OPL-3 can take 2 Dacs for more musical expansion, (take a look at the Midibox FM).  This stuff is revolutionary!

Last edited by Entity (2009-05-01 07:48:06)


Also known as Lotus or Piglet

Offline

 

#14 2009-07-24 21:33:42

Keaton_Blue
Member
From: WI
Registered: 2009-04-07
Posts: 13

Re: 5th Sound Channel on Game Boy?!

Curious, if I were to design an OPL cart, would someone be willing to write software for it?


Also known as Lotus or Piglet

Offline

 

#15 2009-07-30 06:57:05

Vytantus
New member
From: Australia
Registered: 2009-07-30
Posts: 2

Re: 5th Sound Channel on Game Boy?!

I thought of the mbFM at the mention of OPL3 too, this is seriously interesting stuff. Even if Vin is only capable of on/off and L/R these make it quite exploitable, any kind of filtering or envelopes sound out of the question but the basic functions it has could still be useful. Audio In makes me want to add more phono jacks to my gboys smile. An OPL gameboy cart would be quite revolutionary... hope someone feels like coding such a thing...

Offline

 

#16 2009-09-04 10:35:36

Vytantus
New member
From: Australia
Registered: 2009-07-30
Posts: 2

Re: 5th Sound Channel on Game Boy?!

Another thought hit me the other day, although it seems that no one is interested in this forum (sadly).
If anyone is familiar with the Alpha Mod for C64  -http://www.bigmech.com/misc/c64mods/ - then you will know of the feedback mod. This takes the sid's audio out and feeds it back to the sid's audio in, this creates a loop which is regualted by a pot. Some great sounds can be acheived through this mod with the possibility of self oscillation (on the c64).
Ultimatly wondering if a similar modification would be possible on the gb. But then c64 has an actual sound chip, gb does not. Just thought of it with mention of audio I/O.  From volume pot to Vin? not crash hot on gb hardware soz

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson