Jump to content

.mp3 Sound = Error


 Share

Recommended Posts

Running something as simple as this is causing errors on both Vista 64bit and 7 64bit when running the latest beta or just version 3.3.0.0. I end up viewing a message about driver errors.

Is this something anybody else is seeing, or if this is just my computer?

Oddly, with just version 3.3.0.0 it says it opens but it doesn't play.. And the sound length function just returns 0.

Limiter had a post about this same issue a year ago but he didn't find a solution.

Anybody have any ideas?

#include <Sound.au3>

;open sound file : must be modified if run under Vista
$sound = _SoundOpen('N:\Music\ABBA\Greatest Hits\Dancing Queen .mp3')
If @error = 2 Then
    MsgBox(0, "Error", "The file does not exist")
    Exit
ElseIf @extended <> 0 Then
    $extended = @extended ;assign because @extended will be set after DllCall
    $stText = DllStructCreate("char[128]")
    $errorstring = DllCall("winmm.dll", "short", "mciGetErrorStringA", "str", $extended, "ptr", DllStructGetPtr($stText), "int", 128)
    MsgBox(0, "Error", "The open failed." & @CRLF & "Error Number: " & $extended & @CRLF & "Error Description: " & DllStructGetData($stText, 1) & @CRLF & "Please Note: The sound may still play correctly.")
Else
    MsgBox(0, "Success", "The file opened successfully" & @CRLF & _SoundLength($sound))
EndIf
_SoundPlay($sound, 1)

_SoundClose($sound)
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

Could someone at least see if sound functions are working with the latest beta with .mp3 files? I don't know if this is a windows 7 thing or just my computer. All you need to do is run this:

#include <Sound.au3>

;open sound file : must be modified if run under Vista
$file = FileOpenDialog('helllo.....', @MyDocumentsDir & "", "Media (*.mp3)", 1 + 4 )

$sound = _SoundOpen($file)
If @error = 2 Then
    MsgBox(0, "Error", "The file does not exist")
    Exit
ElseIf @extended <> 0 Then
    $extended = @extended ;assign because @extended will be set after DllCall
    $stText = DllStructCreate("char[128]")
    $errorstring = DllCall("winmm.dll", "short", "mciGetErrorStringA", "str", $extended, "ptr", DllStructGetPtr($stText), "int", 128)
    MsgBox(0, "Error", "The open failed." & @CRLF & "Error Number: " & $extended & @CRLF & "Error Description: " & DllStructGetData($stText, 1) & @CRLF & "Please Note: The sound may still play correctly.")
Else
    MsgBox(0, "Success", "The file opened successfully")
EndIf
_SoundPlay($sound, 0)
$splashtext = SplashTextOn("Current Position", _SoundPos($sound, 1), 300, 90, Default, Default, 18, Default, 55)
While 1
    Sleep(100)
    ControlSetText("Current Position", "", "Static1", _SoundPos($sound, 1))
    If _SoundPos($sound, 2) >= _SoundLength($sound, 2) Then ExitLoop
WEnd
_SoundClose($sound)
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

Could someone at least see if sound functions are working with the latest beta with .mp3 files? I don't know if this is a windows 7 thing or just my computer. All you need to do is run this:

#include <Sound.au3>

;open sound file : must be modified if run under Vista
$file = FileOpenDialog('helllo.....', @MyDocumentsDir & "", "Media (*.mp3)", 1 + 4 )

$sound = _SoundOpen($file)
If @error = 2 Then
    MsgBox(0, "Error", "The file does not exist")
    Exit
ElseIf @extended <> 0 Then
    $extended = @extended ;assign because @extended will be set after DllCall
    $stText = DllStructCreate("char[128]")
    $errorstring = DllCall("winmm.dll", "short", "mciGetErrorStringA", "str", $extended, "ptr", DllStructGetPtr($stText), "int", 128)
    MsgBox(0, "Error", "The open failed." & @CRLF & "Error Number: " & $extended & @CRLF & "Error Description: " & DllStructGetData($stText, 1) & @CRLF & "Please Note: The sound may still play correctly.")
Else
    MsgBox(0, "Success", "The file opened successfully")
EndIf
_SoundPlay($sound, 0)
$splashtext = SplashTextOn("Current Position", _SoundPos($sound, 1), 300, 90, Default, Default, 18, Default, 55)
While 1
    Sleep(100)
    ControlSetText("Current Position", "", "Static1", _SoundPos($sound, 1))
    If _SoundPos($sound, 2) >= _SoundLength($sound, 2) Then ExitLoop
WEnd
_SoundClose($sound)

That code works fine on my system with an mp3 from my itunes folder. I am also running windows 7 btw.
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Link to comment
Share on other sites

  • 3 months later...
  • Moderators

Hmmm,

As I write I am listening to music on my Autoit-coded player using Sound.au3 without a problem. It was last compiled with 3.3.4.0 and I am running Vista HP SP2.

The built-in SoundPlay command also works without problem.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Hmmm,

