⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 play.m

📁 英文书《Digital Signal Processing with Examples in MATLAB》附带的MATLAB实例
💻 M
字号:
function play(y,fs,t)
% play(y,fs)
% 
% Same as wavplay except range of y is adjusted to +-1.
%
% y  =sample vector.
% fs =sampling rate (8000,11025,...etc.).
%
% Note: you may add a third argument, t, >0 and <length(y)/fs.
% Play is then terminated at t seconds.
if nargin<2
    error('Not enough arguments.');
elseif nargin>3
    error('Too many argurments.');
elseif max(y)-min(y)<=0
    error('Zero signal vector.');
end
scale=2/(max(y)-min(y));
ys=(y-min(y))*scale-1;
K=length(ys);
if(nargin==3)
    K=min(K,max(1,fix(t*fs)));
end
wavplay(ys(1:K),fs);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -