Assistance getting audio signal for LED flashing #798
balimansky
started this conversation in
General
Replies: 3 comments 1 reply
-
|
You could write your own AudioOutput filter that does a low resolution FFT to get frequency bands, or do things like get an amplitude envelope. In MAD MP3 there is a callback, IIRC, that will give you the frequency domain version before it's converted to time domain, check the docs. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
I’m doing some digging - and appreciate this reference to MAD MP3. I’m not super knowledgeable about FFT or how I could create my own filter. I wondered if there was a way to read a value on the output pin which is doing to the DAC/amplifier, and then cause the LED to flash based on that? Could you give me a little more of a hint on how I can look at the amplitude envelope? While I’m not super knowledgeable here I’m very motivated to get this to work!!!
Thanks,
Ben
Ben Alimansky
***@***.***
(917) 435-1996 (m)
On Nov 3, 2025, at 8:21 AM, Earle F. Philhower, III ***@***.***> wrote:
You could write your own AudioOutput filter that does a low resolution FFT to get frequency bands, or do things like get an amplitude envelope. In MAD MP3 there is a callback, IIRC, that will give you the frequency domain version before it's converted to time domain, check the docs.
—
Reply to this email directly, view it on GitHub<#798 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADDUJ54PDI3IX3DK777JOLL325CEZAVCNFSM6AAAAACK54B5RSVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTIOBVHAZDGMQ>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
|
Awesome - this is super helpful. I will experiment!
Ben
Ben Alimansky
***@***.***
(917) 435-1996 (m)
On Nov 3, 2025, at 1:19 PM, Earle F. Philhower, III ***@***.***> wrote:
Generally the amplifier will be producing a waveform both above and below 0V, and I don't think that any ESP or Pico onboard ADC would work for long at <0V input. With an opamp or two you can fix that and scale accordingly, but at that point you could just drive the LEDs off that opamp output, probably.
Making an output filter just involved making a passthrough AudioOutput class that takes a real output device to send samples to. You peek at some subset of samples to do something else.
For envelope, you can take a window of some # of samples (say, 128 samples every 1/10th of a second), then sum the squares of it to get a simple amplitude for that section. The output samples are signed, fixed point 0.16 values, so you need to be careful how you square or it won't do what you want it to. (You could also sum the absolute values of every sample, of course, but that's notionally slower...no idea if that's true on these chips).
For the MAD library, you'd need to probably just bucket the 1152 frequency domain samples into, say, 8 buckets where you sum 144 entries into one. Need to double-check the MAD docs, the frequency callback may get both real and imaginary components which may require more complicated processing...
—
Reply to this email directly, view it on GitHub<#798 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADDUJ5YWFDZL6S22IKG6R6D326FDTAVCNFSM6AAAAACK54B5RSVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTIOBWGE2TKMI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi -I'm bring up an old question that was asked years ago. I'm using the the ESP8266Audio libraries to stream music from the internet for a small project. I'd love to be able to drive some colored LEDs based on either frequency or the rhythm of the music. I saw some brief references that this can be done but am not sure how to proceed. Could someone provide a hint? Thank you! Ben
Beta Was this translation helpful? Give feedback.
All reactions