Lyrics file parsing (a): parsing of the LRC format file

Source: Internet
Author: User

The LRC is an abbreviation for the English lyric (lyrics), and is used as an extension of the lyrics file. The text file with the LRC extension can be displayed synchronously in various digital players. The LRC lyrics are a text-only-based lyrics-only format that contains the "*:*" form of the tag.

1. identification label (ID-TAGS)

[ar: Artist name] [Ti: Song name] [Al: Album Name] [By: Editor (referring to the person who edited the LRC lyrics)] [Offset: Time compensation value] Its units are milliseconds, positive values indicate overall advance, negative values are reversed. This is for the overall adjustment display speed.

[TI: Hill]
[AR: Li Zongsheng]
[offset:0]

2. Time label (Time-tag)

[MM:SS:FFF] Specific lyrics content

[00:19.59] But there's not much to say yet.
[00:28.97] Save because you want to write a song
[00:33.91] Let a person gently sing and lightly remember

 Public ClassLyricclassStructureLyricstructre'Lyrics Structure Type        DimCount as Integer        DimLyrictime asList ( of Integer)'time series for each line of lyrics        DimLyricstring asList ( of String)'string sequence for each line of lyrics    End Structure    StructureInformationstructre'lyrics Information Structure type        DimAuthor as String 'author name [AR]        DimTitle as String 'song name [Ti]        DimAlbum as String 'album name [al]        DimEditor as String 'Editor [by]        DimOffset as Integer 'time compensation value [offset]    End Structure     PublicLyricdata as NewLyricstructre with{. Lyrictime =NewList ( of Integer), . Lyricstring =NewList ( of String)}     PublicLyricinf as NewInformationstructre PublicIsloadfail as Boolean=False 'whether the load failed     Public Sub New(ByValFileName as String) loadlyrics (FileName)End Sub     Public SubLoadlyrics (ByValFileName as String)        Dim Str  as StringLyricdata.count=0LyricData.LyricTime.Clear () LyricData.LyricString.Clear ( )IfMy.Computer.FileSystem.FileExists (FileName) =True  Then            Str=My.Computer.FileSystem.ReadAllText (FileName, System.Text.Encoding.Default)DimTempString as String             for  eachSubString as String inch Split(Str, vbCrLf) tempstring=Mid(SubString,2,2)                If IsNumeric(tempstring) =True  ThenLyricdata.count+=1LyricData.LyricTime.Add (Mid(SubString,2,2) * -* -+Mid(SubString,5,2) * -+Mid(SubString,8,2)) LyricData.LyricString.Add (Mid(SubString, Substring.indexof ("]") +2))                ElseIfTempString ="ar"  ThenLyricinf.author=Split(Split(SubString,":")(1),"]")(0)                ElseIfTempString ="ti"  ThenLyricinf.title=Split(Split(SubString,":")(1),"]")(0)                ElseIfTempString ="Al"  ThenLyricinf.album=Split(Split(SubString,":")(1),"]")(0)                ElseIfTempString =" by"  ThenLyricinf.editor=Split(Split(SubString,":")(1),"]")(0)                ElseIfTempString =" of"  ThenLyricinf.offset=Split(Split(SubString,":")(1),"]")(0)                End If            Next        ElseIsloadfail=True 'Load Failed        End If    End SubEnd Class

Lyrics file parsing (a): parsing of the LRC format file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.