Bert Posted September 26, 2007 Share Posted September 26, 2007 (edited) Audio.au3 is designed for XP. I do not plan to offer support for Vista for I do not own a Vista PC. The only workaround I know of is to run your app in XP mode if using Vista. At this time I also do not plan to offer support for Windows 7. If someone wishes to help out with that, that would be great! -----------------------------------------------------------------------------This expands on sound.au3, and can be used as a replacement. I combinds mixer.au3 and sound.au3, along with functions to make using mixer.au3 easier. With audio.au3, you can control the same thing as sound.au3, but with extra commands:_SoundSetMasterVolume($iVolume) - Sets the Master Volume. Does not control an application's volume_SoundGetMasterVolume - Gets the Master Volume level_SoundSetMicrophoneVolume - Sets the Microphone input volume_SoundGetMicrophoneVolume - Gets the Microphone volume level_SoundGetPhoneVolume - Gets the Phone volume on the modem_SoundSetVolumeCD - Sets the Volume level on the CDRom_SoundSetMasterWaveVolume - Sets the Master Wave Volume levelEnjoy!Edit: added the code as a attachment due to cut and paste issues with the forum.Edit2: If you want info on items for MP3, Mega came up with this: http://www.autoitscript.com/forum/index.ph...mp;#entry410387I may add it to Audio.au3 later seeing how it has to do with audio files. Edit: _Ismute added. Thanks XenobiologistPrevious version # of downloads - 605audio.au3Edit: asbeer450 came up with this as a different way to handle audio controls. His method also works well, but has the same limitations as mine. Feel free to use both to see what works good for you.SoundGetSetQuery.au3SoundExample.au3 - Examples for SoundGetSetQuery.au3 Edited January 4, 2010 by Volly The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
james3mg Posted September 26, 2007 Share Posted September 26, 2007 (edited) Nice job, thanks! Do you have a definitive list of the types of files that can be _SoundOpen() 'ed? .wav and .mp3 I assume, but what about .m4a, .wma and the like? I'm going to give a .m4a file a try now, but it'd be nice if you noted in the _SoundOpen() function which files are available, since I don't even know all the different versions of audio files out there... Thanks again for the great work! Edit: for anyone's information, IF the modifications I listed in the below post are correct, .m4a files don't appear to play, but also don't return an error anywhere. Edited September 26, 2007 by james3mg "There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110 Link to comment Share on other sites More sharing options...
james3mg Posted September 26, 2007 Share Posted September 26, 2007 (edited) I copied and pasted your code into Audio.au3 on my desktop, then #included it in a test script, and I got this:{my user profile}\Desktop\audio.au3(687,64) : ERROR: _SetVolume() already defined.Func _SetVolume(ByRef $mixers, ByRef $curmixer, ByRef $percent)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^{my user profile}\Desktop\audio.au3(794,40) : ERROR: syntax error (illegal character) Local $mixerline = DllStructCreate("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^{my user profile}\Desktop\audio.au3(800,5) : ERROR: syntax error EndIf~~~~^{my user profile}\Desktop\audio.au3(659,26) : ERROR: OpenAllMixers(): undefined function. OpenAllMixers($mixers)~~~~~~~~~~~~~~~~~~~~~~~~~^{my user profile}\Desktop\audio.au3(661,109) : ERROR: MixerOpen(): undefined function. $hmxobj = MixerOpen($curmixer, 0, $MM_MIXM_CONTROL_CHANGE, BitOR($CALLBACK_WINDOW, $MIXER_OBJECTF_MIXER))~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^{my user profile}\Desktop\audio.au3(664,23) : ERROR: MixerClose(): undefined function. MixerClose($hmxobj)~~~~~~~~~~~~~~~~~~~~~~^{my user profile}\Desktop\audio.au3(665,27) : ERROR: CloseAllMixers(): undefined function. CloseAllMixers($mixers)~~~~~~~~~~~~~~~~~~~~~~~~~~^{my user profile}\Desktop\audio.au3 - 7 error(s), 0 warning(s)Same thing happens if I just try to run audio.au3...AFAIK, running a typical UDF #include file should just run w/o errors and close, apparently without doing anything because it just defines functions, right?I'm running AutoIt 3.2.8.1 Production version.Edit: I'm looking at the file, and I see _SetVolume() being defined on line 646 AND again on 687...the only obvious difference (I didn't examine it with a microscope) is the addition of a comment in the second definition. I deleted the first definition in my file, and that first error went away.Line 787 is unterminated...if I add a ") at the end of the line, the rest of the errors go away and the UDF seems to run OK, but I don't know if the comments on the following lines should be added to the end, or if it should just stop there. I don't know how to test to see if it works correctly now, so I'll leave it to you to finish fixing now. :-) Edited September 26, 2007 by james3mg "There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110 Link to comment Share on other sites More sharing options...
Bert Posted September 26, 2007 Author Share Posted September 26, 2007 Fixed. try it again The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Nahuel Posted September 26, 2007 Share Posted September 26, 2007 I get this: : ==> Unterminated string.: Local $mixerline = DllStructCreate("dword;dword;dword;dword;dword;dword;dword;dword;dword;dword;char[16];char[64];dword;dword;short Line 786. The _SoundSetMasterVolume() function works perfectly I'll try the other ones. Link to comment Share on other sites More sharing options...
Bert Posted September 26, 2007 Author Share Posted September 26, 2007 I see the problem. When I cut and paste the code in, it is putting a return on 786 and putting the rest of the line on 788. Let me try to fix that again. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bert Posted September 26, 2007 Author Share Posted September 26, 2007 Ok, I think I got it. If it doesn't work, I will just upload the file directly so it works right. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
james3mg Posted September 26, 2007 Share Posted September 26, 2007 _SoundPlay() isn't working now, though it was when I made the two changes I mentioned before to your original post. I've tried both .mp3 files and .wav files, and neither play, nor do they return an error. "There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110 Link to comment Share on other sites More sharing options...
Bert Posted September 26, 2007 Author Share Posted September 26, 2007 what happens when you use sound.au3 instead? I took Sound.au3 and combined it with mixer.au3. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bert Posted September 26, 2007 Author Share Posted September 26, 2007 I'm going to add the script as it is from my PC as a attachment. try that and see if that works. If so, it must be the way the forum is behaving when you cut and paste the code. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bert Posted September 26, 2007 Author Share Posted September 26, 2007 Nice job, thanks! Do you have a definitive list of the types of files that can be _SoundOpen() 'ed? .wav and .mp3 I assume, but what about .m4a, .wma and the like? I'm going to give a .m4a file a try now, but it'd be nice if you noted in the _SoundOpen() function which files are available, since I don't even know all the different versions of audio files out there...Thanks again for the great work!Edit: for anyone's information, IF the modifications I listed in the below post are correct, .m4a files don't appear to play, but also don't return an error anywhere.Try testing with sound.au3 and report back. If it doesn't work, we can look to see what needs to be done to make it work. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
james3mg Posted September 26, 2007 Share Posted September 26, 2007 (edited) It doesn't work with sound.au3 either. -I just tried adding a sleep(1000) call after _SoundPlay("TheSound",1), and now it plays! Seems that the 1 telling it to wait until it's done playing isn't working in either sound or audio.au3. Maybe it's another vista thing (I'm using business). Odd it was working earlier before your latest edits! As to your latest post, I've tried with audio and sound.au3, and .m4a files don't play, nor do they return an error. I don't know about .wma files, or other types I'm unfamiliar with. It'd be nice if these functions could support them - I'm trying to write a podcast-feed creator script, and I'd like to be able to look up how long a .m4a file is. Thanks for all your work again! Edited September 27, 2007 by james3mg "There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110 Link to comment Share on other sites More sharing options...
Bert Posted September 26, 2007 Author Share Posted September 26, 2007 long day for me. Try it again. I think it is right this time. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
smashly Posted September 27, 2007 Share Posted September 27, 2007 As to your latest post, I've tried with audio and sound.au3, and .m4a files don't play, nor do they return an error. I don't know about .wma files, or other types I'm unfamiliar with. It'd be nice if these functions could support them - I'm trying to write a podcast-feed creator script, and I'd like to be able to look up how long a .m4a file is. Thanks for all your work again!To make any audio file work (providing your pc can play the audio file normally in any other player), then try associating the file ext with the mci device. In other words a small regedit can make it so any file will play... [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\MCI Extensions] "m4a"="mpegvideo" Yes associate most file ext in the same manner to the mpegvideo mci device.. Even avi, mp4, wmv, wma, ogg.. etc Tip: Install current FFDshow filters, and associate any file ext you want with "mpegvideo" as in the example above. Then you'll find nearly any file format will play with the _SoundOpen & _SoundPlay functions Cheers Link to comment Share on other sites More sharing options...
james3mg Posted September 27, 2007 Share Posted September 27, 2007 @Volly - Brilliant, _SoundPlay() seems to work perfectly now, and audio.au3 doesn't have any errors! @smashley - I've never poked around in the MCI Extensions part of the registry before, but I did what I think you're saying...I opened up HKLM\Software\Microsoft\Windows NT\CurrentVersion\MCIExtensions, and since m4a wasn't listed in there, I created a new String Value, named it m4a and gave it a value of MPEGVideo to match most of the other values in that key. I didn't installFFDshow filters (as I don't even know what it/they is/are), but I think I understand you that what I've done is all I'd need to do, correct? Unfortunately, it didn't work. If I choose to play an m4a file, it immediately returns with no error and without playing it. If I stick a Sleep(50000) in after the call to play, I just get 50 seconds of silence. Any other ideas? @anyone interested: So it looks like the sound.au3 and audio.au3 (and maybe mixer.au3 ?) only works with .wav and .mp3 files...are there any others that you know of? Again, it'd be nice if anyone had a definitive list "There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110 Link to comment Share on other sites More sharing options...
RazerM Posted September 27, 2007 Share Posted September 27, 2007 @james3mg The _Sound functions were created by me and are included with AutoIt, if you find any problems try the sound.au3 from autoit's include folder. My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
Bert Posted September 27, 2007 Author Share Posted September 27, 2007 Audio.au3 has the entire sound.au3 embedded without any code changes to it. It is perfect the way RazerM coded it. I just wanted to expand on it so more functions were available. My hat goes off for RazerM for the work he as done. Nice job! The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
james3mg Posted September 27, 2007 Share Posted September 27, 2007 @james3mgThe _Sound functions were created by me and are included with AutoIt, if you find any problems try the sound.au3 from autoit's include folder.I realize that, but I can't find a list of what audio filetypes the _Sound functions work with! That's the list I'm trying to compile.Thanks "There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110 Link to comment Share on other sites More sharing options...
Bert Posted September 27, 2007 Author Share Posted September 27, 2007 you will have to test it to see what works and what doesn't. Report back what you find, and mayby others will do the same. Currently I'm busy as a beaver, so I won't be much help. I may have time next week to see what works. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
therks Posted September 30, 2007 Share Posted September 30, 2007 Haha, it works with wmv files! Check this out: #include <Sound.au3> $file = 'C:\WINDOWS\system32\oobe\images\intro.wmv' ;open sound file $sound = _SoundOpen($file) 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 EndIf _SoundPlay($sound) Sleep(_SoundLength($sound, 2)) _SoundClose($sound) It also played an mpg, but _SoundLength didn't return the right time. It told me that a 2 minute video was 4 seconds. I also tried .avi, and it wouldn't play at all, the window that appears is just glitched out (visually), and the _SoundLength for that was way off as well. But wmv seems to work fine! My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now