4.58333

4.6 | 13 ratings Rate this file 104 Downloads (last 30 days) File Size: 185 KB File ID: #18596
image thumbnail

Real Time Microphone and Camera data acquisition and audio-video processing

by

 

04 Feb 2008 (Updated )

This Matlab-code is a demo for real-time audio and image processing.

| Watch this File

File Information
Description

The current Matlab-code can be used for real-time audio and image processing. Fixed-length segments of audio data are recorded from soundcard's input and an image is also captured in each block. In particular, the provided code does the following:
 - Repetively records audio segments of fixed length.
 - Plots the (applitude) values of the current audio segment.
 - Plots the spectogram of the current audio segment.
 - Calculates the mean and std values of the Zero Crossing Rate for each segment, and plots those statistics for the last five segments.
 - Calculates and plots the average spectral distance between the current and the previous audio segment. This is actually a simple measure of change detection in the audio information.
 - Captures and plots an image for each block (frame).
 - Plots an estimation of the motion between the current and the previous frames.
 - Plots the average absolute difference between two successive frames.
 - Calculates and displays the ratio of the processing time (for the feature calculation and the plotting processes) by the real signal data.
Provided M-files:
 - realTimeMic.m This is the main m-file. It reads blocks (of fixed length) of audio information and it captures one image (from an attached camera) per block.
 - zcr.m This function computes the Zero Crossing Rate of an audio signal in a short-term basis (i.e. one value of the ZCR function is calculated per frame).
In order to execute the demo, simply call the realTimeMic function with the following arguments:

 - duration: (in seconds) the duration of each audio segment (and the time interval between two succcesive images taken from cam).

 - nBlocks: number of blocks to be recorded

useVideo: 1 for recording video and 0 otherwise

For example write:

realTimeMic(1.0,100,1);

in the Matlab workspace. This will run the demo for 100 segments of 1.0 second each, and it will use the camera (it has to be attached) for capturing images.

Similar Material:
http://www.di.uoa.gr/~tyiannak

* * * * * * * * * * * * * * * * * * * *
IMPORTANT UPDATE:
More advanced audio analysis methods can be found in the MATLAB AUDIO ANALYSIS LIBRARY (http://www.mathworks.com/matlabcentral/fileexchange/45831-matlab-audio-analysis-library) which is part of the book INTRODUCTION TO AUDIO ANALYSIS: A MATLAB APPROACH (http://www.amazon.com/Introduction-Audio-Analysis-MATLAB%C2%AE-Approach/dp/0080993885)
* * * * * * * * * * * * * * * * * * * *

Acknowledgements

This file inspired Realtime Audio Input.

Required Products Data Acquisition Toolbox
Image Processing Toolbox
Signal Processing Toolbox
MATLAB release MATLAB 7.5 (R2007b)
Other requirements I have tried the demo in Matlab2007b. I have also tried it in Matlab 6.5 and it seems that there are some problems with the acquisition functions (in particular with the audio acquisition): half of the times the getdata() call (line 171) fails.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (20)
14 Jan 2014 Grigorios Kalliatakis  
25 Mar 2012 Muhammad Asim

Hi dear I am trying to process real time/run time signal using sound card. Have any one any material please share...thanks

01 Feb 2012 Sen

%%%%%%%%%%%%%%%%%%%%%%%%%%
??? Error using ==> analoginput.getdata
Timeout in GETDATA.

Error in ==> realTimeMic at 171
x = getdata(ai, duration * Fs);

05 Jan 2012 Jose Almeda

muy bueno

04 Dec 2011 stich abdou  
14 Jun 2011 Thijs

Sorry, 64-bits OS does not support 'analoginput'. Here can be found how to fix this, for the ones who are interested:
http://www.mathworks.com/help/toolbox/daq/bsn6uue-1.html

11 May 2011 Thijs

??? Undefined function or method 'analoginput' for input arguments of type 'char'.

Error in ==> realTimeMic at 34
ai = analoginput('winsound');

26 Apr 2011 Ebad Ahmadzadeh

Cool

08 Apr 2011 Ebad Ahmadzadeh

COOL

04 Jan 2010 Saviourby Quek

Hi i am not good with matlab. What if i just want to record video from a CCD camera. How do i disable the, sound recording?

25 May 2009 Bernd

are you rating your owm files?

23 Nov 2008 Theodoros Giannakopoulos  
03 Oct 2008 saud Ala  
23 Jul 2008 Theodoros Giannakopoulos

Thank you for your interest. I am not sure I understand what you ask. The audio input is ploted in line 111, and the soundcard is initialized in line 34. The current audio block is read in line 171, using command getdata().

18 Jul 2008 arun pushkar

with refrence to --->Real Time Microphone and Camera data acquisition and audio-video processing.

i am intrested in the real time audio plote formed in 1,1 subplot of your example can you help me out in giving the code?

20 May 2008 Theodoros Giannakopoulos

You probably don't have a web-camera connected to your computer. If this is the case, please run the realTimeMic() function, with the 3rd argument equal to zero (no camera data is used).

20 May 2008 dd dd

--------------------------------------------------------------------------
??? Error using ==> videoinput.videoinput at 233
There are no devices installed for the specified ADAPTORNAME. See IMAQHWINFO.

Error in ==> realTimeMic at 45
vid = videoinput('winvideo', 1);

22 Mar 2008 G Antel.  
03 Mar 2008 A. Huen  
07 Feb 2008 diego barragán

Good Work

Updates
05 Feb 2008

Link added

18 Mar 2014

Minor changes in descripton

18 Mar 2014

Minor changs in description

18 Mar 2014

Minor changes in description

Contact us