From 627f67d3dd0eecd2aa7daf4d3c48167017972fb5 Mon Sep 17 00:00:00 2001 From: Scott Lawson Date: Fri, 11 Nov 2016 15:52:00 -0800 Subject: [PATCH] Added ability to change mel filterbank at runtime --- python/dsp.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/python/dsp.py b/python/dsp.py index 85568b7..99e2018 100644 --- a/python/dsp.py +++ b/python/dsp.py @@ -176,9 +176,21 @@ def log_partition(xs, ys, subbands): return np.array(X), np.array(Y) + + samples = int(round(config.MIC_RATE * config.N_ROLLING_HISTORY / (2.0 * config.FPS))) mel_y, (_, mel_x) = melbank.compute_melmat(num_mel_bands=config.N_SUBBANDS, freq_min=config.MIN_FREQUENCY, freq_max=config.MAX_FREQUENCY, num_fft_bands=samples, - sample_rate=config.MIC_RATE) \ No newline at end of file + sample_rate=config.MIC_RATE) + +def create_mel_bank(n_history): + global samples, mel_y, mel_x + config.N_ROLLING_HISTORY = n_history + samples = int(round(config.MIC_RATE * config.N_ROLLING_HISTORY / (2.0 * config.FPS))) + mel_y, (_, mel_x) = melbank.compute_melmat(num_mel_bands=config.N_SUBBANDS, + freq_min=config.MIN_FREQUENCY, + freq_max=config.MAX_FREQUENCY, + num_fft_bands=samples, + sample_rate=config.MIC_RATE)