sharpharp Posted July 27, 2011 Share Posted July 27, 2011 Hi all, I want to play a basic tune using the Internal PC Motherboard Speaker, not via the soundcard etc. I have played with the piano.au3 examples and they are great, but sound output is via the soundcard, is there anyway of using AutoIT to create a tune to play via the Internal speaker? Beep is very basic, but I couldn't figure out how to alter frequency etc, and I don't want to go down the method of dynawrap because you have to register dlls. Just need something I can wrap into an exe file to play on any PC to run a few sounds via internal speaker. Any help would be appreciated. Link to comment Share on other sites More sharing options...
hannes08 Posted July 27, 2011 Share Posted July 27, 2011 Hi sharpharp, from the helpfile: Beep -------------------------------------------------------------------------------- Plays back a beep to the user. Beep ( [ Frequency [, Duration ]] ) Parameters: Frequency [optional] The frequency of the beep in hertz. Can be anywhere from 37 through 32,767 (0x25 through 0x7FFF). Default is 500 Hz. Duration [optional] The length of the beep in milliseconds. Default = 1000 ms. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
jvanegmond Posted July 27, 2011 Share Posted July 27, 2011 (edited) Here's what I know. It doesn't answer your question but it might help. AutoIt Beep function just uses the WinAPI Beep function. Here is its documentation: http://msdn.microsoft.com/en-us/library/ms679277(v=vs.85).aspx , we can call this simple function directly like this: DllCall("Kernel32.dll", "bool", "Beep", "dword", 500, "dword", 1000) The remarks section says the following: A long time ago, all PC computers shared a common 8254 programable interval timer chip for the generation of primitive sounds. The Beep function was written specifically to emit a beep on that piece of hardware. On these older systems, muting and volume controls have no effect on Beep; you would still hear the tone. To silence the tone, you used the following commands: net stop beep sc config beep start= disabled Since then, sound cards have become standard equipment on almost all PC computers. As sound cards became more common, manufacturers began to remove the old timer chip from computers. The chips were also excluded from the design of server computers. The result is that Beep did not work on all computers without the chip. This was okay because most developers had moved on to calling the MessageBeep function that uses whatever is the default sound device instead of the 8254 chip. Eventually because of the lack of hardware to communicate with, support for Beep was dropped in Windows Vista and Windows XP 64-Bit Edition. In Windows 7, Beep was rewritten to pass the beep to the default sound device for the session. This is normally the sound card, except when run under Terminal Services, in which case the beep is rendered on the client. One time I didn't have my soundcard drivers installed, and Windows 7 "fell back" on the internal speaker. So if you're just doing this for yourself, or when you're developing and don't yet have a permanent solution, simply disable your soundcard in device manager and everything Beep call should be using the internal speaker. Edit: The MessageBeep function says the same as what I said above: "[Plays] A simple beep. If the sound card is not available, the sound is generated using the speaker." Edited July 27, 2011 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
sharpharp Posted July 27, 2011 Author Share Posted July 27, 2011 (edited) I don't want to disable the soundcard as I want users to be able to use headphones to listen to general music etc (external speakers are removed) But I need to run a script on logoff, which uses the internal onboard speaker to beep a tune on logoff to grab there attention. Hope that makes sense, so yes the script will need to run from within windows 7 but use the onboard internal speaker. But from what you said above, windows 7 is a big no no with Beep :-( Thanks for your help so far... Edited July 27, 2011 by sharpharp Link to comment Share on other sites More sharing options...
Bert Posted July 27, 2011 Share Posted July 27, 2011 You could do a splashimageon and have it flash or something like that. Here is the example from the helpfile: $destination = "..\GUI\mslogo.jpg" SplashImageOn("Splash Screen", $destination,250,50) Sleep(3000) SplashOff() The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
sharpharp Posted July 27, 2011 Author Share Posted July 27, 2011 I already have a visual logo which flashes up, but i was hoping for an audio alert as well because not everyone notices the screen when logging off... Link to comment Share on other sites More sharing options...
trancexx Posted July 27, 2011 Share Posted July 27, 2011 Did you try to search the examples forum.If I were you I would try searching for beep pc speaker. I bet 2 out of first 4 results will give you what you want. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Spiff59 Posted July 27, 2011 Share Posted July 27, 2011 You can send low-level commands to the servo motor of your hard drive, commanding it to move forward, then back. By putting it in a loop and inserting timers to vary the frequency and duration, you can play (buzzing) "songs" directly from your hard drive with no speaker at all! Each time played does likely takes 3 months off the life of your hard drive though Pardon my worthless/unusable post, but reading this thread made me think of the "novelty" programs that were floating around 20 years ago that "played music" in just this manner. Link to comment Share on other sites More sharing options...
sharpharp Posted July 29, 2011 Author Share Posted July 29, 2011 You can send low-level commands to the servo motor of your hard drive, commanding it to move forward, then back. By putting it in a loop and inserting timers to vary the frequency and duration, you can play (buzzing) "songs" directly from your hard drive with no speaker at all!Each time played does likely takes 3 months off the life of your hard drive though Pardon my worthless/unusable post, but reading this thread made me think of the "novelty" programs that were floating around 20 years ago that "played music" in just this manner.Thanks for all your replies, and i'll searched the examples scripts on this forum and yes they do work, BUT ONLY in older Windows XP machines. Now that the majority of the kit I use is based on Windows 7, the scripts do not work because Windows 7 was written to bypass the Internal Speaker...Is there a different programming way to access the Internal Speaker (but still under Windows 7)????Can't understand why MS would disable the speaker from within Windows... Link to comment Share on other sites More sharing options...
trancexx Posted July 29, 2011 Share Posted July 29, 2011 It's irrelevant what you can or can't understand. In fact, considering you failed to follow very simple instructions that would lead you to the solution it's expected that you can't understand. Once again, use the "search". ...or wait until someone does that for you. Yeah, wait. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
sharpharp Posted July 29, 2011 Author Share Posted July 29, 2011 (edited) It's irrelevant what you can or can't understand. In fact, considering you failed to follow very simple instructions that would lead you to the solution it's expected that you can't understand.Once again, use the "search". ...or wait until someone does that for you. Yeah, wait.Were you just born stupid, or did AutoIT turn you this way trannyexx? I have searched and if you can listen for a minute rather than being such a bolshy idiot, you will see I tried the solutions and YES they work in XP but not windows 7. So there is no solution from any of the replies (other than the hard drive clicker) which I don't want to wreck my HDs with.So next time you post a reply, say something constructive other than "Use Search" to up your post count.... Edited July 29, 2011 by sharpharp Link to comment Share on other sites More sharing options...
Ascend4nt Posted July 29, 2011 Share Posted July 29, 2011 Wow, you really need handholding sharp. trancexx gave you what you needed.Oh.. huh, look - there's another solution I see in this thread.. squint if you need to. My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
sharpharp Posted July 29, 2011 Author Share Posted July 29, 2011 (edited) Wow, you really need handholding sharp. trancexx gave you what you needed.Oh.. huh, look - there's another solution I see in this thread.. squint if you need to. And what was that? -a link to using Search which i have already tried and tested and said only works under XP? Are you his buddy or something? Cos the pair of you come across just as dumb and dumber... Edited July 29, 2011 by sharpharp Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted July 29, 2011 Share Posted July 29, 2011 If they are stupid then how are you even able to write? You are showing us right now that they are many times smarter than you so if they are stupid then you are a stone. trancexx told you exactly what to search for, and Ascend4nt linked you straight to it. I bet you haven't even ran the script yet. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
trancexx Posted July 29, 2011 Share Posted July 29, 2011 Were you just born stupid, or did AutoIT turn you this way trannyexx? I have searched and if you can listen for a minute rather than being such a bolshy idiot, you will see I tried the solutions and YES they work in XP but not windows 7. So there is no solution from any of the replies (other than the hard drive clicker) which I don't want to wreck my HDs with.So next time you post a reply, say something constructive other than "Use Search" to up your post count....Charmed, I'm sure. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Developers Jos Posted July 29, 2011 Developers Share Posted July 29, 2011 And what was that? -a link to using Search which i have already tried and tested and said only works under XP? Are you his buddy or something? Cos the pair of you come across just as dumb and dumber...You better tone down a notch because its not funny.Thread and topic closed and lets leave it that way. Jos WiValdiBB 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts