Why can I not use findpeaks with this audio signal?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Taylor Gray
le 4 Mar 2019
Réponse apportée : Star Strider
le 4 Mar 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 commentaires
Réponse acceptée
Star Strider
le 4 Mar 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 commentaires
Plus de réponses (0)
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!