Lightning effect with Audio activation

I LOVE the lightning effect on Wled but would it be possible to make it sound triggered with an adjustable delay between noise and the leds illuminating. You know, for added realism.

It is, but someone needs to program it. :smiley:

Still, a delay should be in the opposite way. First lightning then thunder. :wink:

Yes, correct but after the audio has started, you won’t know the difference! Hence the ideal requirement for the delay. I wish i could program ( i can’t, i’m incapable of thinking in that way) but just thought it would be great audio activated effect.
Hopefully someone may take up the challenge.

very basic programming: if this then that else other; repeat;
:wink:

BTW anyone can do that. Not all efficiently, though.

In SR or MM forks there are audio responsive palette , i do not like the result with this effect on a matrix compared to normal audio effects so might be that is why this did not make the cut in AC but if you will try to tweak or code it then might be you could get something out of that


You can test that from here (https://wled-install.github.io/)

Nobody wanted to provide audio reactive palettes to upstream. :wink:
And I am not saying they will be accepted as is.

We have requested that a while back and it was added with the aim to expand the audio effects without coding extra effects as we know all of the guys and you included are doing their best with the limited time . I am not sure if that could be part of the audio user mod but I think it still needs a magic touch from someone who really knows the in and out of wled . I wounder who is that :smiley: . We have limited experience with the new features tested here and there and I do agree there should be a case by case look at each available feature

I think people are making more of this than is needed for this effect.
So to try and simplify, IF the microphone detects a sound THEN trigger the lightning routine.
No ramps, no colour palletes, just IF SOUND THEN LIGHTENING.
The standard lightning effect seems to have a “random” delay and “random” flash patterns. That’s brilliant as it is. Just needs the IF sound THEN part. No, i’m sorry, if i could i would but at almost 60 i AM too old to learn to code. My programming days stopped with the ZX-Spectrum when it stopped.
I do hope it makes it into the next or future build.
Still, i think WLED is bloody brilliant anyway and love how it has transformed my windows in my house.

Okay people get the point , you might try to look at this usermod WLED/usermods/smack_that at Smack_That_Usermod · ChuckMash/WLED · GitHub and please do not think you are too old to tweak a bit of code

I didn’t think they would be accepted as I was not aware of how a usermod can provide extra palettes. If this is possible, then happy to port the palettes inside the audio usermod

It is not unless you hack int custom palettes.
That is possible though.

Again, totally over engineering of a problem with (to me) a seemingly simple solution.
And yes, you have to accept, like i do that whilst i can build, repair, upgrade, solder, flash, unbrick devices, i cannot program them. No, i can’t. I’ve tried. The same way i can’t draw or play a musical instrument. Hell i effed up playing the triangle in the school concert as a kid so i know my limits.
ANyway, i’ll stick with it as it is. It’s the easiest solution but thanks all the same.

Doesnt the lightening effct require just one pallete? White???

Ok, thanks for the info. Too much for me to take in but it seems the answer is not easily.
I can live with it as it is.
Topic closed.

@netmindz an idea sprung regarding audio reactive palette!

The hack you use in MM is ugly as hell and will never make it upstream. But… There is always but. :smiley:

What you can do is reuse custom palettes (strip.customPalettes[]) and modify them in Audioreactive usermod directly (as they are public member in strip instance).
You can add an usermod option something like “audio-palette-id” which will define which of custom palettes to overwrite. Then, in usermod itself, update that palette using loadDynamicGradientPalette(). To get the number of custom palettes call strip.customPalettes.size() and if you get 0, no custom palettes are defined and you can create one on the file system if you wish. Or append one in RAM only for audio needs, but there is a limit of 10.

If you need to have more than 1 audio reactive palette (as you do in MM) think of something that will still use above. Though, IMO one audio reactive palette should be adequate if not then you need billions of them. :wink:

I hope you understand what I’m trying to say. :smiley:

Yeah I follow most of what you say I think, custom palettes did not exist when I wrote this feature.

As for “ugly as hell” I’m not sure how what you propose is any different if I’m still just ultimately still just calling loadDynamicGradientPalette() bar the need for certain palette numbers to be handled differently, which already exists in the code, this is just the 3rd type of palettes.

I’ll take a look at Custom Palettes however, recommend a good example of adding a custom palette programmatically?

Ugly as hell as in “hard-code hacked palette ID” and use ifs with hard-coded IDs. :wink:
I did not imply other technical reasons.

As all existing code in WS2812FX::handle_palette uses a case statement using the index of the array, then the existing code is already littered with magic numbers. Adding a constant for each of my new palettes would not prevent things breaking if anyone were to add a new palette to the array at any point other than the end.

If I choose to ignore the current code style and swap to using a constant rather than magic number, then I do accept that by using the same constant elsewhere in my code that this would mean a single instance of a magic number only once in my code. Alternatively, calling my method 3 times with a mode param and associated constants would also defend that method from positional changes in the highly fragile existing palette code.

I do not think it appropriate however to slag off another developers work in this manner on the basis of an if statement using a magic value or adding an extra case to existing switch statement. If it was meant as good humour and pulling my leg, I suggest that this is only appropriate for someone you have an existing relationship with where the basis of mutual respect has already been established

I am sorry if I offended you. Take my apology. Please.

You did, so thank you for that apology.

Please in future provide constructive feedback by offering specific suggestions for what you think could be improved.

Forgive my ignorance regarding custom palettes, but how are these accessed if not by fixed ID? Surely they require that for use in presets, access via dmx etc