I am working on sound processing android application project in which I have to input sound and remove noise as much as possible at run-time, somewhat like streaming. I am recording video at one place and play at a different place with very low latency. I tried using Chebyshev filter but found that it didn't work if I had less frame available to process. There was clipping at the boundaries of the sample so when the video was played I could hear hissing like sound.
To demonstrate what actually happened I am attaching a Matlab code that simulates the situation output that I am getting.
Matlab code when run on a long sample give reduced noise output.
clc;clear;close all;
[sample_data, sample_rate] = audioread('save.binary.wav');
Fs = sample_rate; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency (Hz)
Wp = 1000/Fn; % Passband Frequency (Normalised)
Ws = 1010/Fn; % Stopband Frequency (Normalised)
Rp = 1; % Passband Ripple (dB)
Rs = 150; % Stopband Ripple (dB)
[n,Ws] = cheb2ord(Wp,Ws,Rp,Rs); % Filter Order
[z,p,k] = cheby2(n,Rs,Ws,'low'); % Filter Design
[soslp,glp] = zp2sos(z,p,k); % Convert To Second-Order-Section For Stability
figure(3)
freqz(soslp, 2^16, Fs) % Filter Bode Plot
filtered_sound = zeros(size(sample_data));
filtered_sound = filtfilt(soslp, glp, sample_data);
sound(filtered_sound, sample_rate)
audiowrite('save.binary.test.wav',filtered_sound,Fs)
While when running on small samples of the big file gives, hissing sound (hear simulated by using small samples in a loop).
clc;clear;close all;
[sample_data, sample_rate] = audioread('save.binary.wav');
Fs = sample_rate; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency (Hz)
Wp = 1000/Fn; % Passband Frequency (Normalised)
Ws = 1010/Fn; % Stopband Frequency (Normalised)
Rp = 1; % Passband Ripple (dB)
Rs = 150; % Stopband Ripple (dB)
[n,Ws] = cheb2ord(Wp,Ws,Rp,Rs); % Filter Order
[z,p,k] = cheby2(n,Rs,Ws,'low'); % Filter Design
[soslp,glp] = zp2sos(z,p,k); % Convert To Second-Order-Section For Stability
figure(3)
freqz(soslp, 2^16, Fs) % Filter Bode Plot
BufferSize = 960;
bufferCount = 830400/BufferSize;
filtered_sound = zeros(size(sample_data));
for i = 0:(bufferCount-1)
filtered_sound(BufferSize*i+(1:BufferSize),:) = filtfilt(soslp, glp, sample_data(BufferSize*i+(1:BufferSize),:));
sound(filtered_sound(BufferSize*i+(1:BufferSize),:), sample_rate)
end
sound(filtered_sound, sample_rate)
audiowrite('save.binary.test.wav',filtered_sound,Fs)
So what I want to know is which sort of filter is suitable for such an application in which frame length is small due to the requirement of low latency? I tried filters like Butterworth , elliptic, etc . but the results weren't any different.
Rs=46
,Ws=1200/Fn
. $\endgroup$