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

4 次查看(过去 30 天)
how to determine the highest peak and its frequency for a real time sound signal

回答(5 个)

Taieb Cheikh
Taieb Cheikh 2017-11-13
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 2017-11-13
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 2017-11-13
thank you for your reply indeed , I need to know the frequency of the highest peak
  1 个评论
Christakis Loizou
Christakis Loizou 2017-11-13
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.

请先登录,再进行评论。


Taieb Cheikh
Taieb Cheikh 2017-11-14
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 2017-11-16
any help please ?

Community Treasure Hunt

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

Start Hunting!

Translated by