Fixed bug where some FPS values raised exceptions
Fixed a bug where certain config.FPS values would result in arrays with mismatched dimensions. The mismatched dimensions occurred because an integer was rounded instead of truncated. This is now fixed and exceptions should no longer be raised when certain FPS values are used.
This commit is contained in:
parent
46b404120f
commit
4b6f9a807b
@ -39,7 +39,7 @@ def fft(data, window=None):
|
|||||||
return xs, ys
|
return xs, ys
|
||||||
|
|
||||||
|
|
||||||
samples = int(round(config.MIC_RATE * config.N_ROLLING_HISTORY / (2.0 * config.FPS)))
|
samples = int(config.MIC_RATE * config.N_ROLLING_HISTORY / (2.0 * config.FPS))
|
||||||
mel_y, (_, mel_x) = melbank.compute_melmat(num_mel_bands=config.N_FFT_BINS,
|
mel_y, (_, mel_x) = melbank.compute_melmat(num_mel_bands=config.N_FFT_BINS,
|
||||||
freq_min=config.MIN_FREQUENCY,
|
freq_min=config.MIN_FREQUENCY,
|
||||||
freq_max=config.MAX_FREQUENCY,
|
freq_max=config.MAX_FREQUENCY,
|
||||||
@ -50,7 +50,7 @@ mel_y, (_, mel_x) = melbank.compute_melmat(num_mel_bands=config.N_FFT_BINS,
|
|||||||
def create_mel_bank(n_history):
|
def create_mel_bank(n_history):
|
||||||
global samples, mel_y, mel_x
|
global samples, mel_y, mel_x
|
||||||
config.N_ROLLING_HISTORY = n_history
|
config.N_ROLLING_HISTORY = n_history
|
||||||
samples = int(round(config.MIC_RATE * config.N_ROLLING_HISTORY / (2.0 * config.FPS)))
|
samples = int(config.MIC_RATE * config.N_ROLLING_HISTORY / (2.0 * config.FPS))
|
||||||
mel_y, (_, mel_x) = melbank.compute_melmat(num_mel_bands=config.N_FFT_BINS,
|
mel_y, (_, mel_x) = melbank.compute_melmat(num_mel_bands=config.N_FFT_BINS,
|
||||||
freq_min=config.MIN_FREQUENCY,
|
freq_min=config.MIN_FREQUENCY,
|
||||||
freq_max=config.MAX_FREQUENCY,
|
freq_max=config.MAX_FREQUENCY,
|
||||||
|
Loading…
Reference in New Issue
Block a user