how to deal with audio in all kinds of format?

Started by
2 comments, last by nethu 21 years, 9 months ago
I want to develope a audio analyses system and can support most kinds of format.But the directsound can support wav format only. I want to find a way that can decode these formats and put the data had decoded into directsound buffer to process.Is this way viable? what method should I use?
Advertisement
DirectShow? You can probably write a filter/DirectX Media Object (DMO) to modify/custom output the sound.
---visit #directxdev on afternet <- not just for directx, despite the name
Actually DirectSound uses PCM data, now wav data. There is a difference. For example, I wrote a DirectSound-based sound system which could play Ogg Vorbis since the Ogg Vorbis code provided a decoder which decoded into PCM format. As long as you can decode what you want to play into PCM format, you can play it through DirectSound buffers.
if you just want to analyze audio, either:

1. use directshow to support anything it supports (mp3, wma, etc)
2. winamp plugin, which will support for anything the user has a plugin for
3. support only reading wavs and focre the user to convert
4. if realtime, read data from the sound card (ie mic, line in, wavout, mix, midi, etc) via directsoundcapture. MUST run in realtime, but can support anything playable through the sound card like radio, guitar, mp3 (any decoder), wma, ogg, etc. there will be some latency, but nothing too high.

personally i think realtime processing would be best (for analysis) but the may not be possible depending on how you are exactly trying to analyzing the audio.

also, yes you can capture audio, process it, then play it back through directsound with acceptable latency. the dx sdk has an example of this (though it uses buffers that are chunked a bit large).

This topic is closed to new replies.

Advertisement