Minor bug fixes and tweaks

This commit is contained in:
Scott Lawson 2016-10-22 22:16:08 -07:00
parent d966bb878d
commit 39325ce69b
4 changed files with 2366 additions and 16 deletions

2352
python/Output/visualize.log Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,14 +3,13 @@ from __future__ import print_function
from __future__ import division
import os
N_PIXELS = 60
N_PIXELS = 240
"""Number of pixels in the LED strip (must match ESP8266 firmware)"""
GAMMA_TABLE_PATH = os.path.join(os.path.dirname(__file__), 'gamma_table.npy')
"""Location of the gamma correction table"""
UDP_IP = '192.168.0.101'
#UDP_IP = '192.168.137.28'
UDP_IP = '192.168.1.150'
"""IP address of the ESP8266"""
UDP_PORT = 7777
@ -19,7 +18,7 @@ UDP_PORT = 7777
MIC_RATE = 44100
"""Sampling frequency of the microphone in Hz"""
FPS = 50
FPS = 45
"""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
@ -57,7 +56,7 @@ One downside to using a variance threshold is that it is an absolute threshold
which is affected by the current volume.
"""
N_SUBBANDS = 40 # 240 #48
N_SUBBANDS = 80 # 240 #48
"""Number of frequency bins to use for beat detection
More subbands improve beat detection sensitivity but it may become more

View File

@ -5,7 +5,7 @@ import config
_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
_gamma = np.load('gamma_table.npy')
_prev_pixels = np.tile(0, (config.N_PIXELS, 3))
_prev_pixels = np.tile(255, (config.N_PIXELS, 3))
pixels = np.tile(1, (config.N_PIXELS, 3))
"""Array containing the pixel values for the LED strip"""
@ -28,6 +28,5 @@ def update():
if __name__ == '__main__':
pixels += 0.0
pixels = pixels * 0
update()

View File

@ -10,7 +10,6 @@ import dsp
import led
def rainbow(length, speed=1.0 / 5.0):
"""Returns a rainbow colored array with desired length
@ -164,7 +163,6 @@ def update_leds_6(y):
Array containing the onset energies that should be visualized.
The
"""
# Scale y to emphasize large spikes and attenuate small changes
# Exponents < 1.0 emphasize small changes and penalize large spikes
# Exponents > 1.0 emphasize large spikes and penalize small changes
@ -394,11 +392,13 @@ def microphone_update(stream):
plot_y = [onsets.value**i for i in np.linspace(1, 0.25, config.N_CURVES)]
update_plot_1(plot_x, plot_y)
app.processEvents()
print('{:.2f}\t{:.2f}\t{:.2f}\t{:.2f}\t{:.2f}'.format(SF_peak.value,
NWPD_peak.value,
RCD_peak.value,
onset_peak.value,
frames_per_second()))
print('FPS {:.2f} / {:.2f}'.format(frames_per_second(), config.FPS))
# print('{:.2f}\t{:.2f}\t{:.2f}\t{:.2f}\t{:.2f}'.format(SF_peak.value,
# NWPD_peak.value,
# RCD_peak.value,
# onset_peak.value,
# frames_per_second()))
# Create plot and window
@ -450,7 +450,7 @@ y_roll = np.random.rand(config.N_ROLLING_HISTORY, samples_per_frame) / 100.0
# update_leds_4 = brightness modulation effect (GAMMA = True)
# update_leds_5 = energy flux normalized per-bin spectrum (GAMMA = True)
# update_leds_6 = energy average normalized per-bin spectrum (GAMMA = True)
led_visualization = update_leds_6
led_visualization = update_leds_1
if __name__ == '__main__':
led.update()