Thread Subject: Event driven audio recording

Subject: Event driven audio recording

From: Johan Carlson

Date: 11 Nov, 2008 15:02:03

Message: 1 of 6

This is what I would like to do:
-------------------------------------
1) Start a process that monitors audio input on two channels of the sound card.
2) Audio should be sampled into circular buffers of some length of my choice.
3) Once the audio signal on either channel exceeds some predefined threshold, the function should return the contents of the audio buffers.

So, why do I want this:
----------------------------
I'm interested in recording transient audio events. They do not occur very often and not at any predefined times. I would therefore like MATLAB to continuously record sound into two circular buffers. In this way I won't miss any part of the signal as long as the buffer lengths are set up properly.

So, any ideas? To me this sounds like a problem that someone else should have run into.

Thanks in advance,
/Johan

Subject: Event driven audio recording

From: Johan Carlson

Date: 14 Nov, 2008 16:00:05

Message: 2 of 6

Hi again!

Well folks, I solved the problem myself. The solution requires the Data Acquisition Toolbox, but other than that it's fine.

I'm going to post the zip in the file exchange once I figure out how to do that.

Cheers!
/JC

Subject: Event driven audio recording

From: Johan Carlson

Date: 15 Nov, 2008 11:08:02

Message: 3 of 6

Hi again!

I now submitted my solution to the "File exchange". It may take a few days before it shows up, but search for "audiorec" and it should pop up.

Tested on Windows XP and MATLAB 2007b. Requires the Data Acquisition Toolbox, which has had the habit of changing a lot lately, causing old functions to stop working if you upgrade MATLAB. So, if it does not work on previous or newer MATLAB releases, let me know.

Regards,
/JC

Subject: Event driven audio recording

From: Rob Purser

Date: 16 Nov, 2008 01:00:19

Message: 4 of 6

Cool application.

I wanted to follow up on one comment about the Data Acquisition Toolbox changing a lot recently. I'm the lead developer, and we try to make sure not to break people's code from one release to another. Would you be willing to tell us about a place where we did break your code? We want to learn about things that we missed in order to ensure we don't deo it in the future.

Thanks very much,
Rob Purser
Senior Team lead, Test and Measurement

Subject: Event driven audio recording

From: Johan Carlson

Date: 16 Nov, 2008 07:40:21

Message: 5 of 6

OK,

This piece of code was taken from a MATLAB 6.x version:

AI = analoginput('nidaq');

Then, using the exact same hardware, but with MATLAB 2007b, I had to do this:

hwinfo = daqhwinfo('nidaq');
dev = char(hwinfo.InstalledBoardIds);
AI = analoginput('nidaq',dev);

There's only one National Instruments card in the machine, so this shouldn't be necessary.

Then, for MATLAB 2008a it stopped working again, but unfortunately I don't have that code here. I'll check with my colleague if he managed to fix it, or I will post the error messages we got.

Thanks!
/JC

Subject: Event driven audio recording

From: Johan Carlson

Date: 17 Nov, 2008 16:18:01

Message: 6 of 6

OK, now my software is available at the File Exchange,

http://www.mathworks.com/matlabcentral/fileexchange/22115

Enjoy!
/Johan

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
audio recording Johan Carlson 11 Nov, 2008 10:05:22
realtime Johan Carlson 11 Nov, 2008 10:05:22
circular buffers Johan Carlson 11 Nov, 2008 10:05:22
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com