Skip to content

Conversation

@federicojacobi
Copy link

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:

  • You may not want to modify your instrument.
  • Some instruments sound great as a single note, but produce interesting effects when the note is sustained. Ex: 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:

[
  1,    // full volume
  1.2,  // 80% volume
  1.4,  // 60% volume
  1.6,  // 40% volume
  1.8   // 20% volume,
  -1    // release (mute the note)
]

Now:

[
  1,     // full volume, note lasts one beat.
  1.2,   // 80% volume, note lasts one beat.
  1.388, // 60% volume, note is sustained for 3 beats.
  1.262, // 40% volume, note is sustained for 2 beats.
  1.8    // 20% volume,
  -1     // release (mute the note)
]

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant