Commit Graph

99 Commits

Author SHA1 Message Date
Scott Lawson
47aa7bfcdd Added a slider for contrast adjustment
Added a slider and variables for adjusting the contrast of the
visualization.
2017-01-03 19:16:45 -08:00
Scott Lawson
e3ebe167e8 PEP8 formatting 2017-01-03 16:48:18 -08:00
Scott Lawson
5c5300ba7f Minor PEP8 formatting changes 2017-01-03 16:46:19 -08:00
Scott Lawson
68c2a66fa6 Replaced instance of 'long' type with 'int' for python 2 to 3 compatibility 2017-01-03 16:35:43 -08:00
Scott Lawson
b10a7d0396 Added experimental support for Raspberry Pi devices
This commit adds support for the Raspberry Pi, which allows users to
create a completely standalone music visualization system. The Raspberry
Pi should be connected directly to a ws2812b LED strip. A PWM-capable
GPIO pin should be connected to the data line of the LED strip. A USB
audio input device should be connected to one of the Raspberry Pi's USB
ports.

It is recommended that the GUI and FPS output be disabled when running
the visualization on the Raspberry Pi. These features can degrade
performance on the already computationally limited Raspberry Pi.
2017-01-03 16:33:28 -08:00
Scott Lawson
4b6f9a807b 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.
2017-01-03 16:09:39 -08:00
Scott Lawson
46b404120f Fixed bug where ComboBox didn't match current effect
Fixed a bug where the GUI ComboBox value would sometimes not match the
effect being displayed. This bug sometimes occurs when the GUI is first
initialized. This change now ensures that the ComboBox value is
correctly initialized.
2017-01-01 13:12:38 -07:00
Scott Lawson
c725d395be Added ComboBox to GUI for effect selection
Added a ComboBox to the GUI to allow the user to change the
visualization effect without having to restart Python. The user can now
select from one of the following visualizations using the GUI: 'Scroll
effect', 'Spectrum effect', 'Energy effect'
2017-01-01 12:14:31 -07:00
Scott Lawson
0f5c05339c Fixed a byte encoding error that occurred in Python 3
Fixed an error that caused strange byte encoding in Python 3. This error
was caused by a mistake in porting code from Python 2.7 to Python 3 and
would cause strange LED flickering behaviour. The LED update code should
now work properly in Python 2.7 and Python 3.
2016-12-31 11:06:09 -07:00
Scott Lawson
3241e43435 Fixed a typo where multiple effects were uncommented 2016-12-30 22:19:46 -07:00
Scott Lawson
27a0448203 Added LED strand test to LED.py
Added a test routine to led.py to do a simple LED strand test. The
strand test scrolls a red, green, and blue pixel across the LED strip
forever.
2016-12-30 22:18:56 -07:00
Scott Lawson
e874ed3b2c Resolved issues with Python 3.5 compatibility
Fixed some bugs that occurred in Python 3.5 but were not present in
Python 2.7. Most compatiblity issues were caused by incompatible type
casting of numpy arrays.
2016-12-29 15:51:38 -07:00
Scott Lawson
7b3f95af18 Improved documentation for IP configuration 2016-12-27 21:09:10 -07:00
Scott Lawson
e09578da1d Updated dsp.py and led.py to be Python 3.5 compatible 2016-12-27 03:06:57 -07:00
Scott Lawson
d9677a4f8e Renamed mel_visualization.py to visualization.py 2016-12-27 01:31:50 -07:00
Scott Lawson
6f98d31096 Removed function that is no longer needed 2016-12-24 22:54:43 -07:00
Scott Lawson
b6551e04a2 Very minor PEP8 formatting changes 2016-12-24 22:54:06 -07:00
Scott Lawson
e677742584 Added a status indicator LED that blinks when command is received 2016-12-24 20:37:43 -07:00
Scott Lawson
2a87d040a7 Added several new visualizations 2016-11-21 20:11:45 -08:00
Scott Lawson
4dcf3e9a49 Minor pep8 formatting changes 2016-11-21 20:11:31 -08:00
Scott Lawson
1e630f2151 Removed two DSP functions that are no longer needed 2016-11-21 20:11:16 -08:00
Scott Lawson
e3a810db09 Updated documentation for configuration settings 2016-11-21 20:08:35 -08:00
Scott Lawson
51eda2f0ba Made noticeable improvements to performance 2016-11-13 01:11:15 -08:00
Scott Lawson
9bdc8f8cb9 Changed pixels from row vectors to column vectors to improve performance 2016-11-13 01:10:44 -08:00
Scott Lawson
e8b8a09047 Removed useless comments from melbank.py 2016-11-13 01:10:07 -08:00
Scott Lawson
b65989c8f1 Removed some dsp module functions that are never called 2016-11-13 01:09:47 -08:00
Scott Lawson
2bad2cd4d4 Deleted sandbox.py and visualize.py 2016-11-13 01:09:14 -08:00
Scott Lawson
ff6d7719af Removed obsolete gamma table and updated config file to match 2016-11-13 01:08:51 -08:00
Scott Lawson
cdc4c2976c Mel visualization is now globally normalized instead of individually normalized.
Also added realtime adaptive brightness correction to avoid having the
LED strip under or over saturated
2016-11-11 15:52:57 -08:00
Scott Lawson
627f67d3dd Added ability to change mel filterbank at runtime 2016-11-11 15:52:00 -08:00
Scott Lawson
7aa12f17ed LED optimization using gamma correction 2016-11-11 15:51:41 -08:00
Scott Lawson
ffbec2901f Added new visualization module that uses a mel filterbank instead of onset detection
The Mel filterbank visualization is relatively simple but produces
visualizations that are quite nice. Run this file to view the mel
filterbank visualization
2016-11-07 17:45:52 -08:00
Scott Lawson
83453ed436 Refactored led module and fixed a gamma table bug 2016-11-07 17:44:23 -08:00
Scott Lawson
ea8b381c8a Added gui.py module for handling pyqtgraph plots 2016-11-07 17:43:47 -08:00
Scott Lawson
81190a7f4c Added a new gamma table that seems to work better 2016-11-07 17:43:31 -08:00
Scott Lawson
404a216272 Updated visualize.py to reflect changes in DSP module 2016-11-07 17:43:12 -08:00
Scott Lawson
cb34b6353d Significantly changed and improved sandbox.py visualizations
Note: All code in sandbox.py is temporary and used for experimenting
with different visualizations.
2016-11-07 17:42:50 -08:00
Scott Lawson
65d35c2724 dsp module now creates a mel filterbank
Mel filterbank generated based on settings in config.py. Other small
pep8 formatting changes. Renamed ExponentialFilter to ExpFilter.
2016-11-07 17:41:26 -08:00
Scott Lawson
696d684c79 Added melbank.py module for generating Mel filterbanks 2016-11-07 17:40:18 -08:00
Scott Lawson
262206d359 Major changes to onset detection and visualization
Changes to config.py:
> Increased STFT rolling window size
> Added configurable options for setting the max and min FFT frequency

