to capture the buffer of a microphone - visual-c++

I am creating a program that will record microphone audio and convert it into mp3 using the DirectShow API in Visual C++.
There is no built in filter to convert to convert audio into MPEG Layer 3 i.e. MP3 so i want to send the mic buffer to an external library called as LAME , it will convert the data in MP3 and then i can write it to a file using a file writer.
But the problem is that i dont know how to access the buffer of the microphone , please help me i am new in directshow programming..
or tell me any other way to do it

If you want to distribute your application then I will suggest to use Sample Grabber instead of Lame DirectShow Encoder filter. This will avoid filter registration but you will need to handle conversion logic.
Regarding using LAME encoder,
what is the return value of hr = pOutputDevice->FindPin().
you can give a try using GraphEdit and check for pin properties.

You should be able to do this using a Sample Grabber.
You set it up with a callback object that will receive the samples. You can create a graph with just the source, the sample grabber and a Null Renderer.

Related

Writing an Audio Decoder for Windows Media Player

I have a custom audio decoder for g711.1 (please note that this is different from g711) which should work with WMP.
So when a WAV file containing g711.1 encoded audio is opened by WMP -
the decoder will be invoked and the file will be played.
As i understand a wrapper is needed for the decoder to comply with interface(s) WMP is using,
and also some way of registering the decoder so WMP will know from where to load it and use it for g711.1.
Where can i find a recipe for making a WMP decoder, or better, a sample of a simple decoder?
I have looked at the Media Foundation Sample "Decoder", but not sure this is the correct sample for me.
Thanks.

How can I access the audio output coming from a movie playing in processing?

I am working on a film analysis program, which retrieves data in realtime from a movie, that is playing in the same sketch. For analysing the sound I tried the minim library, but I can't figure out, how to get the audio signal from the movie. All I could do was accessing an audio file, I was loading into the sketch manually, or the line-in through the mic.
Thanks a lot!
Although GStreamer (used by the processing-video library) has access to audio, the processing-video library itself doesn't expose that at the moment.
You will need to use workarounds at the moment:
Extract audio from your movie and load straight into minim. (you can trigger audio playback at the same time as movie playback if you need to)
or use a tool to use system audio output as an input (minim get line in). On OSX you can use Soundflower. Another option is JACK and it's patch interface.

ffmpeg - Can I draw an audio channel as an image?

I'm wondering if it's possible to draw an audio channel of a video or audio file as an image using ffmpeg, or if there's another tool that would do it on Win2k8 x64. I'm doing this as part of an encoding process after a user uploads a video or audio file.
I'm using ColdFusion 10 to handle the upload and calling cfexecute to run ffmpeg.
I need the image to look something like this (without the horizontal lines):
You can do this programmatically very easily.
Study the basics of FFmpeg. I suggest you to compile this sample. It explains how to open a video/audio, identify the streams and loop over the packets.
Once you have the data packet (in this case you are interested only in the audio packets). You will decode it (line 87 of this document) and obtain the raw data of an audio. It's the waveform itself (the analogue "bitmap" for an audio).
You could also study this sample. This second example is how to write a video/audio file. You don't want to write any video, but with this sample you can easily understand how the audio raw data packet works, if you see the functions get_audio_frame() and write_audio_frame().
You need to have some knowledge about creating a bitmap. Any platform has an easy way to do that.
So, the answer for you: YES, IT IS POSSIBLE TO DO THIS WITH FFMPEG! But you have to code a little bit in order to get what you want...
UPDATE:
Sorry, there are ALSO built-in features for this:
You could use those filters... or
showspectrum, showwaves, avectorscope
Here are some examples on how to use it: FFmpeg Filters - 12.22 showwaves.

Direct show samples (AMCap) on Platform SDK with MP4 file

I want to generate .mp4 file using Direct show samples (AMCap). But i don't know how to implement this.
Can anyone please help me about this?
Thanks in advance,
Dhaval Kariya
AMCap Sample captures and displays video. No encoding and choices of multiplexing into files (only basic capture/recording through a basically obsolete helper interface).
Video capture application.
This sample application demonstrates the following tasks related to
audio and video capture:
Capture to a file
Live preview
Allocation of the capture file
Display of device property pages
Device enumeration
Stream control
The items above might be confusing as they mention capture and file allocation. This is a trail of 15 years old history when file capture was a big deal. The helper object to initialize capture targets AVI and ASF/WMV only, you neither can extend it to support other formats, nor you need to.
You need to check how to store video/audio into files (see below) and follow the same steps in building the pipeline with MPEG-4 encoders and multiplexer. You will need to use a third party MPEG-4 multiplexer for MP4 file format because Windows does not provide you with such out-of-the-box usable component.
See:
Capturing Video to a File
Free DirectShow Mpeg-4 Filters

How does one Capture MP3s in J2ME?

I was able to capture audio in the WAV format through Manager.createPlayer("capture://audio"). However, is there a way to capture audio in the MP3 format in J2ME?
It will likely depend on the platform in question, you would have to check the different device implementations you want to support.
Rory, what do you mean?
I was really asking for the String for the createPlayer(String s) method. J2ME automatically records to a WAV file, but I was wondering if I could request it to record to MP3. Of course if that MP3 argument did not work, a MediaException would be thrown. Please forgive me if it seems that I am missing the point of your response.

Resources