def run(self): from NVDAHelper import generateBeep hz,length,left,right = self.hz, self.length, self.left, self.right bufSize=generateBeep(None,hz,length,left,right) buf=create_string_buffer(bufSize) generateBeep(buf,hz,length,left,right) ppSynchronousPlayer.feed(buf.raw) ppSynchronousPlayer.idle()
def generateBeepBuf(self): hz = 400 length = 1000 left = right = 0 bufSize = generateBeep(None, hz, length, left, right) buf = create_string_buffer(bufSize) generateBeep(buf, hz, length, left, right) return buf
def beep(hz,length,left=50,right=50): """Plays a tone at the given hz, length, and stereo balance. @param hz: pitch in hz of the tone @type hz: float @param length: length of the tone in ms @type length: integer @param left: volume of the left channel (0 to 100) @type left: integer @param right: volume of the right channel (0 to 100) @type right: integer """ log.io("Beep at pitch %s, for %s ms, left volume %s, right volume %s"%(hz,length,left,right)) if not player: return from NVDAHelper import generateBeep bufSize=generateBeep(None,hz,length,left,right) buf=create_string_buffer(bufSize) generateBeep(buf,hz,length,left,right) player.stop() player.feed(buf.raw)