HydrogenAudio

Lossy Audio Compression => Ogg Vorbis => Ogg Vorbis - Tech => Topic started by: eddyb on 2011-01-30 00:19:12

Title: Extracting frequency data from Ogg Vorbis
Post by: eddyb on 2011-01-30 00:19:12
Hi,

I'd like to extract frequency data along with PCM data from an OggVorbis stream. (Think: displaying an equalizer during audio playback.) I figure this would be much cleaner (and faster) than running a discrete fourier transform on the PCM data after the fact.

I'm a fairly high level user of libogg and libvorbis (using libvorbisfile for now), but I've poked around a bit in the code, and I suspect the data I'm looking for is in the pcm array that enters mdct_backward(). Is that correct? I'd really appreciate some pointers on where in the decoding pipeline to get at this data, and what format it's in. For instance, how is the magnitude vs. phase laid out in memory per frequency?

Many thanks!
Eddy
Title: Extracting frequency data from Ogg Vorbis
Post by: saratoga on 2011-01-30 00:32:30
I'm a fairly high level user of libogg and libvorbis (using libvorbisfile for now), but I've poked around a bit in the code, and I suspect the data I'm looking for is in the pcm array that enters mdct_backward(). Is that correct?


Thats going to give you the MDCT domain data, which is about as close to an DFT as you're going to find in Vorbis.  I'm not really sure if theres an easy way to get something that'd look right for your visualization.