image thumbnail

breathTimes

version 4.3 (4.8 KB) by Alexis
Detects initiation and ending or maxima of respiratory events association with inhalation, especially for speech breathing.

141 Downloads

Updated 22 Oct 2021

View License

This function is for using with a linear respiratory signal, usually meaning data produced with transducer breath belts. The function is optimised for speech breathing in particular. For example, we have found from comparison with the acoustic speech spectrogram that speech-related inhalations often end before local maxima in the respiratory signal. breathTimes therefore performs slope grade analysis, among other steps, to search for abrupt reductions in the steepness of the positive-going signal, as opposed to absolute peaks. Similarly, inhalation onsets are not determined via the absolute minima or valleys in the respiratory signal, but rather based on contextual slope thresholds.
breathTimes returns two time series: the first is for the initiations of inhalations, and the second is for the ending of inhalations. You can also optionally plot the results, to make sure the parameters are appropriate for your data. See comments for documentation.
I strongly recommend you combine this approach with speech analysis (i.e., using my other function Acoustic Landmarks) so that you can cross-corroborate and be sure your respiratory signal is doing what you think it is (for example, some peaks are in reality associated with exhalation during vocalisation, and not inhalation).
Example Usage: [onsets,offsets] = ...
breathTimes(vector,Fs,'WinSz',20,'MinDur',100,'MinHeight',0.1,'Plot',1)

Cite As

Alexis D. MacIntyre (2021). breathTimes (https://www.mathworks.com/matlabcentral/fileexchange/81066), MATLAB Central File Exchange. Retrieved March 25, 2021.

MATLAB Release Compatibility
Created with R2019a
Compatible with R2016a and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!