mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2003
Posts: 86
N
NRJ Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Mar 2003
Posts: 86
I always post it in the scripts board, but nobody could help me or can say, if it is my mistake or a bug.

Here is the posting:

https://forums.mirc.com/showflat.php?Cat=...amp;amp;fpart=1

The echo of $sound().length by MP3's is even wrong. Is it a bug?


Mathias

Joined: Nov 2003
Posts: 228
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Nov 2003
Posts: 228
Just out of curiosity, have you tried surrounding the filename in quotes (") or used $shortfn before trying to return the length. By the look of it, your method could just be trying to get the length from c:\program or c:\documents which would result in an error. Try this:

Code:
alias mlen {
  var %file = $shortfn($sfile(c:\*.mp3))
  echo -a $gmt($calc($sound(%file).length / 1000),n:ss)
}

Just type /mlen

Purhaps it won't make a difference but I've always used $shortfn when I've been working with long filenames, especially MP3s, and I've never had a problem returning information.

Joined: Sep 2003
Posts: 93
T
Babel fish
Offline
Babel fish
T
Joined: Sep 2003
Posts: 93
I wonder if you can be more precise with length by using the value: 1048576 instead of 1000 you had in your original entry...

//echo -s $time($calc($sound($findfile(D:\Energy\Currents\,*,1)).length / 1000),nn:ss)

Use this instead: //echo -s $time($calc($sound($findfile(D:\Energy\Currents\,*,1)).length / 1048576),nn:ss)

The code could use some cleanup as well - others probably have something shorter and more efficient but if you don't want to change the entire coding just use what I suggested.

Good luck!

Talea

Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
It's being divided by 1000 to convert milliseconds into seconds, dividing by 1048576 is to convert bytes into megabytes.


NRJ: Try this in Remotes:
Code:
alias filedur {
  var %i = $calc($sound($1).length / 1000)
  return $iif($int($calc(%i / 3600)),$ifmatch $+ :) $+ $gmt(%i,nn:ss)
}

Then just use $filedur(filename)

Also, if you're using $findfile() and you intend to do something with the filenames besides displaying them it's best to use the .shortfn property - that way mIRC can correctly handle filenames with consecutive spaces in them.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Sep 2003
Posts: 93
T
Babel fish
Offline
Babel fish
T
Joined: Sep 2003
Posts: 93
Oops... gotta learn to read...

Talea

Joined: Mar 2003
Posts: 86
N
NRJ Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Mar 2003
Posts: 86
Hi!

I already put you all codes into my mIRC and tested it, but the error is the same as before.
Here you can see it:

MP3-File is: D:\Energy\Currents\Alanis Morissette - Everything.mp3

Real File Length: 04:04


The I try it with all your codes:
(I put in the echo text from mIRC)

a) From Seifer (alias = /mlen) --> 5:06
b) From Talea (//echo ...) --> 00:00
c) From starbucks_mafia ($filedur(filename)) --> 05:06


You can see, the file length in mIRC is already wrong. But why???


Mathias

Joined: Sep 2003
Posts: 93
T
Babel fish
Offline
Babel fish
T
Joined: Sep 2003
Posts: 93
My post to you was incorrect... I didn't read it correctly (damn having a sprained ankle doesn't help much).

This is an alias I use to determine length of a mp3...

alias mlen {
if (!$1-) { return 1 | halt }
if (!$exists($1-)) { return 2 | halt }
var %x = $calc($sound($1-).length /1000)
return $gmt(%x,$iif(%x >= 3600,h:nn:ss,n:ss))
}

This will work not only for smaller mp3s but for those over 1 hour in playtime (YES I do have massive sized single mp3.

Maybe this will help in someway.

Talea

Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
I think it must be a bug in mIRC's length calculation then. Does the length get calculated correctly by other mp3 players (Media Player, Winamp, etc.)?
What bitrate is the mp3? Does it use a variable bitrate?


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Dec 2002
Posts: 155
S
Vogon poet
Offline
Vogon poet
S
Joined: Dec 2002
Posts: 155
mIRC's $insong.length doesn't work correctly on my system with variable bitrate songs, but $sound().length does, so I don't think this is a bug caused by variable bitrates. Btw, I reported this once, but somebody pointed out that it might be a Windows Media Player related bug. I never really did any further inverstigation, so I'm not sure.

Joined: Mar 2003
Posts: 86
N
NRJ Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Mar 2003
Posts: 86
It's a MP3 with a static bitrate (160k). All my MP3 Players show the real file length (04:04) and in mIRC 05:06.

I think, it's a bug...


Mathias

Joined: Dec 2002
Posts: 5,412
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,412
The issue with mp3s greater than 128 bitrates has been reported before. mIRC cannot play or process mp3s itself, it depends entirely on Windows Media Player, which itself depends on installed codecs, for playing mp3s and retrieving information such as song length. $sound() uses media player to retrieve information.

You might be able to use $mp3() to retrieve the correct information since that is independent of media player.

Joined: Mar 2003
Posts: 86
N
NRJ Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Mar 2003
Posts: 86
I don't understand.

When I use $mp3() instead of $sound, it's the same wrong song length?!

//echo -s $time($calc($mp3($findfile(D:\Energy\Currents\,*,1)).length / 1000),nn:ss)

= 05:06


What do you mean?


Mathias


Link Copied to Clipboard