?? f_getsound.asv
字號:
function [x,cancel] = f_getsound (x,duration,fs,xstr);
%F_GETSOUND: Record sound from PC microphone
%
% Usage: [x,cancel] = f_getsound (x,duration,fs);
%
% Inputs:
% x = an array of length n containing original samples
% duration = length of recording in seconds (0 to 10)
% fs = sampling frequency in Hz (default 8000)
% xstr = optional name containing string specifying name to use
%
% Outputs:
% x = an array of length N = floor(duration*fs) containing
% microphone samples
% cancel = true if cancel button is clicked
%
% Notes: This function requires a Windows PC.
%
% See also: SOUNDSC
% Initialize
channels = 1;
dtype = 'double';
seconds = f_clip (duration,0,10);
if nargin < 3
fs = 8000; % 8000, 11025, 22050, 44100
end
if nargin < 4
xstr
% Record the sound
cancel = 0;
N = floor(seconds*fs);
xstr = inputname(1);
caption = sprintf ('Click Start to begin recording %.1f seconds of microphone data in %s.',...
seconds,xstr);
choice = questdlg (caption,'Recorded Input','Start','Cancel','Start');
if strcmp(choice,'Start')
x = wavrecord (N,fs,channels,dtype);
else
cancel = 1;
end
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -