Add duration+attenuation logic and calculator #43
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As amazing as ZzFXM is, it does have a weakness that can be "easily" solved. When creating songs, every note must be played once per beat and therefore you cannot make notes last a longer amount of time without modifying the instrument's sustain (or release) which produces a TA-TA-TA-TA-TA when you want a TAAAAAAAH. So two cases derive from this:
zzfx(...[1.8,,73,.15,2,.03,1,4.8,,-3,,,,,124,,.28,.66,.36]);Given that ZzFX already has a ADSR envelope, we can emulate the note playing longer by modifying the sustain parameter to match the BPM of the current song.
The challenge is how to express this in the smallest footprint possible while maintaining backwards compatibility. The solution I came up with is to simply use what's already there: the decimal for attenuation.
The upside is that using attenuation only will work as is. It is backwards compatible. The downside is that when adding duration to the decimal what is happening becomes less than obvious:
Previously:
Now:
I think this doesn't matter too much since the output (music) will play exactly the same and this is merely an encoding issue for the tool(s) to handle. Unfortunately my Svelte is not good enough to modify the tracker.