mIRC Homepage
Posted By: pheonix mp3 length - 24/05/03 03:31 PM
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
Posted By: theRat Re: mp3 length - 24/05/03 03:42 PM
/help $duration
Posted By: ScatMan Re: mp3 length - 24/05/03 03:52 PM
$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))

Posted By: pheonix Re: mp3 length - 24/05/03 03:56 PM
ok thanx smile
Posted By: pheonix Re: mp3 length - 24/05/03 04:05 PM
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
Posted By: pheonix Re: mp3 length - 24/05/03 04:12 PM
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
Posted By: pheonix Re: mp3 length - 24/05/03 04:22 PM
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)
Posted By: theRat Re: mp3 length - 24/05/03 04:27 PM
$gettok($duration($calc($sound($did(mp3,1).seltext).length / 1000,1,32)))
$gettok($duration($calc($sound($did(mp3,1).seltext).length / 1000)),1,32)
Posted By: pheonix Re: mp3 length - 24/05/03 05:21 PM
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
Posted By: ScatMan Re: mp3 length - 24/05/03 05:46 PM
u can use $asctime(Number of seconds,nn:ss) - that will return it in MINS:SECONDS
Posted By: pheonix Re: mp3 length - 24/05/03 05:46 PM
blush thanx
Posted By: theRat Re: mp3 length - 24/05/03 05:54 PM
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 =(
Posted By: pheonix Re: mp3 length - 24/05/03 09:02 PM
your way is better simply because $asctime is for day/year/time smile
thanx anyway you 2
© mIRC Discussion Forums