How To Program Sound?


mrsnature

Member
Joined
Jul 22, 2003
Messages
462
Hi guys,

Hoping somebody can help,

I'm new to programming any sort of sound. I've recently completely a university programming project (in Linux and Windows) and was thinking of porting it to the gp2x. However, it relies on openGL and the FMod sound libraries. I'm confident i can rewrite the opengl code as it isn't very advanced, but I was wondering how I would go about reprogramming the sound side of things?

The requirements are quite basic, but in addition to just playing the sound (as i think a few libraries available on the gp2x offer) I need to be able to read something like a sampled frequency spectrum from it at any time (like the little visualisations you see in any mediaplayer). I also need to be able to speed up or slow down the music, and some other more basic stuff.

Is there anything already available for gp2x programming that may make this possible, or does anybody have any suggestinos on where to start writing my own?

Thanks for any help,

Sam
 
cheers, i had looked into this but was under the impression it was only useful for simply playing sounds etc, mainly due to the Doc Wiki I found from the official page which I now see is less than complete...

I think I found some better documentation now so i'll look into it, thanks

Edit:

Well I checked out the more extensive information and I'm still at a loss as to how to use this to process the sound in any of the ways I need. Maybe if you could give me a hint or somewhere I might look...

I've found some demos but they seem to only play, mix and adjust the volume of the music.

Maybe if I could find documentation regarding how the data is stored in the memory pointed to by the Mix_Chunk variables, I might be able be able to process this data myslef.

Thanks, Sam
 
If you want to use SDL, then you can always write directly to /dev/dsp - that'll take standard 8/16-bit mono/stereo samples.
 
thanks Squidge, this seems like it could be very useful. I found good basic tutorial on programming to /dev/dsp.

I guess I just need to learn more about processing the samples, but with this lower level access this should offer the control I need.

Edit:

Ok, i think I'm starting to understand how it works...seems quite a simple idea.

Just one more thing, and I'll go off and do some more research on my own :)... does anybody know of any libraries that can decode mp3 files into raw 8bit sampled data i can pass to /dev/dsp? I tried googling but putting mp3 in a search term seems to return lots of rubbish ;)

Another Edit:

Found this: Mad Mpeg Decoder, and this madxlib and i think this is exactly what i need? I take it this is what the madplayer for the gp2x uses too... so I assume it should work fine.
 
Back
Top