54 lines
886 B
Python
54 lines
886 B
Python
|
import numpy as np
|
||
|
import sounddevice as sd
|
||
|
|
||
|
|
||
|
def beep(duration=700, freq=640):
|
||
|
# 生成蜂鸣声的时间序列
|
||
|
t = np.linspace(0, duration / 1000, int(44100 * duration / 1000), False)
|
||
|
signal = 0.5 * np.sin(2 * np.pi * freq * t)
|
||
|
# 播放蜂鸣声
|
||
|
sd.play(signal, samplerate=44100)
|
||
|
sd.wait()
|
||
|
|
||
|
|
||
|
class SpeakServer:
|
||
|
|
||
|
def start(self):
|
||
|
pass
|
||
|
|
||
|
@staticmethod
|
||
|
def add_speak(data):
|
||
|
pass
|
||
|
|
||
|
@classmethod
|
||
|
def check_list(cls):
|
||
|
return True
|
||
|
|
||
|
@classmethod
|
||
|
def wait_4_speak(cls):
|
||
|
pass
|
||
|
|
||
|
@staticmethod
|
||
|
def speed_control(rate):
|
||
|
pass
|
||
|
|
||
|
@staticmethod
|
||
|
def volume_control(volume):
|
||
|
pass
|
||
|
|
||
|
@classmethod
|
||
|
def wait(cls):
|
||
|
return
|
||
|
|
||
|
@classmethod
|
||
|
def pause(cls):
|
||
|
return
|
||
|
|
||
|
@classmethod
|
||
|
def resume(cls):
|
||
|
return
|
||
|
|
||
|
@classmethod
|
||
|
def stop(cls):
|
||
|
return
|