PC speaker beep

Blitz3D Forums/Blitz3D Programming/PC speaker beep

How would you sound the PC speaker? Would there be a way in Blitz3D to do so?

Thanks for any help.

http://www.blitzbasic.com/Community/posts.php?topic=76163#851726

Thank you very much :)

I don't get any sound using api_Beep (1000,150), but the speaker is plugged and works since I hear it in the first few seconds when booting the computer. Wonder what disabled it.

If I call "api_MessageBeep( MB_OK )", I get the windows default beep, which is heard comming out of the sound card audio out (green connexion).

api_beep works for me
try this
For x=1 To 2000 Step 10
api_Beep(x,20)
Next
End


I get no sound at all from that code mtnhome3d. I do notice the system halts when the beep is happening, but otherwise nothing.

EDIT: Oh, I noticed there is a jumper on the motherboard set to off concerning the pc speaker :o hummm...

EDIT2: Perfect, I switched the jumper on the motherboard for it's internal speaker to "ON" position. Now the beep instruction works :)

Allright! Here's a small test with a practical little equation:
api_Beep(Note2Frequency(59),100)
api_Beep(Note2Frequency(67),100)
api_Beep(Note2Frequency(71),100)
api_Beep(Note2Frequency(66),100)
api_Beep(Note2Frequency(61),100)
api_Beep(Note2Frequency(68),100)
api_Beep(Note2Frequency(73),100)
api_Beep(Note2Frequency(68),100)
api_Beep(Note2Frequency(63),100)
api_Beep(Note2Frequency(70),100)
api_Beep(Note2Frequency(75),100)
api_Beep(Note2Frequency(63),500)
End

Function Note2Frequency#(note#)
   Return (440.0 * 2.0^((note - 69.0) / 12.0))
End Function


Got help from this site for converting notes to frequency for the PC speaker:
http://www.sengpielaudio.com/calculator-notenames.htm

The only problem I find with using api_beep is that it hangs the application when called. Also I don't see a way that it is possible to detect if the speaker is hooked, which can be another interesting problem.

I've added this to the code archive :)

I am sorry but I can't help further because in my system everything works fine.
I do notice the system halts when the beep is happening

This means that the command is working (?)

EDIT: Forget my post. I didn't read all the text of your post

the reason for the delay is that the second param is a delay in millisecs. nice function