aadsm / jsmediatags

Media Tags Reader (ID3, MP4, FLAC)
Other
738 stars 128 forks source link

Adds support for ID3 synchronized lyrics (SYLT) #184

Closed probityrules closed 1 week ago

probityrules commented 2 weeks ago

This PR adds a handler for SYLT data, creating a data structure like this for each SYLT tag:

{
    language: "ENG",
    timeStampFormat: "milliseconds",
    contentType: "transcription",
    descriptor: "",
    synchronisedText: [{
        text: "Hi",
        timeStamp: 0
    }, {
        text: " there!",
        timeStamp: 100
    }]
}

This is based on the spec here https://id3.org/id3v2.3.0#Synchronised_lyrics.2Ftext and (in addition to the included ID3v2FrameReader-test.js SYLT test) has been tested on MP3's with SYLT data composed by node-id3.

I created string mappings for timeStampFormat and contentType because I wasn't sure whether this library prefers something that's readable or the actual integers, but I'm happy to remove the strings and use integers instead for these if preferred.

aadsm commented 2 weeks ago

Oh wow, this is pretty cool! Thank you so much! I'll review it soon.