Decimal position using "Beats per minute" in taglib-sharp

158 Views Asked by At

i'm using taglib-sharp to read BPM tag in a mp3 music folder. The code is like this:

Dim f As TagLib.File = TagLib.File.Create(File)
Dim bpm As String = f.Tag.BeatsPerMinute 

The files BPM tag contains decimal numbers but the code returns an integer.

What can i do to solve?

1

There are 1 best solutions below

4
Mary On

I really don't think a value of 190.00 would be possible for an UInteger. It would have to be a whole number. If the number is consistently 100 times higher then just divide by 100.

Private Sub Test()
    Dim i = 19000UI / 100
    Dim bpm = i.ToString("N2")
    Debug.Print(bpm)
End Sub

Private Sub OPCode()
    Dim f As TagLib.File = TagLib.File.Create(File)
    Dim bpm As String = f.Tag.BeatsPerMinute / 100.ToString("N2")
End Sub