Gaming How do sound effects work on GBA?

biolizardshadow

Well-Known Member
OP
Member
Joined
May 4, 2020
Messages
121
Trophies
0
Age
22
XP
298
Country
United States
Is there a way for one sound effect to play two or more sounds at once during gameplay and is there a way to increase the number of direct sound samples that can be played ?
 

The Real Jdbye

*is birb*
Member
Joined
Mar 17, 2010
Messages
23,256
Trophies
4
Location
Space
XP
13,814
Country
Norway
Is there a way for one sound effect to play two or more sounds at once during gameplay and is there a way to increase the number of direct sound samples that can be played ?
Looks like technically yes, but there is only one wave output channel, which is normally what you would want to use for sound effects, you could use the noise channel to produce basic sound effects though.
https://problemkaputt.de/gbatek.htm#gbasoundcontroller

The GBA is powerful enough that doing some software mixing to mix multiple sound effects into the one wave output channel should be possible.
Or you can write directly to sound channel A and B with DMA and skip the hardware mixer:
https://deku.gbadev.org/program/sound1.html

And there are already 3rd party sound engines that allow more channels through software mixing:
https://www.shinen.com/music/music.php3?gax
 
Last edited by The Real Jdbye,

biolizardshadow

Well-Known Member
OP
Member
Joined
May 4, 2020
Messages
121
Trophies
0
Age
22
XP
298
Country
United States
hmm then I'm not sure what's going on here then. one of the sound effects I tried to get working used both square channels making sound at the same time but in game only one of the channels would make any sound while the other one would act like it was playing a sound but it wouldn't produce any sound at all. Also I forgot to mention that I use the M4A sound engine (AKA Sappy) for all of this since it's the only one available out there.
 
Last edited by biolizardshadow,

biolizardshadow

Well-Known Member
OP
Member
Joined
May 4, 2020
Messages
121
Trophies
0
Age
22
XP
298
Country
United States
Oh, didn't know that custom made sound engines like that were out there; I was pretty much just wondering if there is a way to change sound limits placed within a games code since the rom hack I made is not able to output two channels making sound at once for one sound effect and only has a 10 track limit with only 6 direct sound samples that can be played at anyone time; anymore than that and the game sort of freaks out and doesn't work properly; though that might be because of ram limitations. But if so, then is their a way to change that?
 
Last edited by biolizardshadow,

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
Most things in the GBA are streamed from the cartridge itself (need for speedy things there is why GBA carts are so costly as you need RAM/fast NOR rather than just kicking it to cheap and cheerful NOR, and also why running ROMs from the DS slot on the DS never really took off). To that end I don't know if it is going to be RAM limitations or channel limitations (things got so much nicer on the DS for that one -- 16 free to use for anything channels rather than 6 with 3 having specific uses and two of the remaining also be more specific on the GBA).
The A and B channel stuff does however tend to go from RAM but it is usually samples so should be a different matter.

I tend to play to hardware limits as well and am not much of a composer anyway, and if I play in GBA sound world it is usually more about removing annoying notes or ripping things.

10 tracks sounds like a menu selection limit which is software. How easy it will be to add more in might vary depending upon the game.

Anyway sounds like I would need to analyse the game and its audio handler here to see what it tries to do and what its limitations are, and what it might take to get it to exceed them.
 

biolizardshadow

Well-Known Member
OP
Member
Joined
May 4, 2020
Messages
121
Trophies
0
Age
22
XP
298
Country
United States
Well if you're interested the game is (Megaman & Bass GBA) that's why I was trying to figure out what if any channel limitations there are for the GBA besides those of the original Gameboy. This whole thing of having samples mixed software side brings and interesting question though; now I'm not an expert when it comes to GBA sound hardware but from what I've heard things like number of samples and sample rate are all handled through software so is it possible for a GBA game to produce the same or almost the same audio quality as a DS game? Now I'm not sure what the output sample rate of the DS is so I may be wrong here but it's still interesting to say the least.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
Sample rate might be a bit ambiguous a term

