Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

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


  • This topic is locked This topic is locked
15 replies to this topic

#1 sharpharp

sharpharp

    Seeker

  • Active Members
  • 44 posts

Posted 27 July 2011 - 09:46 AM

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.







#2 hannes08

hannes08

    my oh my

  • Active Members
  • PipPipPipPipPipPip
  • 944 posts

Posted 27 July 2011 - 09:57 AM

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

#3 Manadar

Manadar

         

  • MVPs
  • 10,869 posts

Posted 27 July 2011 - 10:03 AM

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, 27 July 2011 - 10:05 AM.


#4 sharpharp

sharpharp

    Seeker

  • Active Members
  • 44 posts

Posted 27 July 2011 - 10:17 AM

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, 27 July 2011 - 10:19 AM.


#5 DarthCookieMonster

DarthCookieMonster

    I ate your mom's cookie. Nom Nom Nom...

  • MVPs
  • 11,891 posts

Posted 27 July 2011 - 01:21 PM

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
_____


msg-108-0-96549500-1409901790.png
Obi didn't believe me when I told him the dark side has milk and cookies....


#6 sharpharp

sharpharp

    Seeker

  • Active Members
  • 44 posts

Posted 27 July 2011 - 03:08 PM

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

#7 trancexx

trancexx

    Queen F. Elizabeth MCXI

  • Active Members
  • PipPipPipPipPipPip
  • 6,245 posts

Posted 27 July 2011 - 06:34 PM

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.

          ......       ......
        .:oOOOOo:.   .:oOOOOo:.
      .:oOO:'':Oo:. .:oO:'':OOo:.
     .:oO:      'Oo:oO'      :Oo:.
     :oO:         'o'   
      :Oo:
     :oO:                     :Oo:
     ':oO:     OT9AO0IEDrk   :Oo:'
      ':oO:                 :Oo:'
        ':oO.             .Oo:'
          ':oO
.         .Oo:'
            ':oO.     .Oo:'
              ':oO. .Oo:'
                'oO:Oo'
                  'o' :kiss:



 

.
eMyvnE


#8 Spiff59

Spiff59

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,342 posts

Posted 27 July 2011 - 06:51 PM

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.

#9 sharpharp

sharpharp

    Seeker

  • Active Members
  • 44 posts

Posted 29 July 2011 - 11:22 AM

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

#10 trancexx

trancexx

    Queen F. Elizabeth MCXI

  • Active Members
  • PipPipPipPipPipPip
  • 6,245 posts

Posted 29 July 2011 - 02:08 PM

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.

          ......       ......
        .:oOOOOo:.   .:oOOOOo:.
      .:oOO:'':Oo:. .:oO:'':OOo:.
     .:oO:      'Oo:oO'      :Oo:.
     :oO:         'o'   
      :Oo:
     :oO:                     :Oo:
     ':oO:     OT9AO0IEDrk   :Oo:'
      ':oO:                 :Oo:'
        ':oO.             .Oo:'
          ':oO
.         .Oo:'
            ':oO.     .Oo:'
              ':oO. .Oo:'
                'oO:Oo'
                  'o' :kiss:



 

.
eMyvnE


#11 sharpharp

sharpharp

    Seeker

  • Active Members
  • 44 posts

Posted 29 July 2011 - 02:26 PM

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, 29 July 2011 - 02:27 PM.


#12 Ascend4nt

Ascend4nt

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,371 posts

Posted 29 July 2011 - 03:40 PM

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.

#13 sharpharp

sharpharp

    Seeker

  • Active Members
  • 44 posts

Posted 29 July 2011 - 04:13 PM

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, 29 July 2011 - 04:13 PM.


#14 AdmiralClaws

AdmiralClaws

    Where is the fish?

  • Active Members
  • PipPipPipPipPipPip
  • 4,686 posts

Posted 29 July 2011 - 04:34 PM

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.

#15 trancexx

trancexx

    Queen F. Elizabeth MCXI

  • Active Members
  • PipPipPipPipPipPip
  • 6,245 posts

Posted 29 July 2011 - 06:11 PM

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.

          ......       ......
        .:oOOOOo:.   .:oOOOOo:.
      .:oOO:'':Oo:. .:oO:'':OOo:.
     .:oO:      'Oo:oO'      :Oo:.
     :oO:         'o'   
      :Oo:
     :oO:                     :Oo:
     ':oO:     OT9AO0IEDrk   :Oo:'
      ':oO:                 :Oo:'
        ':oO.             .Oo:'
          ':oO
.         .Oo:'
            ':oO.     .Oo:'
              ':oO. .Oo:'
                'oO:Oo'
                  'o' :kiss:



 

.
eMyvnE


#16 Jos

Jos

    Je maintiendrai

  • Developers
  • 23,352 posts

Posted 29 July 2011 - 06:18 PM

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

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users