Native Android client for Spotify, built with Jetpack Compose
Kotlin ad-freeadblockandroidjetpack-composekotlinlyricsmusic-playermusic-videomyspotispotifyspotify-adblockerspotify-clientspotify-connectspotui
AutoMix: B's tempo comes back to its own at 0.1 % a beat (16 beats at least), and the phase lock of a heard deck is gentle (5 readings, 12 ms dead band, 1.5 % at most low in the mix, 0.8 % after): B's tempo swayed between 1.04 and 1.11 every second
kota-zod7a05010f1d2
diff --git a/base/app/src/main/java/com/music/spotui/di/LocalPlayer.kt b/base/app/src/main/java/com/music/spotui/di/LocalPlayer.ktindex c8261e85..9f9f4f46 100644--- a/base/app/src/main/java/com/music/spotui/di/LocalPlayer.kt+++ b/base/app/src/main/java/com/music/spotui/di/LocalPlayer.kt@@ -751,7 +751,8 @@ object LocalPlayer {// (Started early by the start delay on purpose: up to that much before its start is expected.)if (preroll && target < run.startMs - startLead * plan.speedB - 300) { d.pause(); d.seekTo(run.startMs); run.state = MixState.READY; run.errors.clear(); return }val err = bPos - target- run.errors.addLast(err); while (run.errors.size > 3) run.errors.removeFirst()+ // Five readings: a player's position moves in steps of 10–20 ms, three let that noise through.+ run.errors.addLast(err); while (run.errors.size > 5) run.errors.removeFirst()val e = run.errors.sorted()[run.errors.size / 2]val base = plan.speedB * rate()// A second after the start, the deck's distance says how late it sounded: the next starts that much earlier.@@ -767,11 +768,12 @@ object LocalPlayer {}run.locked = kotlin.math.abs(e) < 15if (!preroll) run.worstMs = maxOf(run.worstMs, kotlin.math.abs(e))- // Muted, or still low in the mix: fast and strong; heard: gentle.- val fast = preroll || quiet- val dead = if (preroll) 2.0 else 6.0- val horizon = if (fast) 300.0 else 1500.0- val limit = if (preroll) 0.08 else if (quiet) 0.05 else 0.02+ // Muted: fast and strong. Heard, even low in the mix, gentle: up to 5 % within 300 ms there+ // made B's tempo sway between 1.04 and 1.11 every second over a 9 % stretch (reported as a mess),+ // for gaps of 5–20 ms that are mostly the positions' own noise.+ val dead = if (preroll) 2.0 else 12.0+ val horizon = if (preroll) 300.0 else if (quiet) 800.0 else 2000.0+ val limit = if (preroll) 0.08 else if (quiet) 0.015 else 0.008val nudge = if (kotlin.math.abs(e) <= dead) 0.0 else (-e / horizon).coerceIn(-limit, limit)val speed = (base * (1 + nudge)).toFloat()// What the nudges moved the deck by so far (ms of B), for the start delay learnt above.diff --git a/base/automix/src/main/kotlin/app/myspoti/automix/MixPlanner.kt b/base/automix/src/main/kotlin/app/myspoti/automix/MixPlanner.ktindex 68f0d164..83be73f2 100644--- a/base/automix/src/main/kotlin/app/myspoti/automix/MixPlanner.kt+++ b/base/automix/src/main/kotlin/app/myspoti/automix/MixPlanner.kt@@ -371,7 +371,9 @@ object MixPlanner {/** B's speed back to 1: about 0.3 % per beat, at least 8 beats. */private fun restore(speed: Double, period: Double): Double {- val beats = max(8.0, abs(speed - 1) / 0.003)+ // About 0.1 % a beat, 16 beats at least: at 0.3 % the tempo was heard dropping back to the+ // song's own after the mix (reported: "sped up, then suddenly normal").+ val beats = max(16.0, abs(speed - 1) / 0.001)return if (abs(speed - 1) < 1e-4) 0.0 else (beats * period).let { (it * 10).roundToInt() / 10.0 }}}