8000 JBL partybox-like soundreactive effect by tonyxforce · Pull Request #67 · MoonModules/WLED-MM · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

JBL partybox-like soundreactive effect #67

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

Merged
merged 17 commits into from
Dec 10, 2023
Merged

Conversation

tonyxforce
Copy link

this currently only works with the "color gradient" and the "colors 1&2" palettes

wled00/FX.cpp Outdated
Comment on lines 1923 to 1925
uint16_t pos = 0;
uint8_t hue = 0;
int hueDelay = 0;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe change the scope of those variables to be static inside mode_jbl or put them in a struct or change their names to something less generic.
It is very likely that other fx developers will use variables with the same name. In the best case scenario this will just spam a "shadows variable" warning. In the worst case they will use your variables by accident and strange stuff happens.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my proposal below ... I agree these should not be global. Better to use SEGENV.aux0, SEGENV.aux1, SEGENV.step.

@softhack007
Copy link
Collaborator

Hi, thanks for the PR :-)

Yes there is a lot of optimization potential with your code. In fact it should not depend on global variables, as effects may run in several instances in parallel, especially they will be used with several segments.

For a start:

  • instead of global data, try to use "SEGENV.aux" variables.
  • WLED has standard macros for extracting the R/G/B components from an uint32: R(x), G(x), B(x).

Don't worry, we will guide you through improving your code.

https://github.com/MoonModules/WLED/blob/9e4f040d4103fd3069bcab633ad89d690f2bf1b4/wled00/FX.h#L393-L398

https://github.com/MoonModules/WLED/blob/9e4f040d4103fd3069bcab633ad89d690f2bf1b4/wled00/wled.h#L856-L861

Also this guide is worth reading (however a bit outdated): https://github.com/atuline/WLED/wiki/WLED-Programming-Notes#important-wled-variables

I'll make a few more proposals once I find a bit of time to read your source code in detail.

@tonyxforce
Copy link
Author

All things you noted above should be fixed in the latest commit

@softhack007
Copy link
Collaborator
softhack007 commented Aug 24, 2023

All things you noted above should be fixed in the latest commit

thanks, looks much cleaner already 👍

@tonyxforce
Copy link
Author

After uploading the "new" code on my esp32, it looks like the animation is much slower than before (with the initial commit)

@softhack007
Copy link
Collaborator
softhack007 commented Aug 24, 2023

If you used latest mdev, it could be due to a bug in audioreactive, that caused the microphone to switch off and you would only see "simulated sound". I've fixed that one just an hour ago.

Please try again with the latest source code. If your effect still seems too slow, please verify that you compare at similar FPS (led settings "target fps"). I can take a closer look on the weekend, maybe there is some timing problem due to integer arithmetics.

@tonyxforce
Copy link
Author

I use the latest (pulled few minutes ago) source code, the mic is working, and the fps is the same, but it's fine i added a slider to change/correct the speed

@@ -1941,7 +2019,7 @@ static const char _data_FX_MODE_JUGGLE[] PROGMEM = "Juggle@!,Trail;;!;;sx=64,ix=


uint16_t mode_palette() {
uint16_t counter = 0;
uint16_t counter = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, this seems like not related to your new effect.

@softhack007
Copy link
Collaborator
softhack007 commented Aug 24, 2023

As a minor thing, please think about the name of your effect
... JBL is a speaker manufacturer, and I don't want to get into conflict with them due to abuse of brand names ...
How about calling it "partybox" or something else, best would be if the name gives people and idea already about what they might see.

@softhack007
Copy link
Collaborator

"Party Beatbox" maybe?

@tonyxforce
Copy link
Author

how exactly should i refer to this effect? I plan to make the other effects this speaker has

@softhack007
Copy link
Collaborator
softhack007 commented Aug 25, 2023

how exactly should i refer to this effect? I plan to make the other effects this speaker has

Well one of the effects looks exactly like our "gravimeter" (mirrored) just without the peak dot. So you don't need to replicate that one.

Not sure about the others - these stuttering rotating rings look ugly to me, maybe call that "party jerk" :-)

In fact it's your call to find nice names, I'm just saying avoid the word JBL to keep JBL legal far away from us.

@tonyxforce
Copy link
Author
tonyxforce commented Aug 25, 2023

I'm just saying avoid the word JBL to keep JBL legal far away from us.

Yeah i was thinking about that too

maybe call that "party jerk"

Party jerk it is

In fact it's your call to find nice names

I think it's almost the hardest part about it

@tonyxforce
Copy link
Author

are there any more problems or potential enchancements with this effect?

@softhack007
Copy link
Collaborator

are there any more problems or potential enchancements with this effect?

Give me a week or so to come back to your effect. I was very busy the last weeks with helping to push out upstream -b5.

@tonyxforce
Copy link
Author

are there any more problems or potential enchancements with this effect?

Give me a week or so to come back to your effect. I was very busy the last weeks with helping to push out upstream -b5.

Okay, no problem take your time, i was just wondering

@softhack007
Copy link
Collaborator

Hi, I'm very busy@job currently, will come back to this PR in October.

@softhack007
Copy link
Collaborator
softhack007 commented Dec 10, 2023

Hi, I'll merge this PR. I have a few ideas for improvement, but that can also be done later:

  • Option to use Sound "Pressure" instead of "Volume"
  • make the effect time-dependant, instead of being frame-rate dependant
  • make the effect work with non-gradient palettes
  • better use of sensitivity slider range (volumeSmth is always in [0, 255])
  • and some minor optimisations

this way your new effect will make it into the next MM release.

@softhack007 softhack007 merged commit 281d9b5 into MoonModules:mdev Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0