Jump to content
Sign in to follow this  
Tomb

_SoundLength

Recommended Posts

Tomb

_SoundLength just isn't working for me. I did a search, and people recently had this problem, but i read it was fixed. I have the latest version of autoit, not the beta though ( i don't like using beta).

how can i make _SoundLength work?

it just fails.

like if i did this.

_SoundOpen(@DesktopDir & "\Music\1.mp3", $Current)
MsgBox(0, "", _SoundLength($Current, 2))

i also tried doing it this way.

_SoundOpen(@DesktopDir & "\Music\1.mp3", $Current)
$length = _SoundLength($Current, 2)
MsgBox(0, "", "length is " & $length)

but still fail. why is autoit being cruel to me?

yes i am including the Sound.au3

#include <Sound.au3>

and the song path is correct.

and i can play the song with _SoundPlay. just can't get the length.

Edited by Tomb616

Share this post


Link to post
Share on other sites
panlatv

Hello i have the same problem

exemple (_SoundLength no work, but _SoundPos work fine).

#include <Sound.au3>
$sound=_SoundOpen ("C:\fix.wav")
$vor=_SoundLength ($sound, 2)
MsgBox (0,"Time",$vor)

I have the last autoit (Nov 25 2007 09:22:42).

ps: where is the "attached version" here? http://www.autoitscript.com/forum/index.ph...mp;#entry440847

sorry for my bad english

edit: the solution

dowload the beta autoit-v3.2.11.5-sfx.exe, but not install, just extract, move the sound.au3 in the Include directory of the stable autoit. (C:\Program Files\AutoIt3\Include\ by default ) (make a backup of the orginal)

Now all work fine, good job.

http://www.autoitscript.com/autoit3/files/beta/autoit/

Edited by panlatv

Share this post


Link to post
Share on other sites
Tomb

Hello i have the same problem

exemple (_SoundLength no work, but _SoundPos work fine).

#include <Sound.au3>
$sound=_SoundOpen ("C:\fix.wav")
$vor=_SoundLength ($sound, 2)
MsgBox (0,"Time",$vor)

I have the last autoit (Nov 25 2007 09:22:42).

ps: where is the "attached version" here? http://www.autoitscript.com/forum/index.ph...mp;#entry440847

sorry for my bad english

edit: the solution

dowload the beta autoit-v3.2.11.5-sfx.exe, but not install, just extract, move the sound.au3 of the Include directory of the stable autoit. (C:\Program Files\AutoIt3\Include\ by default ) (make a backup of the orginal)

Now all work fine, good job.

http://www.autoitscript.com/autoit3/files/beta/autoit/

Nice work.

can you attach the Sound.au3 for me?

:D

Share this post


Link to post
Share on other sites
Tomb

Yes i can :D

it is still returning nothing as length after placing it in includes folder.

:D

Share this post


Link to post
Share on other sites
panlatv

it is still returning nothing as length after placing it in includes folder.

:D

Sorry, but are you certain that autoit can play mp3? :D

For me , it can't . Only wav file.

Share this post


Link to post
Share on other sites
Squirrely1

Here is a way to get the duration of the .mp3 -

$SoundFile = "1.mp3"
$folder = @DesktopDir & "\Music"

;Based on gaFrost's FileExtProperties - kudos to simucal
$objShell = ObjCreate("Shell.Application")
$objFolder = $objShell.Namespace ($folder)
For $strFileName In $objFolder.Items
    If $objFolder.GetDetailsOf ($strFileName, 0) = $SoundFile Then
        $duration = $objFolder.GetDetailsOf ($strFileName, 21)
        ExitLoop
    EndIf
Next
MsgBox(0, "MP3 Duration", $duration)

It is strongly recommended that you do not store folders or files other than shortcuts on the desktop - its a memory hog.

Edited by Squirrely1

Das Häschen benutzt Radar

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.