Record sound using PC-based audio input device
Note: wavrecord will be removed in a future release. Use audiorecorder instead.
y = wavrecord(n,Fs)
y = wavrecord(___,ch)
y = wavrecord(___,'dtype')
y = wavrecord(___,'dtype') uses the data type specified by the string 'dtype' to record the sound. The following table lists the string values for 'dtype' along with the corresponding bits per sample and acceptable data range for y.
|dtype||Bits/sample||y Data Range|
|'double'||16||–1.0 <= y < +1.0|
|'single'||16||–1.0 <= y < +1.0|
|'int16'||16||–32768 <= y <= +32767|
|'uint8'||8||0 <= y <= 255|
Record 5 seconds of 16-bit audio sampled at 11025 Hz. Play back the recorded sound using wavplay. Speak into your audio device (or produce your audio signal) while the wavrecord command runs.
Fs = 11025; y = wavrecord(5*Fs,Fs,'int16'); wavplay(y,Fs);
Standard sampling rates for PC-based audio hardware are 8000, 11025, 22050, and 44100 samples per second. Stereo signals are returned as two-column matrices. The first column of a stereo audio matrix corresponds to the left input channel, while the second column corresponds to the right input channel.
The wavrecord function is for use only with 32-bit Microsoft® Windows® operating systems. To record audio data from audio input devices on other platforms, use audiorecorder.