Trying to Generate a Beep on a PC windows 10 with a button push

I’m using keyboard.h on a Leonardo to communicate to a PC via buttons as keystrokes. I would like to make the PC generate the windows “beep” on certain keystrokes. I can’t seem to find a reference on how to do that.
For Example…
if (buttonState1 == LOW) {
Keyboard.press(104);
“Make a beep sound”…
Keyboard.release(104);
}

Can someone please help?

If it is the Arduino that is going to make the noise and just use a tone statement in the code.

if however you want the PC to make that sound then just send an ASCII “bell code”.

However, it is almost certain that the PC will not respond to this code, try it and see.

I don’t “do” PCs so I don’t know if there is some way of making the keyboard generate a sound.

Sending an ASCII 7 (BELL) could work if the focus is on a terminal program (putty, hyperterminal, etc).
I'm sure there is some way to program the action of some type of hot key, then the Leonardo just have to send that key.
Maybe this helps: How to Create Keyboard Shortcuts in Windows 10 | Laptop Mag

I don't think that there is a way for a USB device that's faking a keyboard to beep, but I may be wrong.

I don't think that there is a way for a USB device that's faking a keyboard to beep, but I may be wrong.

Well the OP showed a very good way for the device faking a keyboard could do it.

Grumpy_Mike:
Well the OP showed a very good way for the device faking a keyboard could do it.

ASCII 104 is just a 'h', in most cases that will not make the PC do a beep.
I don't see here Keyboard - Arduino Reference any function do force a beep, however I remember that PC's used to beep when the keyboard buffer was full, maybe it's possible to send a lot of chars very fast in order to force this situation.

ASCII 104 is just a 'h', in most cases that will not make the PC do a beep.

True but that is not what I said. Read my comment again. The OP showed a very good way of making
THE DEVICE THAT IS FAKING THE KEYSTROKES TO MAKE THE NOISE - not the PC.

You said:-

I don't think that there is a way for a USB device that's faking a keyboard to beep, but I may be wrong.

I was pointing out that you were wrong.

Note you are saying there is no way for the Arduino, the device which is faking the keyboard, to make a noise. But it is very simple to do that, no matter what the key value it is faking, it can just generate the noise, with the tone function, after it has sent the key code to the PC.

The OP says "I would like to make the PC generate the windows "beep"" so I assumed that he wanted to make the PC go beep... English is not my 1st language, I may be wrong.

I totally hate that faking an input device is so easy (with libs) to do, the capability for wrong doing is enormous.

Thank you for the input Grumpy_Mike and ocsav. The options provided don't work in the application I'm working in, the program ignores the "hotkey" keystroke even though the code sends it correctly. ASCII 7 code didn't work either. I think I'm going to need to send a command to play a .wav file...

Thanks again gentlemen,
Mark