audio-fade-separate-gain-line

Installation
SKILL.md

A fade needs its own gain line

A sleep timer that ends on a bare pause() chops the music off. Ramping to silence first is a two-line change with three ways to get it wrong. The rule that avoids all three: the fade gets its own gain line, multiplied with the user's volume at the point the value reaches the audio path.

interface MediaPlayerInterface {
    var volume: Float           // the user's level — reported back to the UI
    var sleepFadeFactor: Float  // 0f..1f, the fade's own line
}
  • Android (Media3): a small AudioProcessor in the chain, one instance per player, all reading the same @Volatile field: arrayOf(crossfadeFilter, sleepFade).
  • Desktop: engines commonly expose two levels — a device-mixer level and a software level. Put the fade on one and the crossfade ramp on the other; they then multiply and neither has to know the other exists.
Installs
2
GitHub Stars
35
First Seen
6 days ago
audio-fade-separate-gain-line — maxrave-dev/kotlin-footguns