Detect signal clipping and remove
37 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a signal from a microphone that is listening for respiratory audio. When the test subject talks or moves too much, the signal clipps. I am not interested in data that occurs when the subject is talking but I am trying to figure out how to eliminate these sections of the signal from my file. Either remove them entirely, or replace them with a mid level value.
Would anyone here have a good suggestion as to how I could execute this?
Thank you very much in advanced.
0 个评论
回答(3 个)
Star Strider
2021-7-22
编辑:Star Strider
2021-7-30
Without an example signal, I am guessing that the ‘clipped’ or ‘railed’ parts of the sound would be equal to ±1, with the valid data being within those limits, however not equal to them. One option would be to set all the values equal to ±1 as NaN, then use rmmissing to delete them, or similar functions (all introduced in R2016b) to interpolate them.
It will likely be necessary to experiment to get the result you want.
—————
EDIT — (30 Jul 2021 at 18:26)
With respect to your Comment, choose a threshold slightly less than 1, (or sllightly greater than 0, or both), assign NaN to all values exceeding than that threshold in either direction, then use rmmissing to delete them. I would need the actual data to write and test specific code.
.
2 个评论
Star Strider
2021-7-30
The rmmissing function was introduced in R2016b, as was fillmissing that would replace them with 0 or alternatively interpolate the missing values. We have no idea what version or rlelease you are using, since that was not posted. (I assume the latest release unless otherwise stated.)
An alternative would be to simply set the values exceeding the thresholds to 0. That would essentially remove them without disrupting the rest of the file, or the associated time vector (if one exists).
.
Image Analyst
2021-7-22
Try this
clipValue = max(yourSignal); % Assume clipping occurs, or else just assign some known value, like 1.
badIndexes = yourSIgnal == clipValue;
% Set those elements to zero (won't change the time scale);
yourSignal(badIndexes) = 0;
% Or, delete those elements to zero (will change the time scale);
yourSignal(badIndexes) = [];
If you need more help, attach your signal in a .mat file with the paperclip icon along with a screenshot indicating what values you'd like to process, and whether you'd like to delete them or just set them to zero.
0 个评论
Kcire L
2021-7-30
1 个评论
Image Analyst
2021-7-31
Remember when I said "If you need more help, attach your signal in a .mat file with the paperclip icon along with a screenshot indicating what values you'd like to process, and whether you'd like to delete them or just set them to zero."?
Well you attached the screenshots, and that's good, but what can we do now? Nothing, because you forgot to attach the signal in a .mat or text file.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Measurements and Spatial Audio 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!