gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > Maximum Beep Frequency with Built-In Speaker

#101804 - biolizard89 - Fri Sep 08, 2006 4:23 am

According to The Audio Advance at http://belogic.com/gba/, the maximum frequency for sound channels 1 and 2 is 131kHz. I'm wondering whether beeps with such a high frequency can actually be played over the built-in GBA speaker. Specifically, I would like to play a 40kHz beep over the built-in speaker; is this possible? Does it matter whether I use a GBA, GBASP, GB Micro, DS, or DS Lite (I don't care if I have to use a specific one, but if it requires a DS, it would have to work in GBA mode, since I don't have DS libraries for my project)?

In case anyone's wondering why the heck I would want to play a 40kHz beep when it's inaudible to humans, I'm using a Charmed Labs Xport Botball Controller (robotics controller which uses the GBA for processing purposes) along with an SRF04 sonar sensor (which uses 40kHz sound pings). I would like the GBA speaker to be able to trigger the sonar's listening circuitry by emitting a beep at the same frequency that the sonar is listening for (40kHz). I don't know for a fact that it will work, but I'm just wondering if the GBA's built-in speaker makes it impossible to use such high frequencies.

Sorry if this is a stupid question; I couldn't find any such information anywhere.

Thanks in advance.

#101808 - tepples - Fri Sep 08, 2006 4:54 am

There is a band-pass filter on the GBA's output. I know that the speaker itself acts as such a filter; one might be present on the headphones as well. I also seem to remember the DAC running at 32.7 kHz by default, so any attempt to produce tones higher than half that will just make aliasing. The trick here is to set the DAC to 6-bit using the SOUNDBIAS register, so that the DAC runs at 262 kHz.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#101852 - keldon - Fri Sep 08, 2006 11:52 am

You have to consider the frequency response of the speakers you are trying this with.

Don't look at the 20hz-40k figure, get the frequncy response curve and see how much of the sound it picks up.