Detect signal clipping and remove
22 views (last 30 days)
Show older comments
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 Comments
Answers (3)
Star Strider
on 22 Jul 2021
Edited: Star Strider
on 30 Jul 2021
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 Comments
Star Strider
on 30 Jul 2021
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
on 22 Jul 2021
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 Comments
Kcire L
on 30 Jul 2021
1 Comment
Image Analyst
on 31 Jul 2021
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.
See Also
Categories
Find more on Measurements and Spatial Audio in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!