Discussion:
Advice on recording audio directly to mp3 format
(too old to reply)
a***@gmail.com
2009-09-23 07:27:18 UTC
Permalink
Hi friends,
We have to create an application which has to record
audio from microphone into an mp3 file directly.

Previously we had used 'MCI' to create 'WAV' files , but we want to
move onto mp3 format.(Our project is best done with mp3)
The recording will be for nearly 6 mins.

We do not want to encode a 'WAV' file to 'mp3' format as it will take
3 mins easily.(The application has to support instant playback of the
recorded audio after recording and saving the file)

The application has to work in Xp,Vista and 7.
I have searched on this , but i'm not sure whats the best way to
implement this.

1. DirectShow
This has mp3 support built-in and i have seen a forum post that a
mp3 file is directly created.But the poster has also said that this
DShow workflow fails in Vista because of a codec problem

http://www.eggheadcafe.com/conversation.aspx?messageid=29149670&threadid=29149670

2. DirectSound
I do not know much about DirectX. But users (also docs) have said
it is possible to record audio using DirectSound.
Is it possible to use it for recording into mp3 directly?
Some have mentioned about using ACM (Audio compression Manager) in
tandem with DirectSound for format conversion.

I'm quite new to audio recording in windows. The question i have
posted maybe a repeated one, but it would be really helpful for me if
one of you could point me in the right direction.

Thanks a lot for your time. :)

arvind
Alessandro Angeli
2009-09-23 10:18:29 UTC
Permalink
Post by a***@gmail.com
The application has to work in Xp,Vista and 7.
I have searched on this , but i'm not sure whats the best
way to implement this.
[...]

Your data pipeline has 3 stages: recording, encoding and
saving.

Recording can be done using waveIn or DirectSound and will
provide you with buffers of uncompressed LPCM audio data.
Both waveIn and DirectSound can be used directly or wrapped
in DirectShow.

Encoding requires an ACM codec, a DMO encoder, a DirectShow
filter or a custom encdoding library. ACM and DMO encoders
can be used directly or wrapped in DirectShow. A custom
encoding library can only be used directly unless you wrap
it yourself to be used in a standard framework.

Since an MP3 file is just a raw MP3 elementary stream, you
can save it using a file writing API or the Dump filter in
DirectShow (a sample in the SDK).

The stock MP3 encoder provided in Windows XP is an ACM codec
so you can choose to use DirectShow for the whole pipeline
or use it directly: waveIn|DirectSound -> ACM -> file I/O.

If you want your code to work in NT6.x, you need a
third-party MP3 encoder in which case your options depend on
the API provided by the chosen encoder (but they will be a
subset of the options provided above).
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
niko
2010-02-05 12:45:01 UTC
Permalink
a very decent appliction I used to record audio is MP3 Recorder Studio
you can download it from here:
http://www.maniactools.com/soft/mp3-recorder/index.shtml

Continue reading on narkive:
Loading...