how can i find zero crossing irregularity of the sound data?

4 次查看(过去 30 天)
I have an sound file of an asthma patient. My aim here is to find the zero crossing irregularity of this sound file. Can you help me?

回答(1 个)

Star Strider
Star Strider 2021-3-19
Find the zero-crossings using something like this approach:
[y,Fs] = audioread('Asthma.wav'); % Import Sound File (Use The Correct File Name)
zxi = find(diff(sign(y(:,1)))); % Approximate Indices Of Zero-Crossinga
ylen = numel(y(:,1));
tv = linspace(0, ylen, ylen).'/Fs; % Time Vector (Column Vector)
for k = 1:numel(zxi)
idxrng = max(1,zxi(k)-2):min(ylen,zxi(k)+2); % Index Range
B = [t(idxrng) ones(size(idxrng))] \ y(idxrng); % Parameters
txz(k) = B(2)/B(1); % Interpolated Precise Time Of Zero-Crossing
end
However, if you are doing time-frequency analysis of the wheezes, the Signal Processing Toolbox pspectrum function with the 'spectrogram' option is likely most appropriate. (The spectrogram function may also be useful, however the outputs are not as straightforward to interpret.)
  6 个评论
Star Strider
Star Strider 2021-3-20
First, I meant audioplayer not audioread in my earlier Comment.
I would have to have the structure array to experiment with to advise you on that.
Star Strider
Star Strider 2021-3-20
I would do something like this to do the time-frequency analysis:
W = load('sampleWheezeData.mat');
% LungSounds = W.structWheeze;
% SoundData = LungSounds.SoundData;
% Properties = LungSounds.Properties;
C1 = struct2cell(W.structWheeze);
Fs = 44100; % Not Provided, Wild Guess
for k = 1:size(C1,2)
figure(k)
pspectrum(C1{2,k}, Fs, 'spectrogram')
end
See the documentation on pspectrum for details on how to extract necessary information from it. I am not sure what sort of analysis you want to do with these data, however this should get you started.
This routine will extract the zero-crossing data:
for k1 = 1:size(C1,2)
y = C1{2,k1};
zxi = find(diff(sign(y(:,1)))); % Approximate Indices Of Zero-Crossinga
ylen = numel(y(:,1));
tv = linspace(0, ylen, ylen).'/Fs; % Time Vector (Column Vector)
for k2 = 1:numel(zxi)
idxrng = max(1,zxi(k)-2):min(ylen,zxi(k)+2); % Index Range
B = [tv(idxrng) ones(size(idxrng)).'] \ y(idxrng); % Parameters
txz(k1,k2) = -B(2)/B(1); % Interpolated Precise Time Of Zero-Crossing
end
end
figure
contourf(txz)
set(gca, 'YTick',1:5)
however I did not find the result to be very informative when I plotted it.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 AI for Signals 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by