Proof of concept: controlling the brightness of the LEDs using the potentiometers.
I just realized I wired them the wrong way btw lol. No worries, a few #defines and helper functions solve it, this is a common mistake, and I’m 99.9% sure the compiler is smart enough there’s no performance hit doing that.
Arduino pins cannot output a variable voltage: they output either 0V or 5V. The brightness is varied using Pulse Width Modulation (PWM): turning on and off repeatedly much faster than the eye can see.
Using a simple filter to smooth it over, we can turn a PWM wave into a variable voltage, that’s how I plan to output envelopes.
@woof fun as `cmath` stuff in C++11 is not constexpr compatible from the spec, so the code would only work under gcc.
https://stackoverflow.com/questions/17347935/constexpr-math-functions
also, under C++11 all `constexpr` functions need to directly return a value without any variables or making use of loops, which the code clearly makes use of.
C++14 and beyond supposedly alleviates this but the silly bot specifically mentioned C++11.
I don't mind it hallucinating subtly wrong answers if it can point me into useful directions though! Haven't touched C++ in years and don't know my way around MCU much yet.