The program is intended to simplify the recording and basic editing of speech waveforms as well as to present the spectrogram and the time waveform in a side-by-side format for ease of analysis.
Before you can do any recording through Record, you will need to connect a microphone or other sound source to the microphone input on your sound card. The next step is to ensure that your computer is set up to record from the microphone. On a Windows machine, you must select the microphone as the source in the Record Control window. The Record Control window can usually be accessed from a speaker icon in the system tray.
Running the program:
The program can be run by typing record at the MATLAB prompt or by opening the program in the MATLAB editor and selecting Run from the Debug menu
Sound recording is initiated through the MATLAB graphical user interface (GUI) by clicking on the record button. The duration of the recording can be adjusted to be anywhere from 1 to 6 seconds. (These are the GUI defaults, but the code can be modified to record for longer durations if desired.)
Upon being clicked, the record button executes a function that reads in mono data from the microphone jack on the sound card and stores it a MATLAB vector.
Most of the important information in a typical voice waveform is found below a frequency of about 4 kHz. Accordingly, we should sample at a least twice this frequency, or 8 kHz. (Note that all sound cards have a built in pre-filter to limit the effects of aliasing.) Since there is at least some valuable information above 4 kHz, the Record GUI has a default sampling rate of 16 kHz (however, the waveforms portrayed in this document were sampled at 11.025 kHz).
Once recorded, the time data is normalized to maximum amplitude of 0.99 and displayed on the upper plot in the GUI window. In addition to the time domain waveform, a spectrogram is computed using MATLAB's built in specgram function (part of the signal processing toolbox).
Zooming in on the Waveform:
One can examine a region of interest in the waveform using the Zoom in button. When Zoom in is clicked, the cursor will change to a cross hair. Clicking the left mouse button and dragging a rectangle around the region of interest in the time domain waveform will select a sub-section of data.
The Zoom out button will change the axis back to what it was before Zoom in was used. If you zoom in multiple times, zooming out will return you to the previous axis limits.
Listening to the Waveform:
The Play button uses MATLAB's sound function to play back (send to the speakers) the waveform that appears in the GUI. If you have zoomed in on a particular section of the waveform, only that portion of the waveform will be sent to the speakers.
Saving and Loading Data:
Save is used to write the waveform to a wave file. If zoomed in on segment of data, only that portion of the waveform will be saved.
Click Load to import any mono wave file into the Record GUI for analysis.
For a full description, see:
Requires data acquisition toolbox:
Error in record>init_sound (line 396)
ai = analoginput('winsound');
This can be done without that toolbox:
Hi, I'm a new member in this site.How can I take the code ?
Does anyone know how to export the amplitude data as numbers (not as a .wav file)? Thanks in advance
I'm using this file and some times it works correctly, and other times it doesn't. If I set the record time to 3 seconds, matlab warning, "SamplesPerTrigger must be specified as scalar integer value". The playback file is also wrong because if I pause 2 seconds before clapping my hands, the amplitude shows I clapped at 0.1 seconds. Other times the file works great.
I've used the core components of this code for my own code that times from a beep to the user's hands clapping together. My code has the same error(s) as this because it says the hand claps start almost instantly.
If I load a .wav file that was recorded and saved by record.m the pause before first clap is correct.
I'm using R2009b. I have the same problem on 2 computers one is a desktop with 32 bit vista, the other is a 64 bit windows 7 laptop.
Excellent code...... VERY VERY Useful
code for voice record in matlab
Real great, thx a lot, this is really what I needed.
But how do we do to recod a random length sound ?
Wonderful!Thank you,but if you may give an example, it's convenient and comprehensible!
Wonderful! Simple yes, but it saved me the time of doing it!
simple program with good description. easy to understand.tq.
simple, usefull and user friendly. thanx before
I have not try it, however I read the whole think and looks good.
Thank's alot, it works fine.
But may be someone knows how to make recording not with time slider and "record" button, but with 2 buttons: "record" and "stop recording"?
Thank you in advance!
How would you do this program if you didn't have the data acquisition toolbox?
It is very nice. Thank you. Just one short question, which I belive relates to Matlab or PC and less to this file. How do we record stereo from microphones? What is the wav file format? Is it interlaced (left right left right etc) or other fileformat?
is v good. But can anyone know how to stop a (.wav) file while it is playing?? I have tried using the stop(player), it doesn't work. It will just hang up the whole system. So do anyone have the solution to this problem??
its very nice...
THIS SITE REALLY GIVING GOOD INFORMATION
Excellent : very usefull, user-friendly, works well.
But it will be a good thing that to have a kind of scale for the spectrogramm especially for novices...
run this program on 6.5,I find only show a GUI without everything on the GUI panal.
I cannot run it on v6.51 and an error
"??? Undefined function or variable 'analoginput'.
Error in ==> C:\MATLAB6p5p1\work\record.m (init_sound)
On line 396 ==> ai = analoginput('winsound');
Error in ==> C:\MATLAB6p5p1\work\record.m
On line 130 ==> ai = init_sound(R_fs,R_samp_len);
??? Error while evaluating uicontrol Callback."
will show in the command window. Jesse any changes or suggestion to this problem?
very nice program, help me much! thanks
This GUI is very useful for my project, speaker verification. I will apply to my presentation. Committes must love it.
I have a question .. I'm trying to convert the sound file that I have (*.wav) so I can get its vector form. I need it to do the feature extraction and classification. Can you help me ? Or anyone can help me ? Waiting for your reply. Thank you.
i had any problem about save sound
by'wavwrite' and play it
by'windows media player'.
please help me.
Could not use the file because there are functions called from other toolboxes that were not listed and that I don't own.
The description says "Required Products: Signal Processing Toolbox" however the analoginput.m function from the Data Acquisition Toolbox is used as well as the getrect.m function from the Image Processing Toolbox.
very useful, Thank-you