From audio signal to mean of frequency responses
Show older comments
Hi there,
Im not very advanced in Matlab.
I have an audio signal of exhaling air and want to obtain the mean of frequency responses of that signal so that I can further evaluate the lung function by converting the mean of frequency responses to flow rate. The following steps I want to do
- Segment the file into 100 millisecond segments
- Convert each segment into frequency domain using Fast Fourier Transformation.
- Apply Butterworth filter on each segment to extract frequencies between 100 HZ and 1200 HZ.
- Calculate the mean of frequency responses between 100 HZ and 1200 HZ for each segment.
The following code I found that performs the first two steps. After that I found it difficult to apply a butterworth filter and calculate the mean of frecuency responses.
I hope someone can help me out here.
[data, fs] = audioread('test-kort3.wav');
% read exhalation audio wav file (1 channel, mono)
% frequency is 44100 HZ
% windows of 0.1 s and overlap of 0.05 seconds
WINDOW_SIZE = fs*0.1; %4410 = fs*0.1
array_size = length(data); % array size of data
numOfPeaks = (array_size/(WINDOW_SIZE/2)) - 1;
step = floor(WINDOW_SIZE/2); %step size used in loop
transformed = data;
start =1;
k = 1;
t = 1;
g = 1;
o = 1;
% performing fft on each window and finding the peak of windows
while(((start+WINDOW_SIZE)-1)<=array_size)
j=1;
i =start;
while(j<=WINDOW_SIZE)
WindowArray(j) = transformed(i);
j = j+1;
i = i +1;
end
Y = fft(WindowArray);
p = abs(Y).^2; %power
end
Accepted Answer
More Answers (0)
Categories
Find more on Get Started with Signal Processing Toolbox 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!