soundbutton.m

来自「带功率谱展示和声音输出的交互的信号生成器的源代码。」· M 代码 · 共 25 行

M
25
字号
function SoundButton(n,h)
% Added in version 1.1
% Updates the value of soundmode and plays the signal vector y as a sound through the computer speakers
% Tom O'Haver, May 2007

global x
global y
global samplingtime
global samplerate
global f1
global f2
global signaltype
global signalstring
global soundmode

soundmode=round(n);
if soundmode==1,
    xlabel([ 'n= ' num2str(length(y)) '    Time = ' num2str(0.1*round(10*samplingtime)) '    Rate = ' num2str(round(samplerate)) '    F1 = ' num2str(0.1*round(10*f1))  '    F2= ' num2str(0.1*round(10*f2)) '   Sound ON'])
else
    xlabel([ 'n= ' num2str(length(y)) '    Time = ' num2str(0.1*round(10*samplingtime)) '    Rate = ' num2str(round(samplerate)) '    F1 = ' num2str(0.1*round(10*f1))  '    F2= ' num2str(0.1*round(10*f2)) '   Sound OFF'])
end
wavplay(y./2,samplerate)


⌨️ 快捷键说明

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