From ff6d7719afdd65b80de16f4e968365370963c093 Mon Sep 17 00:00:00 2001 From: Scott Lawson Date: Sun, 13 Nov 2016 01:08:51 -0800 Subject: [PATCH] Removed obsolete gamma table and updated config file to match --- python/config.py | 58 +++++---------------------------------- python/gamma_table.npy | Bin 1104 -> 1104 bytes python/gamma_table_2.npy | Bin 1104 -> 0 bytes 3 files changed, 7 insertions(+), 51 deletions(-) delete mode 100644 python/gamma_table_2.npy diff --git a/python/config.py b/python/config.py index 8cb72e9..14b6987 100644 --- a/python/config.py +++ b/python/config.py @@ -6,7 +6,7 @@ import os N_PIXELS = 60 """Number of pixels in the LED strip (must match ESP8266 firmware)""" -GAMMA_TABLE_PATH = os.path.join(os.path.dirname(__file__), 'gamma_table_2.npy') +GAMMA_TABLE_PATH = os.path.join(os.path.dirname(__file__), 'gamma_table.npy') """Location of the gamma correction table""" UDP_IP = '192.168.0.150' @@ -15,10 +15,11 @@ UDP_IP = '192.168.0.150' UDP_PORT = 7777 """Port number used for socket communication between Python and ESP8266""" -MIC_RATE = 44100 +#MIC_RATE = 44100 +MIC_RATE = 48000 """Sampling frequency of the microphone in Hz""" -FPS = 75 +FPS = 100 """Desired LED strip update rate in frames (updates) per second This is the desired update rate of the LED strip. The actual refresh rate of @@ -30,39 +31,13 @@ the duration of the short-time Fourier transform. This can negatively affect low frequency (bass) response. """ -MIN_FREQUENCY = 50 +MIN_FREQUENCY = 200 """Frequencies below this value will be removed during onset detection""" MAX_FREQUENCY = 14000 """Frequencies above this value will be removed during onset detection""" -ENERGY_THRESHOLD = 14.0 -"""Energy threshold for determining whether a beat has been detected - -One aspect of beat detection is comparing the current energy of a frequency -subband to the average energy of the subband over some time interval. Beats -are often associated with large spikes in energy relative to the recent -average energy. - -ENERGY_THRESHOLD is the threshold used to determine if the energy spike is -sufficiently large to be considered a beat. - -For example, if ENERGY_THRESHOLD = 2, then a beat is detected if the current -frequency subband energy is more than 2 times the recent average energy. -""" - -VARIANCE_THRESHOLD = 0.0 -"""Variance threshold for determining whether a beat has been detected - -Beat detection is largely determined by the ENERGY_THRESHOLD, but we can also -require frequency bands to have a certain minimum variance over some past -time interval before a beat can be detected. - -One downside to using a variance threshold is that it is an absolute threshold -which is affected by the current volume. -""" - -N_SUBBANDS = 10 # 240 #48 +N_SUBBANDS = 30 # 240 #48 """Number of frequency bins to use for beat detection More subbands improve beat detection sensitivity but it may become more @@ -72,29 +47,10 @@ Fewer subbands reduces signal processing time at the expense of beat detection sensitivity. """ -N_HISTORY = int(0.8 * FPS) -"""Number of previous samples to consider when doing beat detection - -Beats are detected by comparing the most recent audio recording to a collection -of previous audio recordings. This is the number of previous audio recordings -to consider when doing beat detection. - -For example, setting N_HISTORY = int(1.0 * config.FPS) means that one second -of previous audio recordings will be used for beat detection. - -Smaller values reduces signal processing time but values too small may reduce -beat detection accuracy. Larger values increase signal processing time and -values too large can also reduce beat detection accuracy. Roughly one second -of previous data tends to work well. -""" - GAMMA_CORRECTION = True """Whether to correct LED brightness for nonlinear brightness perception""" -N_CURVES = 1 -"""Number of curves to plot in the visualization window""" - -N_ROLLING_HISTORY = 10 +N_ROLLING_HISTORY = 2 """Number of past audio frames to include in the rolling window""" MIN_VOLUME_THRESHOLD = 1e-7 diff --git a/python/gamma_table.npy b/python/gamma_table.npy index 17cec45ca3644971924a6c5dd37bb022a2b29ded..b1a894032aa9b9b50e79ac72e009c0e4fa31d6c3 100644 GIT binary patch literal 1104 zcmcJ~duWYe9Ki9-{eHh+kL%f(+ib(kow>Bl#AL+Gc9`47*@T9Oh(s=tL?VeKkt9hZ zNs=TH4Hf};Gw;^d^~!I==l) zUHd=PvrAOpJy8SqxQ6DqM&`K2=D64o$23jQ%pB7^K?`$C%RnoQX&q>zF>M3ww0)q1 z#&isH($0Y{+BMKky9at`&p=3f(L2yb`_eDaU&EvXQgr|WNn;R$14DEu!$@a18Dx^h z2u3oBY(|sA7{)S=@l0SMlbFmDa+%6BrZa;)@+n{@h0J0$b0}gi^C)IM3s}e^N?6Pi z$|z?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