Syllable Level Lyrics <3

This commit is contained in:
meowarex
2026-08-09 17:11:50 +00:00
parent 0d82c16168
commit a648e1a97c
8 changed files with 2621 additions and 106 deletions
@@ -36,7 +36,7 @@
"lyrics-rl-api-isrc.patch"
],
"title": "Radiant Lyrics API - WIP",
"description": "Use Radiant Lyrics API to fetch Lyrics (Higher quality & More providers). Pick how the highlight moves: whole Line or word-by-word (Word).",
"description": "Use Radiant Lyrics API to fetch Lyrics (Syllable Level & Higher Quality)",
"default": false,
"defaultVariantIndex": 0,
"variants": [
@@ -49,6 +49,59 @@
"fileNames": [
"lyrics-rl-api-word.patch"
]
},
{
"title": "Syllable",
"fileNames": [
"lyrics-rl-api-syllable.patch"
]
}
],
"extensionFiles": [
"radiant/RLAPILyricsHook.smali",
"radiant/RLAPILyricsWorker.smali",
"radiant/IsrcCache.smali",
"radiant/WordLyrics.smali",
"radiant/WordLyricsTick.smali",
"radiant/SylBrush.smali",
"radiant/SylLayout.smali"
],
"advancedOptions": [
{
"type": "toggle",
"key": "romanize",
"title": "Romanization",
"description": "Return a romanized transcription and show that instead of the original script",
"default": false,
"token": "RL_ROMANIZE",
"inline": true
},
{
"type": "toggle",
"key": "context_aware",
"title": "Context Aware Lyrics",
"description": "Display voice context cues (adlibs and duet singers get displayed seperately)",
"default": true,
"token": "RL_CTX_ON"
},
{
"type": "choice",
"key": "context_aware_mode",
"title": "Show",
"description": "",
"entries": [
"Adlibs",
"Singers",
"Both"
],
"values": [
"0x1",
"0x2",
"0x3"
],
"defaultIndex": 0,
"requiresOption": "context_aware",
"token": "RL_CTX"
}
]
},
+1 -1
View File
@@ -16,7 +16,7 @@ Every Patch & Integration can be disabled/enabled & adjusted exactly how you wan
- One-handed player controls
- Redesigned mini-player with gestures
- Word Level Lyrics (Word by Word) <3
- Syllable Level lyrics (SoonTM)
- Syllable Level Lyrics (Syllable by Syllable) <3
### Integrations
@@ -448,11 +448,7 @@
move-result-object v4
const-string v5, "text"
const-string v6, ""
invoke-virtual {v4, v5, v6}, Lorg/json/JSONObject;->optString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
invoke-static {v4}, Lradiant/WordLyrics;->lineText(Lorg/json/JSONObject;)Ljava/lang/String;
move-result-object v5
@@ -679,6 +675,17 @@
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-static {}, Lradiant/WordLyrics;->romanizeOn()Z
move-result v0
if-eqz v0, :no_romanize
const-string v0, "&romanize=true"
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
:no_romanize
const-string v0, "&platform=rl-mobile"
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
+59
View File
@@ -0,0 +1,59 @@
.class public final Lradiant/SylBrush;
.super Landroidx/compose/ui/graphics/ShaderBrush;
# Paints the syllable wipe gradient
# x0 = wipe edge, x1 = end of the soft trail
# instance state
.field public final x0:F
.field public final x1:F
.field public final c0:I
.field public final c1:I
.method public constructor <init>(FFII)V
.locals 0
invoke-direct {p0}, Landroidx/compose/ui/graphics/ShaderBrush;-><init>()V
iput p1, p0, Lradiant/SylBrush;->x0:F
iput p2, p0, Lradiant/SylBrush;->x1:F
iput p3, p0, Lradiant/SylBrush;->c0:I
iput p4, p0, Lradiant/SylBrush;->c1:I
return-void
.end method
# Gradient across the whole line
.method public createShader-uvyYCjk(J)Landroid/graphics/Shader;
.locals 8
new-instance v0, Landroid/graphics/LinearGradient;
iget v1, p0, Lradiant/SylBrush;->x0:F
const/4 v2, 0x0
iget v3, p0, Lradiant/SylBrush;->x1:F
const/4 v4, 0x0
iget v5, p0, Lradiant/SylBrush;->c0:I
iget v6, p0, Lradiant/SylBrush;->c1:I
sget-object v7, Landroid/graphics/Shader$TileMode;->CLAMP:Landroid/graphics/Shader$TileMode;
invoke-direct/range {v0 .. v7}, Landroid/graphics/LinearGradient;-><init>(FFFFIILandroid/graphics/Shader$TileMode;)V
return-object v0
.end method
+264
View File
@@ -0,0 +1,264 @@
.class public final Lradiant/SylLayout;
.super Ljava/lang/Object;
# interfaces
.implements Lam0/l;
# Remembers where each line's glyphs landed
# static state
.field public static cbs:[Lradiant/SylLayout;
.field public static layouts:[Landroidx/compose/ui/text/TextLayoutResult;
# instance state
.field public final idx:I
.method public constructor <init>(I)V
.locals 0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput p1, p0, Lradiant/SylLayout;->idx:I
return-void
.end method
# One reusable callback per line
.method public static cb(I)Lam0/l;
.locals 5
if-gez p0, :have_idx
const/4 p0, 0x0
:have_idx
sget-object v0, Lradiant/SylLayout;->cbs:[Lradiant/SylLayout;
if-eqz v0, :grow
array-length v1, v0
if-gt v1, p0, :have_arr
:grow
add-int/lit8 v1, p0, 0x1
const/16 v2, 0x40
if-ge v1, v2, :cap_ok
const/16 v1, 0x40
:cap_ok
if-nez v0, :copy
new-array v0, v1, [Lradiant/SylLayout;
goto :store_arr
:copy
invoke-static {v0, v1}, Ljava/util/Arrays;->copyOf([Ljava/lang/Object;I)[Ljava/lang/Object;
move-result-object v0
check-cast v0, [Lradiant/SylLayout;
:store_arr
sput-object v0, Lradiant/SylLayout;->cbs:[Lradiant/SylLayout;
:have_arr
aget-object v1, v0, p0
if-nez v1, :ret
new-instance v1, Lradiant/SylLayout;
invoke-direct {v1, p0}, Lradiant/SylLayout;-><init>(I)V
aput-object v1, v0, p0
:ret
return-object v1
.end method
.method public static get(I)Landroidx/compose/ui/text/TextLayoutResult;
.locals 2
if-ltz p0, :none
sget-object v0, Lradiant/SylLayout;->layouts:[Landroidx/compose/ui/text/TextLayoutResult;
if-eqz v0, :none
array-length v1, v0
if-ge p0, v1, :none
aget-object v0, v0, p0
return-object v0
:none
const/4 v0, 0x0
return-object v0
.end method
# Forget the layouts on track change
.method public static reset()V
.locals 1
const/4 v0, 0x0
sput-object v0, Lradiant/SylLayout;->layouts:[Landroidx/compose/ui/text/TextLayoutResult;
return-void
.end method
# Font size in pixels
.method public static em(Landroidx/compose/ui/text/TextLayoutResult;)F
.locals 8
invoke-virtual {p0}, Landroidx/compose/ui/text/TextLayoutResult;->getLayoutInput()Landroidx/compose/ui/text/TextLayoutInput;
move-result-object v0
invoke-virtual {v0}, Landroidx/compose/ui/text/TextLayoutInput;->getStyle()Landroidx/compose/ui/text/TextStyle;
move-result-object v1
invoke-virtual {v1}, Landroidx/compose/ui/text/TextStyle;->getFontSize-XSAIIZE()J
move-result-wide v1
# Only Sp converts to pixels
invoke-static {v1, v2}, Landroidx/compose/ui/unit/TextUnit;->getType-UIouoOA(J)J
move-result-wide v3
sget-object v5, Landroidx/compose/ui/unit/TextUnitType;->Companion:Landroidx/compose/ui/unit/TextUnitType$Companion;
invoke-virtual {v5}, Landroidx/compose/ui/unit/TextUnitType$Companion;->getSp-UIouoOA()J
move-result-wide v5
invoke-static {v3, v4, v5, v6}, Landroidx/compose/ui/unit/TextUnitType;->equals-impl0(JJ)Z
move-result v3
if-eqz v3, :fallback
invoke-virtual {v0}, Landroidx/compose/ui/text/TextLayoutInput;->getDensity()Landroidx/compose/ui/unit/Density;
move-result-object v0
invoke-interface {v0, v1, v2}, Landroidx/compose/ui/unit/Density;->toPx--R2X_6o(J)F
move-result v0
const/4 v1, 0x0
cmpg-float v1, v0, v1
if-lez v1, :fallback
return v0
:fallback
# No font size, guess from the line box
const/4 v0, 0x0
invoke-virtual {p0, v0}, Landroidx/compose/ui/text/TextLayoutResult;->getLineBottom(I)F
move-result v1
const/4 v0, 0x0
invoke-virtual {p0, v0}, Landroidx/compose/ui/text/TextLayoutResult;->getLineTop(I)F
move-result v2
sub-float/2addr v1, v2
const/4 v0, 0x0
cmpg-float v0, v1, v0
if-lez v0, :default_em
const v0, 0x3f4ccccd # 0.8f
mul-float/2addr v0, v1
return v0
:default_em
const/high16 v0, 0x42200000 # 40.0f
return v0
.end method
# virtual methods
.method public invoke(Ljava/lang/Object;)Ljava/lang/Object;
.locals 4
iget v0, p0, Lradiant/SylLayout;->idx:I
if-ltz v0, :ret
instance-of v1, p1, Landroidx/compose/ui/text/TextLayoutResult;
if-eqz v1, :ret
sget-object v1, Lradiant/SylLayout;->layouts:[Landroidx/compose/ui/text/TextLayoutResult;
if-eqz v1, :grow
array-length v2, v1
if-gt v2, v0, :store
:grow
add-int/lit8 v2, v0, 0x1
const/16 v3, 0x40
if-ge v2, v3, :cap_ok
const/16 v2, 0x40
:cap_ok
if-nez v1, :copy
new-array v1, v2, [Landroidx/compose/ui/text/TextLayoutResult;
goto :store
:copy
invoke-static {v1, v2}, Ljava/util/Arrays;->copyOf([Ljava/lang/Object;I)[Ljava/lang/Object;
move-result-object v1
check-cast v1, [Landroidx/compose/ui/text/TextLayoutResult;
:store
sput-object v1, Lradiant/SylLayout;->layouts:[Landroidx/compose/ui/text/TextLayoutResult;
check-cast p1, Landroidx/compose/ui/text/TextLayoutResult;
aput-object p1, v1, v0
:ret
sget-object v0, Lkotlin/u;->a:Lkotlin/u;
return-object v0
.end method
File diff suppressed because it is too large Load Diff
+80
View File
@@ -0,0 +1,80 @@
--- a/com/tidal/android/feature/playerscreen/ui/composables/f2.smali
+++ b/com/tidal/android/feature/playerscreen/ui/composables/f2.smali
@@ -932,7 +932,7 @@
# virtual methods
.method public final invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
- .locals 28
+ .locals 40
.line 1
move-object/from16 v0, p0
@@ -1158,6 +1158,8 @@
.line 100
check-cast v1, Lcom/tidal/android/feature/playerscreen/ui/f;
+ move/16 v33, v2 # lazy item index
+
.line 101
.line 102
const v3, 0x6b82e849
@@ -1646,6 +1648,26 @@
.line 331
iget-object v3, v1, Lcom/tidal/android/feature/playerscreen/ui/f;->a:Ljava/lang/String;
+ iget v4, v0, Lcom/tidal/android/feature/playerscreen/ui/composables/f2;->b:I
+
+ move/16 v34, v4 # TIDALs active line
+
+ iget-object v4, v1, Lcom/tidal/android/feature/playerscreen/ui/f;->a:Ljava/lang/String;
+
+ move-object/16 v35, v4 # plain line text
+
+ iget-wide v4, v0, Lcom/tidal/android/feature/playerscreen/ui/composables/f2;->d:J
+
+ move-wide/16 v36, v4 # sung colour
+
+ iget-wide v4, v0, Lcom/tidal/android/feature/playerscreen/ui/composables/f2;->e:J
+
+ move-wide/16 v38, v4 # unsung colour
+
+ invoke-static/range {v33 .. v39}, Lradiant/WordLyrics;->renderSyl(IILjava/lang/String;JJ)Landroidx/compose/ui/text/AnnotatedString;
+
+ move-result-object v3 # syllable-wiped line
+
.line 332
.line 333
invoke-interface {v2}, Landroidx/compose/runtime/State;->getValue()Ljava/lang/Object;
@@ -1672,7 +1694,7 @@
.line 344
.line 345
- const v27, 0xfff8
+ const v27, 0x7ff8 # $default: pass onTextLayout
.line 346
.line 347
@@ -1727,7 +1749,13 @@
.line 369
.line 370
- const/16 v22, 0x0
+ move/from16 v1, v33 # line index
+
+ invoke-static {v1}, Lradiant/SylLayout;->cb(I)Lam0/l; # per-line layout capture
+
+ move-result-object v1
+
+ move-object/from16 v22, v1 # onTextLayout
.line 371
.line 372
@@ -1743,7 +1771,7 @@
.line 377
.line 378
- invoke-static/range {v3 .. v27}, Landroidx/compose/material3/TextKt;->Text--4IGK_g(Ljava/lang/String;Landroidx/compose/ui/Modifier;JJLandroidx/compose/ui/text/font/FontStyle;Landroidx/compose/ui/text/font/FontWeight;Landroidx/compose/ui/text/font/FontFamily;JLandroidx/compose/ui/text/style/TextDecoration;Landroidx/compose/ui/text/style/TextAlign;JIZIILam0/l;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/runtime/Composer;III)V
+ invoke-static/range {v3 .. v27}, Landroidx/compose/material3/TextKt;->Text--4IGK_g(Landroidx/compose/ui/text/AnnotatedString;Landroidx/compose/ui/Modifier;JJLandroidx/compose/ui/text/font/FontStyle;Landroidx/compose/ui/text/font/FontWeight;Landroidx/compose/ui/text/font/FontFamily;JLandroidx/compose/ui/text/style/TextDecoration;Landroidx/compose/ui/text/style/TextAlign;JIZILjava/util/Map;Lam0/l;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/runtime/Composer;III)V
.line 379
.line 380
+54 -1
View File
@@ -36,7 +36,7 @@
"lyrics-rl-api-isrc.patch"
],
"title": "Radiant Lyrics API - WIP",
"description": "Use Radiant Lyrics API to fetch Lyrics (Higher quality & More providers). Pick how the highlight moves: whole Line or word-by-word (Word).",
"description": "Use Radiant Lyrics API to fetch Lyrics (Syllable Level & Higher Quality)",
"default": false,
"defaultVariantIndex": 0,
"variants": [
@@ -49,6 +49,59 @@
"fileNames": [
"lyrics-rl-api-word.patch"
]
},
{
"title": "Syllable",
"fileNames": [
"lyrics-rl-api-syllable.patch"
]
}
],
"extensionFiles": [
"radiant/RLAPILyricsHook.smali",
"radiant/RLAPILyricsWorker.smali",
"radiant/IsrcCache.smali",
"radiant/WordLyrics.smali",
"radiant/WordLyricsTick.smali",
"radiant/SylBrush.smali",
"radiant/SylLayout.smali"
],
"advancedOptions": [
{
"type": "toggle",
"key": "romanize",
"title": "Romanization",
"description": "Return a romanized transcription and show that instead of the original script",
"default": false,
"token": "RL_ROMANIZE",
"inline": true
},
{
"type": "toggle",
"key": "context_aware",
"title": "Context Aware Lyrics",
"description": "Return a romanized transcription and show that instead of the original script",
"default": true,
"token": "RL_CTX_ON"
},
{
"type": "choice",
"key": "context_aware_mode",
"title": "Show",
"description": "",
"entries": [
"Adlibs",
"Singers",
"Both"
],
"values": [
"0x1",
"0x2",
"0x3"
],
"defaultIndex": 0,
"requiresOption": "context_aware",
"token": "RL_CTX"
}
]
},