-
-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Usermod - Auto Playlist #124
Conversation
As this a branch pull request rather than a pull request from a fork, my intention was that you @troyhacks could make any changes you wished as well, I was looking just to handle replacing your hard coded values with the right usermod UI bits, the actual analysis side is up to you 😀 |
Perfect, thank you! Testing right now and it seems to be working in theory - but the automatic changes are happening MUCH more quickly in your implementation. Debugging that now. :) |
Ok, it's all done and working! Thank you for this - just what I needed to get it across the finish line. Pulling the volume into the usermod was super useful too - I was able to stop the analysis from going crazy during silence. Overall the "Troy's extra data" in the AR usermod havebeen thoroughly tested and vetted and ensured it's doing what it's supposed to and with the correct values. The one issue I had was bridging the data via I added the AutoChange tuning parameters to the usermod data. Save the usermod once after updating it and the new data should be populated when you go back into it. |
Added new logic for
Using When the AutoChange data is kept fresh, there's less frantic changes when we go back into AutoChange mode. |
Disabled by default
… auto-playlist
* prevent infinite loop in case that there is only one preset in a playlist * fixing two typos
* initialize slow and fast filters with current values (first call only) - reduces time for filter stabilization * use slightly optimized variant of "rolling average" filter (result is exactly the same) --> replaced `xX = xX * (1-a) + newX * a;` by `xX = xX + a * (newX - Xx);` * use constants for filter parameters (for tinkering and improved readability)
USER_PRINTF("Loading presets from playlist: %3d\n", currentPlaylist); | ||
#endif | ||
|
||
JsonObject playtlistOjb = doc.to<JsonObject>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen some "WS buffer allocation failed." errors during testing auto_playlist. Could it be that JsonObject playtlistOjb
or autoChangeIds.push_back
leave memory leaks behind?
@ewoudwijma @troyhacks @netmindz I'm not so experienced with ArduinoJSON and std:vector - would be great if one of you could scrutinize this part.
* use named constant instead of "100" * make change_threshold_change more robust against negatives * unloadPlaylist() before activating a new playlist
fixing mis-optimized math when calculating energy. energy = sum(amplitude^2). this is not the same as sum(amplitude)^2. Example: 1+5+7 = 13; 13 * 13 = 169 1*1 + 5*5 + 7*7 = 75
fftResult[] is indended to look good on GEQ, and has a very "twisted" representation of FFT results only. This change improves reconstruction of signal energy, by on-doing some of the "GEQ enhancements" in fftResults[].
Accepted what @softhack007 has suggested - honestly most of the numbers were pulled out of thin air originally, so any scrutinized numbers should be better - and tested fine too. I'm good with this as it stands if everyone else is. |
@troyhacks glad i did't actually "kill the magic" with my changes :-) From my side, i'm still looking for a way to "halt" a running playlist when auto-change is active. So that the auto-change progress is not gettig in conflict with the playlist mechanism that has its own timers for changing / shuffling / repeating. |
* adding suspendPlaylist() to playlist engine code * autoplaylist usermod calls suspendPlaylist() before switching to another preset * fix a potential overflow on `lfc` (uint8_t -> uint16_t)
* reduce from 3 lines to two lines * don't add to info when usermod is disabled in UM settings * show current playlist id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now :-)
New usermod to automatically flip between your "ambient" or "music" playlist when the music starts
Also optional to flip which music effect is running based on audio data rather than fixed time interval