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.

Hardware > Simulating a GBA Speaker...

#4203 - yannis - Sun Mar 23, 2003 12:26 pm

Hi there,

I am thinking of finding an external speaker to plug into my laptop which has the same frequency response as a GBA internal speaker..

does anyone know the technical details of the GBA internal speaker, and where I could find something like it to plug into a headphone socket ?

much thanks!

#4308 - tenner - Thu Mar 27, 2003 3:14 am

would it work to just know the frequensies and then use a sound editor and filter the sound thru an eq?
_________________
current signature: 7/8

#4309 - yannis - Thu Mar 27, 2003 3:17 am

no.

because I want to do this in real time. I've heard of people doing this so someone must have an idea which speakers to get hold of, which ones have the same frequency responses..
_________________
DS & GBA Audio Professional
www.GroovyAudio.com

#4312 - tepples - Thu Mar 27, 2003 4:27 am

To do it in real time, read up on IIR filters. A 3-pole Butterworth high-pass filter with cutoff frequency 800 Hz makes a good approximation of the GBA speaker's frequency response. I figured it out by playing white noise through my GBA, miking its speaker, and using Cool Edit Pro's "scientific filter" to try to come up with the closest thing. Of course, for it to sound right after this sort of filtering, you have to hook the PC up to a stereo system, not to laptop speakers with a high-pass characteristic of their own.

Here is the code for such a filter, obtained with this tool, designed for a 44100 Hz output:
Code:

/* Digital filter designed by mkfilter/mkshape/gencode   A.J. Fisher
   Command line: /www/usr/fisher/helpers/mkfilter -Bu -Hp -o 3 -a 1.8140589569e-02 0.0000000000e+00 -l */

#define NZEROS 3
#define NPOLES 3
#define GAIN   1.120799837e+00

static float xv[NZEROS+1] = {0}, yv[NPOLES+1] = {0};

static void filterloop()
  { for (;;)
      { xv[0] = xv[1]; xv[1] = xv[2]; xv[2] = xv[3];
        xv[3] = input_value() / GAIN;
        yv[0] = yv[1]; yv[1] = yv[2]; yv[2] = yv[3];
        yv[3] =   (xv[3] - xv[0]) + 3 * (xv[1] - xv[2])
                     + (  0.7960564529 * yv[0]) + ( -2.5695426386 * yv[1])
                     + (  2.7721606930 * yv[2]);
        output_value(yv[3]);
      }
  }

_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.