Why can I not use findpeaks with this audio signal?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Taylor Gray
am 4 Mär. 2019
Beantwortet: Star Strider
am 4 Mär. 2019
Honestly not used the software much at all I understand this may be a very simple problem. My aim is to spectrally analyse an audio signal and extract its modes (frequency peaks) to spectrally model in max msp. Also if anyone knows a better way to find out the frequencies and amplitudes of peaks of an audio signal please let me know. Below is the code that will not work, I have also attached the audio sample I would like to analyze:
clear;
clc;
close all;
[audio_file, Fs] = audioread("honours_gun.wav");
findpeaks(audio_file);
Below is the error it returns:
Error using findpeaks
Expected Y to be a vector.
Error in findpeaks>parse_inputs (line 199)
validateattributes(Yin,{'double','single'},{'nonempty','real','vector'},...
Error in findpeaks (line 136)
= parse_inputs(isInMATLAB,Yin,varargin{:});
Error in Test (line 5)
findpeaks(audio_file);
0 Kommentare
Akzeptierte Antwort
Star Strider
am 4 Mär. 2019
The findpeaks function takes a vector input for the first argument. Note that ‘audio_file’ is a (8447 x 2) (stereophonic) matrix.
Use:
findpeaks(audio_file(:,1));
or
findpeaks(audio_file(:,2));
instead.
I doubt that you will get any useful information from using findpeaks as you are, with no additional arguments.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!