Commit Graph

57 Commits

Author SHA1 Message Date
Scott Lawson
219eb2b62f Python 2.7 compatibility fix 2017-01-05 02:41:04 -08:00
Scott Lawson
fdf79018ad Fixed bug where disabling gui caused error 2017-01-05 02:03:54 -08:00
Scott Lawson
c0ed75d298 Changed default IP to match ESP8266 firmware 2017-01-05 00:14:23 -08:00
Scott Lawson
75d8e8d9f7 Typo 2017-01-05 00:13:39 -08:00
Scott Lawson
32cea53ea1 Fixed typo 2017-01-05 00:13:14 -08:00
Scott Lawson
9837fec3b9 Added more information about device setting in config.py 2017-01-05 00:12:28 -08:00
Scott Lawson
0f29d7c614 Minor PEP8 formatting change 2017-01-04 23:21:09 -08:00
Scott Lawson
0e73fd1348 Improved GUI, fixed bugs, better visualizations
* Resolved an issue with the ESP8266 where gamma correction would be
performed twice. Changed GAMMA_CORRECTION to SOFTWARE_GAMMA_CORRECTION
to make a distinction between software and firmware gamma correction.
The ESP8266 does firmware gamma correction and dithering, while the
Raspberry Pi uses slightly more inferior software gamma correction.
Changed the software gamma table to match the gamma table used in the
ESP8266 firmware.

* Improved the spectrum visualization by using one of the color channels
to visualize the absolute value of the temporal derivative of the
spectrum. Also added a feature to reject the "common mode" spectral
components, which is analogous to the spectral DC component.

* Signficantly improved the GUI and added a frequency adjustment slider.
Adjusting the frequency range has a big impact on the visualization
output. Recommend using a high frequency range (something like 4 kHz -
10 kHz) when running the scrol visualization.
2017-01-04 22:12:12 -08:00
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