The common Gcode to do that is.....
M300 S300 P250
Where S300 is the frequency and P250 is the Duration
It seems to depend on the machine as to whether or not it will "beep" when it encounters this code.
I have a MakerBot Clone, so it should work on my machine. I may have to create a test file to try it out.
M300: Play beep sound
Support FiveD Teacup Sprinter Marlin Repetier Smoothie RepRapFirmware Machinekit MakerBot grbl Redeem MK4duo
No No No Yes Yes No Yes Yes Yes ??? No Yes
Snnn frequency in Hz
Pnnn duration in milliseconds
M300 S300 P1000
Play beep sound, use to notify important events like the end of printing. See working example on R2C2 electronics.
If an LCD device is attached to RepRapFirmware, a sound is played via the add-on touch screen control panel. Else the web interface will play a beep sound.