Why can I not use findpeaks with this audio signal?

3 ビュー (過去 30 日間)
Taylor Gray
Taylor Gray 2019 年 3 月 4 日
回答済み: Star Strider 2019 年 3 月 4 日
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);

採用された回答

Star Strider
Star Strider 2019 年 3 月 4 日
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 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by