pub struct AlignedLyrics {
pub words: Vec<AlignedWord>,
pub lines: Vec<AlignedLine>,
}Expand description
A clip’s aligned lyrics: the flat word list and the line list.
Both are empty for an instrumental or an un-alignable clip; see
is_empty.
Fields§
§words: Vec<AlignedWord>§lines: Vec<AlignedLine>Implementations§
Source§impl AlignedLyrics
impl AlignedLyrics
Sourcepub fn from_json(raw: &Value) -> AlignedLyrics
pub fn from_json(raw: &Value) -> AlignedLyrics
Map the aligned_lyrics/v2 response body, tolerating missing keys.
A non-object body, or one whose arrays are missing, maps to the empty value, so a malformed or instrumental response is simply “no synced lyrics” rather than an error.
Sourcepub fn from_bytes(body: &[u8]) -> AlignedLyrics
pub fn from_bytes(body: &[u8]) -> AlignedLyrics
Parse the aligned_lyrics/v2 response bytes, or the empty value when the
body is not valid JSON (defensive: an odd body means “no synced lyrics”).
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
True when the clip carries no aligned lyrics (an instrumental, or a clip Suno could not align). No synced artefact is written for such a clip.
Sourcepub fn plain_text(&self) -> String
pub fn plain_text(&self) -> String
The plain lyric text, one line per aligned line (falling back to the flat
word list when there are no lines), for the unsynced LYRICS/USLT tag.
Returns an empty string when there is nothing to embed.
Sourcepub fn lrc_body(&self) -> String
pub fn lrc_body(&self) -> String
The body of a standard (line-level) .lrc: one [mm:ss.xx] stamp per
aligned line, followed by the line text.
Line-level is the universally supported LRC form, so every player syncs
and displays it cleanly; the enhanced “A2” per-word <mm:ss.xx> tags are
parsed by only a few karaoke players and are shown as literal text by the
rest, so they are not emitted here. Word-level timing is carried instead
in the MP3 SYLT frame (see sylt_entries). A line
with empty text falls back to its nested words joined by spaces. The body
is empty when there are no lines; callers treat that as “no .lrc”.
Sourcepub fn sylt_entries(&self) -> Vec<(u32, String)>
pub fn sylt_entries(&self) -> Vec<(u32, String)>
Word-level SYLT content: (offset_ms, text) pairs in time order.
Each new line’s first word carries a leading newline so a player renders
line breaks (the ID3v2 SYLT convention). Uses Suno’s own line grouping;
a line with no nested words contributes its whole text as one segment.
Trait Implementations§
Source§impl Clone for AlignedLyrics
impl Clone for AlignedLyrics
Source§fn clone(&self) -> AlignedLyrics
fn clone(&self) -> AlignedLyrics
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AlignedLyrics
impl Debug for AlignedLyrics
Source§impl Default for AlignedLyrics
impl Default for AlignedLyrics
Source§fn default() -> AlignedLyrics
fn default() -> AlignedLyrics
Source§impl PartialEq for AlignedLyrics
impl PartialEq for AlignedLyrics
Source§fn eq(&self, other: &AlignedLyrics) -> bool
fn eq(&self, other: &AlignedLyrics) -> bool
self and other values to be equal, and is used by ==.