2016-10-14 07:27:45 +02:00
|
|
|
"""Settings for audio reactive LED strip"""
|
2016-10-23 06:55:22 +02:00
|
|
|
from __future__ import print_function
|
|
|
|
from __future__ import division
|
2016-10-14 07:27:45 +02:00
|
|
|
import os
|
|
|
|
|
2016-11-08 02:43:31 +01:00
|
|
|
N_PIXELS = 60
|
2016-10-14 07:27:45 +02:00
|
|
|
"""Number of pixels in the LED strip (must match ESP8266 firmware)"""
|
|
|
|
|
2016-11-13 10:08:51 +01:00
|
|
|
GAMMA_TABLE_PATH = os.path.join(os.path.dirname(__file__), 'gamma_table.npy')
|
2016-10-14 07:27:45 +02:00
|
|
|
"""Location of the gamma correction table"""
|
|
|
|
|
2016-11-08 02:43:31 +01:00
|
|
|
UDP_IP = '192.168.0.150'
|
2016-10-14 07:27:45 +02:00
|
|
|
"""IP address of the ESP8266"""
|
|
|
|
|
|
|
|
UDP_PORT = 7777
|
|
|
|
"""Port number used for socket communication between Python and ESP8266"""
|
|
|
|
|
2016-11-13 10:08:51 +01:00
|
|
|
#MIC_RATE = 44100
|
|
|
|
MIC_RATE = 48000
|
2016-10-14 07:27:45 +02:00
|
|
|
"""Sampling frequency of the microphone in Hz"""
|
|
|
|
|
2016-11-13 10:08:51 +01:00
|
|
|
FPS = 100
|
2016-10-14 07:27:45 +02:00
|
|
|
"""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
|
|
|
|
the LED strip may be lower if the time needed for signal processing exceeds
|
|
|
|
the per-frame recording time.
|
|
|
|
|
|
|
|
A high FPS results in low latency and smooth animations, but it also reduces
|
|
|
|
the duration of the short-time Fourier transform. This can negatively affect
|
|
|
|
low frequency (bass) response.
|
|
|
|
"""
|
|
|
|
|
2016-11-13 10:08:51 +01:00
|
|
|
MIN_FREQUENCY = 200
|
2016-10-25 01:42:03 +02:00
|
|
|
"""Frequencies below this value will be removed during onset detection"""
|
|
|
|
|
2016-11-08 02:43:31 +01:00
|
|
|
MAX_FREQUENCY = 14000
|
2016-10-25 01:42:03 +02:00
|
|
|
"""Frequencies above this value will be removed during onset detection"""
|
|
|
|
|
2016-11-13 10:08:51 +01:00
|
|
|
N_SUBBANDS = 30 # 240 #48
|
2016-10-14 07:27:45 +02:00
|
|
|
"""Number of frequency bins to use for beat detection
|
|
|
|
|
|
|
|
More subbands improve beat detection sensitivity but it may become more
|
|
|
|
challenging for the visualization to work for a wide range of music.
|
|
|
|
|
|
|
|
Fewer subbands reduces signal processing time at the expense of beat detection
|
|
|
|
sensitivity.
|
|
|
|
"""
|
|
|
|
|
|
|
|
GAMMA_CORRECTION = True
|
2016-10-23 06:55:22 +02:00
|
|
|
"""Whether to correct LED brightness for nonlinear brightness perception"""
|
|
|
|
|
2016-11-13 10:08:51 +01:00
|
|
|
N_ROLLING_HISTORY = 2
|
2016-11-08 02:43:31 +01:00
|
|
|
"""Number of past audio frames to include in the rolling window"""
|
2016-10-23 06:55:22 +02:00
|
|
|
|
2016-11-08 02:43:31 +01:00
|
|
|
MIN_VOLUME_THRESHOLD = 1e-7
|
|
|
|
"""No music visualization displayed if recorded audio volume below threshold"""
|