MATLAB: Can I not use findpeaks with this audio signal

errorfrequencyMATLABpeaksSignal Processing Toolbox

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);

Best Answer

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.
Related Question