Monitoring and detecting audio gap

Hi, I have an audio speaker that receives audio data from a PC on the network. The system is mostly working, but sometimes audio gaps occur during playback. It happens quite rarely, so I don't want to stay around, listening to it constantly to detect the audio gap. Here is what I want to do, but I'm not sure if it's possible with matlab or not:
I want to generate a 1 KHz tone from the PC on the network to this speaker. Then I want to record the audio that arrives at the speaker using MATLAB. But the recording shouldn't be done into a file. Instead MATLAB should record the audio into a matrix and should confirm that the audio samples received represent a clean 1 KHz tone. I am thinking something like doing continuous FFT and validating that there is high energy around 1 KHz and very little energy anywhere else. Is this possible? Or is there another method that would work better? Basically, matlab should be like a continuous listener and detector of an anomaly with the 1KHz tone.

답변 (1개)

Image Analyst
Image Analyst 2017년 10월 15일

0 개 추천

If the gap is an artifact of the playback, and not actually in the signal, and you record through a microphone the played back signal, then I think you might be best off just computing the longest stretch of silence in the time domain rather than using the Fourier domain like you'd do with spectrogram(). Of course neither the input, nor the recorded output signal should have any silent stretches longer than a fraction of a second.
silentParts = signal < 0.05; % or whatever
% Get rid of silent stretches shorter than 50 elements (or whatever);
silentParts = bwareaopen(silentParts, 50);
% Measure lengths of the remaining silent parts.
props = regionprops(silentParts, 'Area');
if length(props) >= 1
% There is at least one silent part.
allSilentLengths = [props.Area];
end
% The longest silent part = max(allSilentLengths) elements long.

댓글 수: 2

taydin
taydin 2017년 10월 16일
Thank you for the answer. I will try this now.
The test tone is a fixed 1 KHz continuous tone. If I also wanted to test for any cracking, popping, or other noise, would the continuous FFT catch these even if they are momentary? Even a few samples that are off will cause an audible click, but I'm not sure if the continuous FFT would miss these ...
Image Analyst
Image Analyst 2017년 10월 16일
Try it and see.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

태그

질문:

2017년 10월 15일

댓글:

2017년 10월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by