comparing a value with previous ones during real time recording

2 ビュー (過去 30 日間)
Sadegh Rahimi
Sadegh Rahimi 2019 年 7 月 5 日
Hi colleagues,
I am trying to draw amplitude vs time plot of real time audio input, asking Matlab (R2017a) to find a value above a specific threshold and as a response, give an audio output simultaneously. For example, when I knock the table during the recording, the program should detect more intense ones (according to the threshold), and respond with an alarm sound. I wrote a program, using Data Acquisition Toolbox. It works completely fine, but I faced with a problem: When I knock the table, because of a diverse range of sound amplitude, there is more than one value (above the threshold) for each knocking. Indeed, Ideally, my code should find a peak and after that neglect next 20000 samples(0.5 second, my sample rate is 40000) or more easily, compare the value with the last 20000 value and if there is another peak(above the threshold), do not consider new data as a peak. Is there any way to solve this problem?
Your help is very appreciated.
Bests,
Sadegh
P.S. I attached code and alarm sound as zip file.

回答 (0 件)

カテゴリ

Help Center および File ExchangeAudio I/O and Waveform Generation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by