📄 myplaysnd.m
字号:
function myplaysnd(y,fs)
%
% Modified and simplified from playsnd, to make the sample rate stuff work
% PLAYSND Implementation
% MYPLAYSND(Y,FS)
%
% y = data to play
% fs = sample rate
% Copyright 1999 by Todd K. Moon
if(nargin==1)
fs = 11025;
end
t = clock;
tmpfile = ['/tmp/au' sprintf('%02.0f%02.0f%02.0f', t(4:6))];
fp = fopen(tmpfile,'wb');
if fp==-1,
error(['Cannot open ' tmpfile ' with write privilege.'])
end
my = min(y); My = max(y);
fwrite(fp, floor( 255*(y+my)/(My-my) + .5),'uchar');
fclose(fp);
str = ['!play ' sprintf('%d',fs) ' ' tmpfile];
eval(str)
delete(tmpfile);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -