how adjustrange of the voice while implement high and low pass filter
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
confused about separte the audio and noise and doing range of frequency for normal voice human and neglect the rest of noisy thing
1 comentario
Respuestas (1)
Saarthak Gupta
el 27 de Dic. de 2023
Hi Sherif,
I understand that you wish to filter the noise out of a given audio sample containing human voice.
To separate the audio (human voice) from noise, you typically need to know the frequency range of the human voice and apply a band-pass filter that allows only that range to pass through.
Refer to the following code:
%% Read complete audio file
% using sample data file (available in MATLAB), since original data file is not provided
load handel.mat
%% Plot the original sound waveform
subplot(421);
plot(y,'r');
title('Original sound');
len = length(y);
xdft = fft(y);
freq = (Fs/len)*(0:len/2-1);
%% Plot the original DFT
subplot(422);
plot(freq,abs(xdft(1:len/2)),'k');
title('Original DFT');
% Band-pass filter, assuming the desired voice range from 200 Hz to 1300 Hz
fmin = 200; % lower cutoff frequency
fmax = 1300; % upper cutoff frequency
kmin = round((fmin*len)/Fs) + 1;
kmax = round((fmax*len)/Fs) + 1;
xfilter = zeros(len, 1);
xfilter(kmin:kmax) = xdft(kmin:kmax); % pass the frequencies within the voice range
xfilter(end-kmax+2:end-kmin+2) = xdft(end-kmax+2:end-kmin+2);
%% Plot the DFT after BPF
subplot(423);
plot(freq,abs(xfilter(1:len/2)),'b');
title('DFT after BPF');
%% Plot the audio signal after BPF
datafilter = ifft(xfilter);
datafilter_real = real(datafilter);
subplot(424);
plot(datafilter_real,'y');
title('Audio after BPF');
% Play the filtered audio
sound(datafilter_real,Fs);
Given that the "handel" audio sample primarily contains frequencies within the 200 to 1300 Hz range, the code sets this range as the threshold for the band-pass filter.
Refer to the following MATLAB documentation for further reference:
0 comentarios
Ver también
Categorías
Más información sobre Audio I/O and Waveform Generation 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!