Read Functions for Audio Waveform and Envelope Objects

toutant

Well-known member
Hi,

I'm working on a synth build, and would love to add some LED indication for the envelopes and LFO. Would it be feasible to add some kind of read function to the waveform and envelope objects in the audio library? (Something similar to the read function on the DC object.)

screen2.jpg

Thanks as always, Paul, for all the work you do on the Teensy hardware/software.
 
It would indeed be feasible for the envelope - the "mult_hires" variable in AudioEffectEnvelope is a fixed point 2.30
value you could sample with an extra method.

For the waveform itself the AudioAnalyzeRMS class might be useful as is.
 
Hi,
Would it be feasible to add some kind of read function to the waveform and envelope objects in the audio library? (Something similar to the read function on the DC object.)
I've just implemented a float getGain() function on my variant of an exponential envelope generator - grab the latest code from https://github.com/h4yn0nnym0u5e/Audio/tree/features/expEnvelope. As suggested by @MarkT, it just reads out the mult_hires value, scaled to a float between 0.0 and 1.0 for consistency with the rest of the access functions. Obviously this only updates every 2.9ms, but that should be more than enough for front panel LEDs.

The result might be a bit like this: magenta plot is the actual envelope, red plot is the result of reading getGain() every audio engine update cycle. (In reality the red will trail the magenta, but my test code reads the previous envelope and the current gain level. And the weird decay is because I changed it just after it started...)
2021-04-28 19_30_08-COM20 (Teensy) Serial+MIDI+Audio.png

Cheers

Jonathan
 
Thanks, Mark and Jonathan!

I went ahead and added a read function (same as your getGain function) to the envelope.

Now the question is, can I get a value from a waveform object that I could update an LFO indicator with?

BTW, I should add that the AudioAnalyzeRMS class only gives RMS peaks, and not a continuous reading of the wave amplitude needed for an LED indicator.

What I'm trying to do is something like this, where the LFO LED indicator flashes in time with the LFO waveform.
https://www.youtube.com/watch?v=wlYbjkd3VTk
 
Last edited:
Back
Top