Moene's Main Site

Game audio, retro synth, melody IC, and random thoughts

EG.h: An Arduino Envelope Generator Based on MegaHits Score

No AI Code: This work contains 100% human written code. No AI generated code is being used in this library.

EG.h is an Arduino platform agnostic envelope generator library that outputs an envelope value from the internal envelope generator. The envelope generator works in two modes: SR and ADSR. When working in ADSR mode the EG runs in a fully enabled mode and is able to process attack, decay, sustain, and release. While in SR mode the EG automatically releases the note when the note is triggered thus producing an automatically decreasing value.

The Header

owo
Code language: C++ (cpp)

Ultimate Flexibility

To make this library as platform agnostic as possible, I decided to expose the update function for the user to call. This also makes the library extremely flexible since the update function can be called differently according to the work and precision requirement. When the code is time critical, the developer can place the update function inside a timer interrupt, thus making the code very time precise. Other wise when the goal is to just keep it simple, the update function can simply be placed inside the main loop (given the loop function contains no major blocking delays). Making this library extremely versatile.

What Next?

The code is currently in a minimal working state. I will release the whole library once I think the code is production ready.


Posted

in

by

Tags: