Skip to content

Unofficial YouTube Music / Spotify Premium client for Android, built in Liquid Glass. Audio effects, Spotify Connect, listening history, 8 languages. Rust core on librespot.

Cut the reverb tail at a track change, play at everyone else's level, take the shade

Lelonio49ceda6acdd1
diff --git a/app/.cxx/Debug/286k5v33/arm64-v8a/configure_fingerprint.bin b/app/.cxx/Debug/286k5v33/arm64-v8a/configure_fingerprint.bin
index 662c860..8013a64 100644
--- a/app/.cxx/Debug/286k5v33/arm64-v8a/configure_fingerprint.bin
+++ b/app/.cxx/Debug/286k5v33/arm64-v8a/configure_fingerprint.bin
@@ -2,27 +2,27 @@ C/C++ Structured Logc
a
_/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/additional_project_files.txtC
A
-?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  �����3  ��߈�3`
+?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  Ȃ���3  ��߈�3`
^
-\/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/android_gradle_build.json  �����3� ��߈�3e
+\/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/android_gradle_build.json  Ȃ���3� ��߈�3e
c
-a/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/android_gradle_build_mini.json  �����3� ��߈�3R
+a/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/android_gradle_build_mini.json  Ȃ���3� ��߈�3R
P
-N/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build.ninja  �����3� ��߈�3V
+N/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build.ninja  Ȃ���3� ��߈�3V
T
-R/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build.ninja.txt  �����3[
+R/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build.ninja.txt  Ȃ���3[
Y
-W/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build_file_index.txt  �����3 @ ��߈�3\
+W/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build_file_index.txt  Ȃ���3 @ ��߈�3\
Z
-X/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/compile_commands.json  �����3֚ ��߈�3`
+X/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/compile_commands.json  Ȃ���3֚ ��߈�3`
^
-\/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/compile_commands.json.bin  �����3 �" ��߈�3f
+\/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/compile_commands.json.bin  Ȃ���3 �" ��߈�3f
d
-b/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/metadata_generation_command.txt  �����3
+b/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/metadata_generation_command.txt  Ȃ���3
� ��߈�3Y
W
-U/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/prefab_config.json  �����3  ( ��߈�3^
+U/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/prefab_config.json  Ȃ���3  ( ��߈�3^
\
-Z/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/symbol_folder_index.txt  �����3  Y ��߈�3D
+Z/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/symbol_folder_index.txt  Ȃ���3  Y ��߈�3D
B
-@/Users/emanuele/Progetto Spotify/app/src/main/cpp/CMakeLists.txt  �����3 � �Ȅ��3
\ No newline at end of file
+@/Users/emanuele/Progetto Spotify/app/src/main/cpp/CMakeLists.txt  Ȃ���3 � �Ȅ��3
\ No newline at end of file
diff --git a/app/src/main/java/dev/emanuele/spot/playback/AudioOutput.kt b/app/src/main/java/dev/emanuele/spot/playback/AudioOutput.kt
index 6470508..2047389 100644
--- a/app/src/main/java/dev/emanuele/spot/playback/AudioOutput.kt
+++ b/app/src/main/java/dev/emanuele/spot/playback/AudioOutput.kt
@@ -268,11 +268,19 @@ class AudioOutput {
setAuxEffectSendLevel(0f)
attachAuxEffect(0)
}
- // Released, not just disabled. Disabling stops the effect processing but
- // leaves it on the output mix, and the tail already inside it went on
- // ringing out over whatever the phone played next. Releasing it takes it
- // off the mix entirely; the next play builds a fresh one, which starts
- // silent by definition.
+ dropReverb()
+ }
+
+ /**
+ * Throws away the reverb, and with it whatever is still ringing inside it.
+ *
+ * Released, not just disabled. Disabling stops the effect processing but
+ * leaves it on the output mix, and the tail already inside it went on
+ * ringing out over whatever came next. Releasing it takes it off the mix
+ * entirely; the next play builds a fresh one, which starts silent by
+ * definition.
+ */
+ private fun dropReverb() {
reverb?.runCatching {
enabled = false
release()
@@ -354,6 +362,13 @@ class AudioOutput {
// moments of the next one.
stretcher?.release()
stretcher = null
+
+ // And the reverb holds seconds of it. Emptying the track's buffer
+ // says nothing to an effect that has already been fed: the tail of
+ // the song being left went on ringing over the opening of the one
+ // being chosen. It is rebuilt, silent, when the engine says the new
+ // track is playing.
+ dropReverb()
}
}
diff --git a/app/src/main/java/dev/emanuele/spot/playback/PlaybackService.kt b/app/src/main/java/dev/emanuele/spot/playback/PlaybackService.kt
index 2c56715..b537a41 100644
--- a/app/src/main/java/dev/emanuele/spot/playback/PlaybackService.kt
+++ b/app/src/main/java/dev/emanuele/spot/playback/PlaybackService.kt
@@ -91,6 +91,15 @@ class PlaybackService : MediaSessionService() {
)
.build()
+ // The app's own mark in the shade, instead of Media3's generic note.
+ // The provider is built rather than subclassed: the small icon is the
+ // only thing being changed.
+ setMediaNotificationProvider(
+ androidx.media3.session.DefaultMediaNotificationProvider.Builder(this)
+ .build()
+ .apply { setSmallIcon(dev.emanuele.spot.R.drawable.ic_notification) },
+ )
+
AudioEffects.load(this)
// Applied straight to the output rather than waiting for the UI: the
// service can be running with no activity attached at all.
diff --git a/app/src/main/res/drawable/ic_notification.xml b/app/src/main/res/drawable/ic_notification.xml
new file mode 100644
index 0000000..530cf7d
--- /dev/null
+++ b/app/src/main/res/drawable/ic_notification.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ The square wave, for the media notification.
+
+ White and flat on purpose: Android draws a notification's small icon as a
+ silhouette from its alpha channel alone, so any colour in here would be
+ thrown away. Traced from app/icon-src/wave-square.svg, which is where the
+ app's own mark comes from.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="256"
+ android:viewportHeight="256">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M240,128v56a8,8,0,0,1,-8,8H128a8,8,0,0,1,-8,-8V80H32v48a8,8,0,0,1,-16,0V72a8,8,0,0,1,8,-8H128a8,8,0,0,1,8,8V176h88V128a8,8,0,0,1,16,0Z" />
+</vector>
diff --git a/native/src/engine.rs b/native/src/engine.rs
index 8350816..fafe293 100644
--- a/native/src/engine.rs
+++ b/native/src/engine.rs
@@ -15,7 +15,7 @@ use librespot_core::{
session::Session, spotify_uri::SpotifyUri,
};
use librespot_playback::{
- config::{AudioFormat, Bitrate, PlayerConfig},
+ config::{AudioFormat, Bitrate, NormalisationMethod, PlayerConfig},
mixer::{softmixer::SoftMixer, Mixer, MixerConfig},
player::{Player, PlayerEvent},
};
@@ -156,7 +156,19 @@ pub fn start(
let player_config = PlayerConfig {
bitrate: Bitrate::Bitrate320,
+ // Loudness normalisation, which is what keeps one track from being
+ // twice as loud as the next.
+ //
+ // On its own it made the app quieter than everything else on the phone:
+ // it pulls every track down towards a target and nothing puts the level
+ // back. The pregain is what puts it back — Spotify's own "loud" setting
+ // is about three decibels over its normal one, and a couple more brings
+ // this level with apps that do no normalisation at all.
normalisation: true,
+ normalisation_pregain_db: 5.0,
+ // The limiter, not a flat scale: with five decibels added, the loudest
+ // moments of a loud master would otherwise clip.
+ normalisation_method: NormalisationMethod::Dynamic,
// Dithering runs per sample — 88200 times a second at 44.1 kHz stereo —
// for a noise-floor benefit nobody hears on a phone. Off, to leave the
// decoder more headroom against output underruns.