As I write I am listening to music on my Autoit-coded player using Sound.au3 without a problem. It was last compiled with 3.3.4.0 and I am running Vista HP SP2.

The built-in SoundPlay command also works without problem.

M23

Yea I noticed that with all the mp3 players (with the autoit fourms, things get posted 300 times) they called the _SoundPlay() function or the built-in one. Strange that some are able to get sound. It's not the sound, it won't play. The script kills it self, but it should wait till it's done.

EDIT: Hm.. Wave files play.. But not MP3s...

EDIT 2 : Even WMA files play for me..

#include <Sound.au3>
;open sound file
$sound = _SoundOpen(@WindowsDir & "\media\Windows XP Startup.wav", "Startup")
If @error = 2 Then
 MsgBox(0, "Error", "The file does not exist")
 Exit
ElseIf @error = 3 Then
 MsgBox(0, "Error", "The alias was invalid")
 Exit
ElseIf @extended <> 0 Then
 $extended = @extended ;assign because @extended will be set after DllCall
 $stText = DllStructCreate("char[128]")
 $errorstring = DllCall("winmm.dll", "short", "mciGetErrorStringA", "str", $extended, "ptr", DllStructGetPtr($stText), "int", 128)
 MsgBox(0, "Error", "The open failed." & @CRLF & "Error Number: " & $extended & @CRLF & "Error Description: " & DllStructGetData($stText, 1) & @CRLF & "Please Note: The sound may still play correctly.")
Else
 MsgBox(0, "Success", "The file opened successfully")
EndIf
_SoundPlay($sound, 1)

_SoundClose($sound)
Edited by sniper120
Link to comment
Share on other sites

  • Moderators

sniper120,

You will not be surprised to hear that your script works perfectly for me - once I give it a valid filename and adjust the syntax for 3.3.4.0.

I helped rewrite quite a lot of Sound.au3 for 3.3.4.0 (which is why the syntax is different :D ) - but all versions of it use the winmm.dll to play the sound files. What @error and @extended are you getting back from _SoundOpen in your script?

M23

Edit: tpying!

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

sniper120,

You will not be surprised to hear that your script works perfectly for me - once I give it a valid filename and adjust the syntax for 3.3.4.0.

I helped rewrite quite a lot of Sound.au3 for 3.3.4.0 (which is why the syntax is different :D ) - but all versions of it use the winmm.dll to play the sound files. What @error and @extended are you getting back from _SoundOpen in your script?

M23

Edit: tpying!

I just updated to the latest stable version am I'm going to try the sound play function again =)

Hm.. It works now =) I just have to fix my loop so it plays till it's done. I enabled the "wait" option but the script keeps going =(

EDIT: Scratch that, it's not pausing to play the song and I don't hear anything...

Update: For whatever reason, It plays .wma files correctly! I'll try another mp3 file.

While True
    Get_Stream_File()
    Read_Stream()
    ;ShellExecuteWait(@ScriptDir & "\play.mp3", "", "", "", @SW_HIDE)
    SoundPlay(@ScriptDir & "\play.mp3", 1) ; <-- Hm.. 1 is there
    ;Call("Play_Song")
    _RunDOS("cls")
WEnd
Edited by sniper120
Link to comment
Share on other sites

  • Moderators

All,

There is much confusion here.

I am happy to help with the Sound.au3 functions, i.e. all those with a leading underscore. Like everyone else apart from the Devs, I have no knowledge of the built-in SoundPlay function.

sniper120,

You appear to be using both SoundPlay and _SoundPlay in your posts. Are they both broken for you or does one work?

If you are using _SoundPlay, are you opening the file first with _SoundOpen? If so, are you getting an @error from _SoundOpen? And if you do, what is the value of @extended?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 7 months later...

Sorry to re open an old topic but i don't find any solution...

This morning i want to try Speaking Clock of XY16

But like sniper120, soundPlay or _soundPlay don't work for me.

wav file are played but not mp3 !

_soundPlay give me this

Posted Image

It's the same error than jamesBrook post.

I have no problem in my device manager and i have verified, i have well winmm.dll in system 32 folder.

Temporarily i replace by "ShellExecute ( @TempDir & "\" & $file & ".mp3", "", "", "", @SW_HIDE )"

It works, but defaut player stay open after playing...

If someone have an idea...Posted Image

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

  • Moderators

wakillon,

There are no mp3 files in the speaking clock package - what mp3 files are you trying to play?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

wakillon,

Works fine for me - using the built-in SoundPlay and modifying the script to use Sound.au3.

There was a problem with Sound.au3 and sound files in the Windows\Media folder. I raised Ticket #1707 and advertised it here, but that seems to have nothing to do with this case.

Sorry I cannot help any more.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

wakillon,

Continuing from the Sound.au3 topic: ;)

That dialog is not generated by Sound.au3 - that is Windows telling you a driver for something external to the OS has shut down. But the MCI dll is internal. :)

Please try opening the recalcitrant mp3 file with _SoundOpen and let me know what @error and @extended vales you get - that will help us see if it is problem with opening the file or whether you have another problem elsewhere in your system. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...