Sign in to follow this  
Followers 0

Use Internal PC Speaker to play a basic tune???

16 posts in this topic

Posted

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.

Share this post


Link to post
Share on other sites



Posted

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.

Share this post


Link to post
Share on other sites

Posted (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 by Manadar

Share this post


Link to post
Share on other sites

Posted (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 by sharpharp

Share this post


Link to post
Share on other sites

Posted

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(
)

Share this post


Link to post
Share on other sites

Posted

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...

Share this post


Link to post
Share on other sites

Posted

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.

Share this post


Link to post
Share on other sites

Posted

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.

Share this post


Link to post
Share on other sites

Posted

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...

Share this post


Link to post
Share on other sites

Posted

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.

Share this post


Link to post
Share on other sites

Posted (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 by sharpharp

Share this post


Link to post
Share on other sites

Posted

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.

Share this post


Link to post
Share on other sites

Posted (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 by sharpharp

Share this post


Link to post
Share on other sites

Posted

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.

Share this post


Link to post
Share on other sites

Posted

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.

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites
This topic is now closed to further replies.
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.