I have an audio file of sampling frequency as 16 kHz. Now I would like to read it and split its samples into four range. Namely: 0 kHz - 1 kHz 1 kHz - 2 kHz 2 kHz - 4 kHz 4 kHz - 8 kHz I have come about the following code but I am not sure if it is correct? I wanted to know if there is any other way. [signal,fs]=audioread('003.wav'); SigFD = (signal); n = length(signal); % number of samples deltaF = fs/n; % frequency resolution F = [0:floor(n/2)-1, -(floor(n/2)):-1]*deltaF; % frequency vector lowF = 0; % lowF and highF defines one of the range highF = 1000; part1Range = abs(F)>lowF&abs(F)
John Michell answered .
2025-11-20
Fs = 1.6E+4; % Sampling Frequency (Hz) Fn = Fs/2; % Nyquist Frequency (Hz) Fnotch = 1.5E3; % Notch Frequency (Hz) BW = 1E+3; % Passband Width (Hz) Ws = [Fnotch-BW/2-1 Fnotch+BW/2+1]/Fn; % Passband Frequency Vector (Normalised) Wp = [Fnotch-BW/2-5 Fnotch+BW/2+5]/Fn; % Stopband Frequency Vector (Normalised) Rp = 1; % Passband Ripple (dB) Rs = 150; % Stopband Attenuation (dB) [n,Wp] = ellipord(Wp,Ws,Rp,Rs); % Default Here Is A Bandpass Filter [z,p,k] = ellip(n,Rp,Rs,Wp); [sos,g] = zp2sos(z,p,k); % Use Second-Order-Section Implementation For Stability % s_filtered = filtfilt(sos,g,s); % Filter Signal (Here: ‘s’) figure freqz(sos, 2^14, Fs) % Bode Plot Of Filter set(subplot(2,1,1), 'XLim',[0 Fn]) % Optional, Change Limits As Necessary For Best Resolution set(subplot(2,1,2), 'XLim',[0 Fn]) % Optional, Change Limits As Necessary For Best Resolution
The others are the same except for the centre frequencies and the bandwidths.