how can i find zero crossing irregularity of the sound data?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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?
0 comentarios
Respuestas (1)
Star Strider
el 19 de Mzo. de 2021
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 comentarios
Star Strider
el 20 de Mzo. de 2021
I would have to have the structure array to experiment with to advise you on that.
Star Strider
el 20 de Mzo. de 2021
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.
Ver también
Categorías
Más información sobre Spectral Measurements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!