Borrar filtros
Borrar filtros

how to change the amplitude factor

2 visualizaciones (últimos 30 días)
zhe wang
zhe wang el 3 de Dic. de 2019
I want to use gammatone filter to filter some sound,but i fin
d that i cannot change the amplitude factor in the audio toolbox.
so if i use the audio toolbox ,how can i change the amplitude factor ?
and if i design gammatone filter bank,how can i change the amplitude facor?
the code is how i design gammatone filter.
function CF = make_erb_freqs(fs, n_channel) % center frequence
SF = 1 / n_channel * 9.26 * (log(fs + 228.7) - log(20 + 228.7));
CF = - 228.7 + (fs + 228.7) ./ exp(0.108 * (1:n_channel)' * SF);
end
function ERB = erb_bandwidth(f0) %ERB bandwidth
B = 24.7 * (0.00437 * f0 + 1);
end
function [B, A] = make_erb_pass_allpole_cascade(fs, pass_freq, pass_band) %coe of the filter
T = 1 / fs;
f0 = pass_freq;
BW = 1.019 * 2 * pi * pass_band;
E = exp(BW * T);
n_channel = length(pass_freq);
A = zeros(n_channel, 3);
B = zeros(n_channel, 2);
A(:, 1) = 1;
A(:, 2) = - 2 * cos(2 * f0 * pi * T) ./ E;
A(:, 3) = E .^ (-2);
cz = exp(- 2 * j * pi * f0 * T);
g = cz ./ (1 + A(:, 2) .* cz + A(:, 3) .* cz .^ 2);
B(:, 2) = 1 ./ abs(g);
end
function [B, A] = make_erb_bank_allpole_cascade(fs, bank_freq) % coe of the filter in REB bandwidth
BW = erb_bandwidth(bank_freq);
[B A] = make_erb_pass_allpole_cascade(fs, bank_freq, BW);
end
function y = gtf_allpole(B, A, x) % filter the sound (x)
n_channel = rows(B);
y = zeros(length(x), n_channel);
for i = 1:n_channel
y(:, i) = filter(B(i, :), A(i, :), x);
y(:, i) = filter(B(i, :), A(i, :), y(:, i));
y(:, i) = filter(B(i, :), A(i, :), y(:, i));
y(:, i) = filter(B(i, :), A(i, :), y(:, i));
end
end

Respuestas (0)

Categorías

Más información sobre Simulation, Tuning, and Visualization en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by