I'm using PWM with analogWriteFrequency() to drive MOSFETs connected to magnets which vibrate tuned strings. Works great.
The analogWrite() function increases and decreases the duty cycle and acts a bit like a volume control in this context. I've been able to control that effectively via MIDI CC, but I'd much rather handle this on the teensy side using an ADSR envelope generator.
I've looked a bit at AudioEffectEnvelope in the Audio library, but can't see how to use it with analogWrite().
Any advice or examples of how to use AudioEffectEnvelope to control a simple argument in this way?
Thanks!
The analogWrite() function increases and decreases the duty cycle and acts a bit like a volume control in this context. I've been able to control that effectively via MIDI CC, but I'd much rather handle this on the teensy side using an ADSR envelope generator.
I've looked a bit at AudioEffectEnvelope in the Audio library, but can't see how to use it with analogWrite().
Any advice or examples of how to use AudioEffectEnvelope to control a simple argument in this way?
Thanks!