Spectrum Analysis using FFT and Hanning Window
4 views (last 30 days)
Show older comments
I need to conduct spectrum analysis on a pre-recorded audio file (.wav), using FFT and a Hanning window (size: 1024).
I am using the MIRtoolbox, DSP System Toolbox and Signal Processing Toolbox.
I've tried to do this using the below code, but keep getting errors.
MATLAB code
>> a1 = miraudio('Canjo.wav','Extract',8,15);
Computing miraudio related to Canjo.wav...
Computing mirsum related to Canjo.wav...
Elapsed time is 0.078341 seconds.
>> L = 1024;
>> w = hann(L);
>> mirspectrum(a1,'Window',w)
Here are the error messages.
MATLAB code
Operands to the || and && operators must be convertible to logical scalar values.
Error in miroptions (line 284)
if length(varg) > i && ...
Error in mirfunction (line 40)
[orig during after] = miroptions(method,orig,specif,varg);
Error in mirspectrum (line 294)
varargout = mirfunction(@mirspectrum,orig,varargin,nargout,specif,@init,@main);
Any help would be very appreciated, thanks!
0 Comments
Answers (1)
Santhana Raj
on 17 Mar 2017
Check the Syntax of the miraudio command.
As far as I can see, when you use 'Extract' option, you have to provide t1,t2,u,f. Out of which f is optional. I see that you have not mentioned u (unit of t1 & t2), which can take the value of 's' or 'sp'.
0 Comments
See Also
Categories
Find more on Spectral Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!