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
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
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
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
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
http://www.mathworks.com/matlabcentral/fileexchange/22115
Enjoy!
/Johan