It is currently Fri Dec 15, 2017 9:08 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: GBA sound quality...
PostPosted: Mon Jan 05, 2015 10:50 pm 
Offline
User avatar

Joined: Mon Sep 15, 2014 4:35 pm
Posts: 3153
Location: Nacogdoches, Texas
Although I think that the graphical capabilities of the GBA are certainly spectacular for a sprite based system (quite possibly the best I've seen), I always felt that the audio quality was lacking, especially when you compare it to the graphics. I have a few gba video cartridges, and although muffled, the sound quality was much better than what I would hear in 90% of GBA games. I've read that the GBA has 6 sound channels (aside from lack column scrolling, this seems to be the only thing worse about the GBA than the SNES) And although 4 channels are apparently about as good as the Gameboy, it says there are 2 "Direct Sound" channels, which I assume play back actual recorded music. (You can probably tell I have no knowledge of audio hardware. :P )

http://www.coranac.com/tonc/text/sndsqr.htm

Quote:
The GBA has six sound channels. The first four are roughly the same as the original GameBoy had: two square wave generators (channels 1 and 2), a sample player (channel 3) and a noise generator (channel 4). Those are also referred to as the DMG channels. New are two Direct Sound channels A and B (not to be confused with Microsoft's Direct Sound, the DirectX component). These are 8bit digital channels.

Is the reason we don't get near cd quality sound with the GBA because there would only be 1 sound channel left for sound effects, or is it because of space constraints? (I know bickering won't change how the system was designed, but I figure there has to be some way to have it sound better)

Two more questions I just thought of: If the GBA is using the GBZ80 (how is this different than a normal Z80?) solely for the 4 sound channels, (I think I remember hearing that the "Direct Sound" channels are controlled by the main CPU) than why aren't there more sound channels or higher quality existing ones? I understand that it had to do other things than just sound on the GB, but here it isn't being used for anything else.

Lastly, (though off topic) why didn't the Gameboy Micro or the DS play GB games? I heard that they still have the GBZ80, as it is required for sound on GBA games.


Top
 Profile  
 
 Post subject: Re: GBA sound quality...
PostPosted: Mon Jan 05, 2015 11:34 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6526
Location: Seattle
Espozo wrote:
it says there are 2 "Direct Sound" channels, which I assume play back actual recorded music. [...] is it because of space constraints?
That. The largest GBA game is 32 MiB, which isn't all that much time for compressed audio. The 17MHz ARM in the GBA isn't fast enough to do real-time decoding on MP3 or similar, and a lighter codec (like ADPCM) doesn't get very good compression per quality. (3 bits per sample, 32 KiHz, would match, and fit about 45 minutes of audio on a cartridge and nothing else. No disc-based-console style "fit 10 hours of music" on this cartridge without additional hardware)

Additionally, I think I remember reading that the output stage of the GBA drops the LSB of the 8 bit bytes sent on the DirectSound channels, further degrading it into two 7-bit channels.

Quote:
how is the [GBZ80] different than a normal Z80?
GBZ80 is actually an 8080 with a small handful of instructions added from the Z80 instruction set. And officially, Nintendo used the Z80 mnemonics instead of Intel's 8080 mnemonics.
EDIT: typo
Quote:
higher quality existing ones?
How would you make the classic gameboy sound channels higher quality? I suppose you could add more choices of duty cycle and/or volume, but it's still fundamentally pulse waves.

Quote:
Lastly, (though off topic) why didn't the Gameboy Micro or the DS play GB games?
For the Micro, cost savings. For the DS ... not clear. Maybe also cost savings, in a more price-sensitive market.
Quote:
I heard that they still have the GBZ80, as it is required for sound on GBA games.
Not necessarily. They have to include the audio hardware, but that's a lot simpler than the 8080 core.

That said, the Micro does still have the GBZ80 core in it, and Dwedit found a way to trigger it, but never any reliable way to execute code in that mode.


Last edited by lidnariq on Tue Jan 06, 2015 1:49 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: GBA sound quality...
PostPosted: Tue Jan 06, 2015 12:20 am 
Offline
User avatar

Joined: Mon Sep 15, 2014 4:35 pm
Posts: 3153
Location: Nacogdoches, Texas
lidnariq wrote:
Quote:higher quality existing ones?How would you make the classic gameboy sound channels higher quality? I suppose you could add more choices of duty cycle and/or volume, but it's still fundamentally pulse waves.

I don't know why, but I thought that it could produce better quality sound if it did not have to process game mechanics and graphics like it had to on the Gameboy. There are separate types of audio though in these audio in these systems, right and I guess each chip is specifically designed to play a certain format? Isn't there FM that was used in the Genesis and plenty of other arcade machines and PCM that was similar to recorded sound effects that was used in the SNES and Neo Geo? Like I said, I have zero knowledge of audio hardware. (It doesn't help that the audio portion of the SNES is practically a different system. :P )

lidnariq wrote:
No disc-based-console style "fit 10 hours of music" on this cartridge without additional hardware

What kind of additional hardware? Hardware for bank switching?

lidnariq wrote:
Additionally, I think I remember reading that the output stage of the GBA drops the LSB of the 8 bit bytes sent on the DirectSound channels, further degrading it into two 7-bit channels.

It doesn't matter, but I am curious. Do you know what for?


Top
 Profile  
 
 Post subject: Re: GBA sound quality...
PostPosted: Tue Jan 06, 2015 1:47 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6526
Location: Seattle
Espozo wrote:
There are separate types of audio though in these audio in these systems, right and I guess each chip is specifically designed to play a certain format?
Right. The reason that the GBA provides the game boy's sound channels is because it contains a game boy. Whatever they provide has to be compatible with that, so while they could have extended it, there was no real utility in doing so.

Quote:
What kind of additional hardware [to fit lots of recorded music]? Hardware for bank switching?
Hardware MP3/AAC decoder or comparable. Also when the GBA was current, 32 MiB of flash was still really expensive.

Quote:
It doesn't matter, but I am curious. Do you know [why the PCM channels lost another bit of depth]
I think I misremembered. Rereading GBATEK:
GBATEK wrote:
Max Output Levels (with max volume settings)
Each of the two FIFOs can span the FULL output range (+/-200h).
Each of the four PSGs can span one QUARTER of the output range (+/-80h).
The current output levels of all six channels are added together by hardware.
So together, the FIFOs and PSGs, could reach THRICE the range (+/-600h).
The BIAS value is added to that signed value. With default BIAS (200h), the possible range becomes -400h..+800h, however, values that exceed the unsigned 10bit output range of 0..3FFh are clipped to MinMax(0,3FFh).

Resampling to 32.768kHz / 9bit (default)
The PSG channels 1-4 are internally generated at 262.144kHz, and DMA sound A-B could be theoretically generated at timer rates up to 16.78MHz. However, the final sound output is resampled to a rate of 32.768kHz, at 9bit depth (the above 10bit value, divided by two). If necessary, rates higher than 32.768kHz can be selected in the SOUNDBIAS register, that would result in a depth smaller than 9bit though.

PWM (Pulse Width Modulation) Output 16.78MHz / 1bit
Okay, now comes the actual output. The GBA can output only two voltages (low and high), these 'bits' are output at system clock speed (16.78MHz). If using the default 32.768kHz sampling rate, then 512 bits are output per sample (512*32K=16M). Each sample value (9bit range, N=0..511), would be then output as N low bits, followed by 512-N high bits. The resulting 'noise' is smoothed down by capacitors, by the speaker, and by human hearing, so that it will effectively sound like clean D/A converted 9bit voltages at 32kHz sampling rate.
I thought the output of the two FIFOs weren't prescaled, and so the division by two would have lost that LSB. But according to GBATEK, it looks like it's premultiplied by 4 before being divided by 2, so there's no loss there.


Top
 Profile  
 
 Post subject: Re: GBA sound quality...
PostPosted: Tue Jan 06, 2015 1:59 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7317
Location: Chexbres, VD, Switzerland
First, you must understand that the 2 "Direct Sound" channels are typically used to simulate more sound channels by software mixing (99.99% of GBA games uses them that way). Thus it is roughly equivalent to SNES hardware. In my FF5-Sound Restoration hack I was even able to get SNES-style reverb (this just costed a lot of RAM, which was unused by the game anyway).

However, the loss of quality comes from the fact most developers wanted "economic" music replayers with few channels and features to save CPU usage for something better. Golden Sun games are without doubt the ones that got the closest to "high quality" sound on the GBA, because they wrote their own remixer which was at the bast of my FF5-sound restoration hack.

The GBA doesn't contain a proper DAC and does this by the way of PWM. There is a tradeoff between PWM frequency and # of bits. In order to mix a Direct Sound channel + some PSG audio, at least 9 bits are required, however, using 9 bits makes the PWM only 32kHz, and at this rate a lot of aliasing appears and it sounds absolutely terrible. So most game uses 8-bits and 64kHz instead, which sounds better, even if more noise is here because of the bit loss, there is at least less aliasing. This is yet another reason why they didn't want to spend time on GBA sound mixer : The hardware would ruin it afterwards anyway.

The "best practice" would be to run a sound engine that updates at exactly 32768 Hz or 16384 kHz, so that we would get no aliasing due to DAC and full 9-bit sound (except on GBC channels). But then it is impossible to update the sound engine in VBlank, and IRQs should be used.

The GBZ80 is not usable in the GBA when it is in GBA mode. The first 4 sound channels is the only GBC "component" that is usable.

Sound channel 3 was made better quality by allowing double buffering and 2-bit volume control (for a great total of 4 possible volumes). However, the sound engine 90% of commercial GBA uses doesn't appear allow to use both buffers.

Quote:
I don't know why, but I thought that it could produce better quality sound if it did not have to process game mechanics and graphics like it had to on the Gameboy.

Yes, by updating the sound engine at a higher rate than 60Hz it becomes possible to get better sound quality, i.e. more precise/accurate pitch and volume change. However, few games used this possibility.


Top
 Profile  
 
 Post subject: Re: GBA sound quality...
PostPosted: Tue Jan 06, 2015 12:20 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19347
Location: NE Indiana, USA (NTSC)
Espozo wrote:
I have a few gba video cartridges, and although muffled, the sound quality was much better than what I would hear in 90% of GBA games. I've read that the GBA has 6 sound channels (aside from lack column scrolling, this seems to be the only thing worse about the GBA than the SNES) And although 4 channels are apparently about as good as the Gameboy, it says there are 2 "Direct Sound" channels, which I assume play back actual recorded music. (You can probably tell I have no knowledge of audio hardware. :P )

In practice, due to ROM size limits and desire to change tempo at runtime, games play sequenced samples mixed in software. But it's possible to decompress recorded music, as seen in my GSM player application, in my Luminesweeper tech demo, and in GBA Video.

Quote:
Two more questions I just thought of: If the GBA is using the GBZ80 (how is this different than a normal Z80?)

The Game Boy 8-bit CPU is an 8080 clone with some (but not all) Z80 features and a "direct page" at $FF00-$FFFF.

Quote:
solely for the 4 sound channels

The Game Boy 8-bit CPU is turned off during GBA games. Only its APU remains on.

Quote:
than why aren't there more sound channels or higher quality existing ones?

One DAC for left and one for right "ought to be enough for anyone", as people have misquoted Bill Gates. Software can synthesize or mix into those DACs.

Quote:
Lastly, (though off topic) why didn't the Gameboy Micro or the DS play GB games?

Neither system generates the 5.0 V needed to run Game Boy Game Paks.

Quote:
I heard that they still have the GBZ80, as it is required for sound on GBA games.

The Game Boy micro has the Game Boy 8-bit CPU because it would have been more expensive to cut it off the die. The DS has only the Game Boy APU, not the Game Boy 8-bit CPU.

lidnariq wrote:
Additionally, I think I remember reading that the output stage of the GBA drops the LSB of the 8 bit bytes sent on the DirectSound channels, further degrading it into two 7-bit channels.

Only when the DAC is clocked faster than 64 kHz.


Top
 Profile  
 
 Post subject: Re: GBA sound quality...
PostPosted: Tue Jan 06, 2015 5:13 pm 
Offline
User avatar

Joined: Sun May 27, 2012 8:43 pm
Posts: 1311
tepples wrote:
Quote:
I heard that they still have the GBZ80, as it is required for sound on GBA games.

The Game Boy micro has the Game Boy 8-bit CPU because it would have been more expensive to cut it off the die. The DS has only the Game Boy APU, not the Game Boy 8-bit CPU.


Was any progress made on seeing if this is usable at all? If I get my hands on a Micro I'll see if it is pulsing the address lines as expected when forced into GBC mode, and maybe try giving it a (separately powered) Game Boy cartridge to read. I remember the thread from PocketHeaven about it, and I think when I last checked it years ago nothing conclusive really came about.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group