how to determine the highest peak and its frequency for a real time sound signal

7 views (last 30 days)
how to determine the highest peak and its frequency for a real time sound signal

Answers (5)

Taieb Cheikh
Taieb Cheikh on 13 Nov 2017
here is my program :
SamplesPerFrame = 3073;
Microphone = dsp.AudioRecorder('SamplesPerFrame', SamplesPerFrame,...
'OutputDataType','double');
Fs = Microphone.SampleRate;
Spectra = dsp.SpectrumAnalyzer('SampleRate',Fs,'PlotAsTwoSidedSpectrum',false,...
'SpectralAverages',20,'FrequencyScale','Log');
tic;
while toc < 100000
audioIn= step(Microphone);
step(Spectra,audioIn);
audio=audioIn(:,1);
[pk1,lc1] = findpeaks(audio,'SortStr','descend','NPeaks',3);
end
release(Microphone);
release(Spectra);
what should I do to get the frequency of the highest peak ???

Chris Loizou
Chris Loizou on 13 Nov 2017
Hi Taieb, well it would be nice if you could be more specific about the frequency of the signal you want to process. Do you need the frequency of the highest peak? Because a signal is actually made from multiple sine waves so to say that you need only one frequency would be a mistake. if you need to know the frequency of the highest peak that's another thing. In order ot find the highest peak you can check the function findpeaks on matlab ( https://www.mathworks.com/help/signal/ref/findpeaks.html) or just search for the max value in your data.

Taieb Cheikh
Taieb Cheikh on 13 Nov 2017
thank you for your reply indeed , I need to know the frequency of the highest peak
  1 Comment
Christakis Loizou
Christakis Loizou on 13 Nov 2017
well if you need to know the frequency of the highest peak do the fft. Or if you know the time(seconds) differnce between two max peaks then the frequency=1/time.

Sign in to comment.


Taieb Cheikh
Taieb Cheikh on 14 Nov 2017
so , as I mentioned before , it is a real time signal processing , which I need to get the highest peak every second ( see my code above )

Taieb Cheikh
Taieb Cheikh on 16 Nov 2017
any help please ?

Community Treasure Hunt

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

Start Hunting!