mIRC Home    About    Download    Register    News    Help

Print Thread
mp3 length #25792 24/05/03 03:31 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
does anyone know how to get the length of an mp3 in time figures,
for example
3:22 being 3 minute 22 seconds.
i only know how to get it in mirc figures e.g 395823
any help gr8lty appreciated smile


new username: tidy_trax
Re: mp3 length #25793 24/05/03 03:42 PM
Joined: Dec 2002
Posts: 774
T
theRat Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 774
/help $duration


Code:
//if ( khaled isgod ) echo yes | else echo no
Re: mp3 length #25794 24/05/03 03:52 PM
Joined: May 2003
Posts: 730
S
ScatMan Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
$duration(N)
N is the number of seconds
if u get it from the $insong.length or $sound(file).length so u need to calculate it by /1000 to make it in seconds- $duration($calc(Number of milliseconds / 1000))


Last edited by ScatMan; 24/05/03 03:53 PM.
Re: mp3 length #25795 24/05/03 03:56 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
ok thanx smile


new username: tidy_trax
Re: mp3 length #25796 24/05/03 04:05 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
thats gr8 thanx but do you know how to convert it like 3:22
as well,
coz that converts to 3 mins 22 secs
but i needed both so thanx for that smile


new username: tidy_trax
Re: mp3 length #25797 24/05/03 04:12 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
sorry i didn't explain that well enuff,
i have 2 edit boxes connected together
what i want is for minutes to go in the left 1 and seconds to go in the right
but i dont want mins and secs in the boxes
i just want 3 22
any help gr8ly appreciated smile


new username: tidy_trax
Re: mp3 length #25798 24/05/03 04:22 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
better still cud anyone tell me y this is too few paramaters?
//echo -s $gettok($duration($calc($sound($did(mp3,1).seltext).length / 1000,1,32)))

im trying to get this,
5 mins 45 secs
i was hoping it would return 5 frown
any help gr8ly appreciated
(ignore my other post)


new username: tidy_trax
Re: mp3 length #25799 24/05/03 04:27 PM
Joined: Dec 2002
Posts: 774
T
theRat Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 774
$gettok($duration($calc($sound($did(mp3,1).seltext).length / 1000,1,32)))
$gettok($duration($calc($sound($did(mp3,1).seltext).length / 1000)),1,32)


Code:
//if ( khaled isgod ) echo yes | else echo no
Re: mp3 length #25800 24/05/03 05:21 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
thanx smile

now i got just 1 more question please

i dont blame you if you cant even be bothered to look thru this code lol frown

if (mins isin $gettok($duration($calc($!inmp3.pos / 1000))),2,115) { .timer 0 1 //echo -s $gettok($duration($calc($inmp3.pos / 1000)),2,115) : $replace($gettok($duration($calc($!inmp3.pos / 1000))),1,109),$gettok($duration($calc($!inmp3.pos / 1000)),1,109),0 $+ $gettok($duration($calc($!inmp3 / 1000)),1,109) }
elseif (mins !isin $gettok($duration($calc($inmp3.pos / 1000))),2,115) { .timer 0 1 //echo -s $replace($gettok($duration($calc($inmp3.pos / 1000))),1,109),$gettok($duration($calc($inmp3.pos / 1000)),1,109),0 $+ $gettok($duration($calc($inmp3.pos / 1000)),1,109) }

that is supposed to echo the position of the mp3 every second into status window but, its supposed to echo like 3:04 3:05 etc

thanx in ahead smile


new username: tidy_trax
Re: mp3 length #25801 24/05/03 05:46 PM
Joined: May 2003
Posts: 730
S
ScatMan Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
u can use $asctime(Number of seconds,nn:ss) - that will return it in MINS:SECONDS

Re: mp3 length #25802 24/05/03 05:46 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
blush thanx


new username: tidy_trax
Re: mp3 length #25803 24/05/03 05:54 PM
Joined: Dec 2002
Posts: 774
T
theRat Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 774
Code:
alias mp3.thing {
var %len = $calc($inmp3.pos / 1000) , %output , %mins = 0 , %secs = 0
%secs = $calc( %len % 60 )
if ( %len >= 60 ) %mins = $calc( ( %len - %secs ) / 60 )
echo -s %mins $+ : $+ $base(%secs,10,10,2)
}


/timermp3 0 1 mp3.thing

$base strips the decimals & adds the padding zero if %secs are 0-9

if you wan't your code to work you should add a lot of !'s there

EDIT: darn, scatman knew a better way =(

Last edited by theRat; 24/05/03 05:55 PM.

Code:
//if ( khaled isgod ) echo yes | else echo no
Re: mp3 length #25804 24/05/03 09:02 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
your way is better simply because $asctime is for day/year/time smile
thanx anyway you 2


new username: tidy_trax