forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Speaking of @mci...

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Sun Oct 03, 2010 3:11 am    Post subject: Speaking of @mci... Reply with quote

Umm... /embarrassed

How do I convert the milliseconds returned from the MCI to minutes and seconds?

Thanks,
~Garrett

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
bornsoft
Contributor
Contributor


Joined: 19 Feb 2009
Posts: 113
Location: Germany

PostPosted: Sun Oct 03, 2010 5:39 am    Post subject: Reply with quote

There may be a simpler way, but i came up with this:

Code:

option decimalsep,.

%x = 118551
%s = @fdiv(%x,82400)
%z = @fdiv(%s,1000)

info %x milliseconds = @datetime("nn:ss:z",%z)

exit



.
Back to top
View user's profile Send private message Visit poster's website
Hooligan
VDS Developer
VDS Developer


Joined: 28 Oct 2003
Posts: 480
Location: California

PostPosted: Sun Oct 03, 2010 3:12 pm    Post subject: Reply with quote

Correction:

%s = @fdiv(%x,86400)

Not

%s = @fdiv(%x,82400)

Hooligan

_________________
Hooligan

Why be normal?
Back to top
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Sun Oct 03, 2010 3:41 pm    Post subject: Reply with quote

I'm not sure what I'm doing wrong, but everything I've tried gives me incorrect time. With a 2:47 mp3 file I get the minutes fine, but seconds are wrong. With a 7:58 file I get like 13 minutes and the seconds are wrong. I've tried 3 different routines so far, 1 being mine, 1 from old SADE example and now Bornsoft's idea.

Ok, I see now that Hooligan also replied and I added his correction. It works correctly on the 2:47 file but like the previous attempts goes astray on the 7:58 file, it gives the result of 13:17 instead.

Any ideas why on longer file times it goes whack?

Thanks a bunch,
~Garrett

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Sun Oct 03, 2010 8:48 pm    Post subject: Reply with quote

Ok, this is really boggling my mind. 1000 milliseconds equals 1 second. So if I divide the total amount of milliseconds the mci is returning by 1000, I should end up with the total amount of seconds of the audio file. Then if I want total minutes I should be able to divide that by 60. But my logic doesn't seem to match up with the logic needed to gain correct numbers with the mci. Sad
_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
bornsoft
Contributor
Contributor


Joined: 19 Feb 2009
Posts: 113
Location: Germany

PostPosted: Mon Oct 04, 2010 9:42 am    Post subject: Reply with quote

Thanks Hooligan for the correction, I should do more menthal arithmetic.

@Garrett: The "z" option for @datetime works only with VDS6. if you omit this, you should get correct minutes and rounded seconds.

If that doesn't give the correct time, there seems to be something wrong with the value you get from MCI or informations within the file itself are incorrect. Try it with a WAV file instead of MP3.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group