from
Interactive Power Spectrum Demo, Version 2
by Tom O'Haver
Interactive signal generator with power spectrum display and sound output
|
| SoundButton(n,h)
|
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 Windows WAVE audio device.
% 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([ num2str(f1*samplingtime) ' cycles 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([ num2str(f1*samplingtime) ' cycles 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)
|
|
Contact us at files@mathworks.com