For wave audio then people will usually speak of bit depth (how many bits are used to represent a volume, though it will be lower here which can make things a bit more mushy sounding) and sample rate (how many times a second new data can be sent to a speaker, humans hear to about 22KHz and you need double that (going up and coming down on the wave) to represent that hence things going for 44KHz (any more is only really useful in mastering and if you want to normalise audio). Speech is far lower (females topping out for most purposes around 9KHz) and a piano lower still (some 4Khz for the highest C on your conventionally concert tuned 88 key affair).

For sequenced audio then variously how many individual tones can be added to a "chorus" is noted (NES being capped at three, aka a basic chord*, and you can go read/recall the horror of "polyphonic" ringtones on you own time), how often they can switch out, and what frequencies as discussed above their tone generation (and later in life wave samples) might be in would be of interest as well. There are further things it might do with decays and other things places like https://hcs64.com/mboard/forum.php and all the plugins for various audio players to play back https://www.zophar.net/music spend their days debating the accuracy of emulation for but we can probably skip that one for now.

*might as well have the extra credits from when they were still pumping out good stuff


For wave audio then anything much above telephone grade is enough to fully saturate the hardware and thus play whatever you feed it at a range beyond what most people and trained musical types are going to be able to make out individual notes for if you so desired (most of the time you wouldn't want that as it tends to sound like noise but it is never the less possible). If it is not premade then generating that in real time was a viable enough option I guess by the time the GBA was a thing. The GBA also dodges much of the fun with different wave types and decay rates seen in older devices (though some might call them limitations of the GBA's architecture/the GBA being simple and basic and I could stand to hear that argument).
That said doing that sort of thing is generally considered a bit of a last resort or "you better have a good reason for doing this" (it was only an ARM7, as in does not even know how to divide or handle fractional numbers and doing multiple operations to multiple bits of data all at once is right out, clocked at a blistering 16MHz with less than 512 Kilobytes of RAM -- http://problemkaputt.de/gbatek.htm#gbatechnicaldata ). Cropping things down into sections to play those back being what most would top out at.
When people talk of software defined type setups they are likely more referring to the options you can feed the audio hardware to tell it what tones to generate or how to alter them rather than in hardware mixing of a sort, give or take the option to play back an essentially wave track and have tones (or maybe one ultra short sample, enough for a gunshot, grunt or very short catchphrase) generated on top of things without the backing necessarily having to fade out to do it. That or ways to cycle tracks in and out rather than necessarily being locked into one and shifting to a new one being a big deal.

The DS on the other hand as 16 general purpose channels (as in could be various types of wave, noise or playback) that could all play back fairly high quality what is essential PC style wave audio. Its DAC (digital analogue converter) was nothing special so it sounded a bit fuzzy and I am not sure we have any options for improvement or bypass there like we do for older systems. If one wave channel was enough to make people unable to detect individual notes then 16 definitely is, though that just meant easy sound effects on top of backing tracks for the most part (open up random games in something like desmume and watch how many channels are ever in use). Likewise plenty of DS devs seemed to opt for "maximum volume at the lowest quality we can because space is expensive" if my time fiddling with DS stuff is anything to go by.
 

biolizardshadow

Well-Known Member
OP
Member
Joined
May 4, 2020
Messages
121
Trophies
0
Age
22
XP
298
Country
United States
Very interesting, so for the GBA there was a lot more than just sending a wave (or waves) to the DAC for playback also you said that a low bit rate can cause the audio to sound mushy which I didn't know. I thought that bit rate only effected wave volume and the sample rate is what makes the audio sound crisp or mushy so then maybe it's a combination of both? Though one thing the GBA has over the DS is it has a programable waveform channel (which the DS does have for backwards compatibility with GBA games) but I'm not sure if the 6 GBA channels are available when in DS mode so there may be a posability of using them but I'm not really sure about that.
 
Last edited by biolizardshadow,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: @Psionic Roshambo, atleast there was some neat filler there