Song Length conversion

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

Lowlander
Posts: 56589
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Song Length conversion

Post by Lowlander »

I need to get from the DB value to a percentage of 24 hours. What units is the time in the DB in?
Octopod
Posts: 463
Joined: Tue Jun 10, 2003 9:09 am

Post by Octopod »

From what i experienced, SongLength is the length of the track expressed in milliseconds.
Lowlander
Posts: 56589
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Post by Lowlander »

You're right, thanks.
Lowlander
Posts: 56589
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Post by Lowlander »

For ASP the time conversion would be like this:

CDate(RS("SongLength")/1000/60/60/24).

This still wouldn't give you only minute and second displayed, but gets the values. And here is the problem.

This version gives often a second more as value than MM itself does. So the question is how is this value rounded in MM?
Octopod
Posts: 463
Joined: Tue Jun 10, 2003 9:09 am

Post by Octopod »

Right, i observed the same problem.
Convert the total length in seconds, rounded to the integer part.

Here is what i use in VBS:

Code: Select all

  ' Get total length in seconds
  tmp = Int(totL / 1000)
  ' In days
  dd  = Int(tmp / 86400)
  ' Remaining seconds
  tmp = tmp Mod 86400
  ' In hours
  hh  = Int(tmp / 3600)
  ' Remaining seconds
  tmp = tmp Mod 3600
  ' In minutes
  mm  = Int(tmp / 60)
  ' Final remaining seconds
  ss  = tmp Mod 60
So i think you could try:
CDate(Int(RS("SongLength")/1000)/60/60/24)
Lowlander
Posts: 56589
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Post by Lowlander »

Correct that worked. Thanks
Peke
Posts: 17486
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

Post by Peke »

It is cropped or cut of

Example if sng length is 15.567 Sec. MM wir see it as 15 Sec and with rounding it will be 16. Only thing you need is to ignore Milliseconds in displaying of length. MM do it Winamp do it , WMP do it Sound forge do it (if shown in hh:mm:ss Format)
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
Post Reply