Changes to dsp.py:
> Significantly improved the normalized weighted phase deviation code.
This noticeably improves the onset detection accuracy.
> Logarithmic partitioning of the FFT bins now happens after onset
detection instead of before onset detection. This improves onset
detection accuracy at the expense of CPU time.
> Fixed a bug in the log_partition function which would sometimes cause
out of bounds errors
> Refactored and removed some functions that aren't needed anymore

Changes to sandbox.py:
> Sweeping changes to the visualization functions. The onset detection
functions are now combined after applying Gaussian blur to each onset
function individually. This improves the overall agreement between the
onset functions.
> Hyperbolic tan function is used to map saturated pixels to the range
[0, 1]
> Added a new rainbow generation function with more options than the old
one.
> Refactored most of the led update functions.
> The LED brightness is now being plotted instead of onsets
2016-10-24 16:42:03 -07:00
Scott Lawson
a38a8e1680 Refactored all of the led_update_X functions
Led update functions no longer return a colorized array. Colorizing is
now done in led_visualization. It makes more sense for the led_update_X
functions to return 1D brightness arrays and then to apply color
afterwards. This should also improve performance somewhat. Also added a
new function leak_saturated_pixels() which allows saturated colors (>255
value) to leak into the adjacent color channels
2016-10-23 16:46:52 -07:00
Scott Lawson
9e615e0f35 Added a lowpass filter to pixel output 2016-10-23 15:39:18 -07:00
Scott Lawson
8a1a53fd61 Changd led update functions to return pixel arrays
Led update functions now return an array of pixel values instead of
updating the LED strip directly.  This change makes it possible to
combine the effects of different LED update functions before updating
the LED strip. The function responsible for updating the LED strip is
led_visualization()
2016-10-23 14:56:03 -07:00
Scott Lawson
39325ce69b Minor bug fixes and tweaks 2016-10-22 22:16:08 -07:00
Scott Lawson
d966bb878d Complete rewrite of most sections, added new onset detection 2016-10-22 21:55:22 -07:00
Scott Lawson
17313c254b Major refactoring and update
* Moved all module settings to a new config.py file
* Completely overhauled visualize.py and added a new radiate effect that
colours the radiative beats according the beat frequency.
* Improved some constants like the decay constant to be parametric so
that they scale to any led strip size
* Added temporal dithering to Beat.update_pixels() so that it now
supports fractional speed values. Being limited to integral values was
starting to become a problem.
* Overhauled and simplified the LED module.
* When updating pixels, the LED module no longer sends UDP packets for
pixels that have not changed. This optimization reduces the packet load
significantly and should allow for higher refresh rates.
* Renamed lookup_table.npy to gamm_table.npy to better reflect that the
table is used for gamma correction of the LED strip
2016-10-13 22:27:45 -07:00
Scott Lawson
0bd7385a20 Added missing lookup table, fixed pep8 formatting
Added lookup_table.npy which was missing from the previous commit. The
led.py module uses this table to do LED brightness gamma correction.
Fixed formatting for pep8 compliance
2016-10-12 16:02:06 -07:00
Scott Lawson
0809f9b6d1 Refactored visualize.py
Refactored the led shooting_beats effect (now renamed to
radiate_effect). Formatted for pep8 compliance
2016-10-12 16:00:05 -07:00
Scott Lawson
028500f04e Initial commit
Initial commit of working python and ESP8266 code.
2016-10-12 14:50:00 -07:00