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
2017년 10월 15일
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.
카테고리
도움말 센터 및 File Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!