There are 2 difference issues here:
- Making an audible noise using Python.
This depends on the system you're running your code on.
Here's an example taken from this answer:
#windows
import winsound
winsound.Beep(300,2000)
#where a is the frequency and b is the duration in miliseconds
#linux
import os
os.system('play --no-show-progress --null --channels 1 synth %s sine %f' % ( a, b))
- Playing sound remotely through SSH.
If you want to play a remote sound locally, you need for forward the sound, much like X Forwarding, see this detailed SuperUser answer for how to do that. You need a separate application called paprefs
that will do that.
If you want to just emit the noise remotely, it should work just fine when you execute the script, depending on which shell session has control of the audio (what if another user is logged on and using the speakers to play music?) this is a related Unix/Linux question on that.