紧急更新
1、删除意外出的语音合成开关; 2、唤醒、麦克风、扬声器可以启动后开启和关闭。
This commit is contained in:
parent
c31193e28f
commit
10d419e1e6
@ -315,16 +315,15 @@ class FeiFei:
|
||||
def say(self, interact, text):
|
||||
try:
|
||||
result = None
|
||||
if config_util.config["interact"]["sound_synthesis_enabled"]:
|
||||
audio_url = interact.data.get('audio')#透传的音频
|
||||
if audio_url is not None:
|
||||
file_name = 'sample-' + str(int(time.time() * 1000)) + '.wav'
|
||||
result = self.download_wav(audio_url, './samples/', file_name)
|
||||
elif config_util.config["interact"]["playSound"] or wsa_server.get_instance().is_connected(interact.data.get("user")) or self.__is_send_remote_device_audio(interact):#tts
|
||||
util.printInfo(1, interact.data.get('user'), '合成音频...')
|
||||
tm = time.time()
|
||||
result = self.sp.to_sample(text.replace("*", ""), self.__get_mood_voice())
|
||||
util.printInfo(1, interact.data.get('user'), '合成音频完成. 耗时: {} ms 文件:{}'.format(math.floor((time.time() - tm) * 1000), result))
|
||||
audio_url = interact.data.get('audio')#透传的音频
|
||||
if audio_url is not None:
|
||||
file_name = 'sample-' + str(int(time.time() * 1000)) + '.wav'
|
||||
result = self.download_wav(audio_url, './samples/', file_name)
|
||||
elif config_util.config["interact"]["playSound"] or wsa_server.get_instance().is_connected(interact.data.get("user")) or self.__is_send_remote_device_audio(interact):#tts
|
||||
util.printInfo(1, interact.data.get('user'), '合成音频...')
|
||||
tm = time.time()
|
||||
result = self.sp.to_sample(text.replace("*", ""), self.__get_mood_voice())
|
||||
util.printInfo(1, interact.data.get('user'), '合成音频完成. 耗时: {} ms 文件:{}'.format(math.floor((time.time() - tm) * 1000), result))
|
||||
|
||||
if result is not None:
|
||||
MyThread(target=self.__process_output_audio, args=[result, interact, text]).start()
|
||||
|
@ -201,6 +201,10 @@ class Recorder:
|
||||
audio_data_list = []
|
||||
while self.__running:
|
||||
try:
|
||||
record = cfg.config['source']['record']
|
||||
if not record['enabled']:
|
||||
time.sleep(0.1)
|
||||
continue
|
||||
self.is_reading = True
|
||||
data = stream.read(1024, exception_on_overflow=False)
|
||||
self.is_reading = False
|
||||
|
@ -48,6 +48,13 @@ class RecorderListener(Recorder):
|
||||
|
||||
def get_stream(self):
|
||||
try:
|
||||
#是否录音的控制是放在recorder.py的,这里的作用是防止没有麦克风的设备出错
|
||||
while True:
|
||||
record = config_util.config['source']['record']
|
||||
if record['enabled']:
|
||||
break
|
||||
time.sleep(0.1)
|
||||
|
||||
self.paudio = pyaudio.PyAudio()
|
||||
device_id = 0 # 或者根据需要选择其他设备
|
||||
|
||||
@ -221,7 +228,7 @@ def kill_process_by_port(port):
|
||||
except(psutil.NosuchProcess, psutil.AccessDenied):
|
||||
pass
|
||||
#数字人端请求获取最新的自动播放消息,若自动播放服务关闭会自动退出自动播放
|
||||
def start_auto_play_service():
|
||||
def start_auto_play_service(): #TODO 评估一下有无优化的空间
|
||||
url = f"{config_util.config['source']['automatic_player_url']}/get_auto_play_item"
|
||||
user = "User" #TODO 临时固死了
|
||||
is_auto_server_error = False
|
||||
@ -364,8 +371,8 @@ def start():
|
||||
record = config_util.config['source']['record']
|
||||
if record['enabled']:
|
||||
util.log(1, '开启录音服务...')
|
||||
recorderListener = RecorderListener(record['device'], feiFei) # 监听麦克风
|
||||
recorderListener.start()
|
||||
recorderListener = RecorderListener(record['device'], feiFei) # 监听麦克风
|
||||
recorderListener.start()
|
||||
|
||||
#启动声音沟通接口服务
|
||||
util.log(1,'启动声音沟通接口服务...')
|
||||
|
@ -137,7 +137,6 @@ new Vue({
|
||||
visualization_detection_enabled: false,
|
||||
source_record_enabled: false,
|
||||
source_record_device: '',
|
||||
sound_synthesis_enabled: true,
|
||||
attribute_name: "",
|
||||
attribute_gender: "",
|
||||
attribute_age: "",
|
||||
@ -211,7 +210,6 @@ new Vue({
|
||||
if (config.interact) {
|
||||
this.play_sound_enabled = config.interact.playSound;
|
||||
this.visualization_detection_enabled = config.interact.visualization;
|
||||
this.sound_synthesis_enabled = config.interact.sound_synthesis_enabled;
|
||||
this.QnA = config.interact.QnA;
|
||||
}
|
||||
if (config.source && config.source.record) {
|
||||
@ -277,7 +275,6 @@ new Vue({
|
||||
},
|
||||
"interact": {
|
||||
"playSound": this.play_sound_enabled,
|
||||
"sound_synthesis_enabled": this.sound_synthesis_enabled,
|
||||
"visualization": this.visualization_detection_enabled,
|
||||
"QnA": this.QnA,
|
||||
"maxInteractTime": this.interact_maxInteractTime,
|
||||
|
@ -55,7 +55,7 @@
|
||||
<div class="setting_wakeup">
|
||||
<ul>
|
||||
<li> <span class="font_name">唤醒模式:</span>
|
||||
<el-switch :disabled="!configEditable"
|
||||
<el-switch @change=saveConfig()
|
||||
v-model="wake_word_enabled"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949">
|
||||
@ -74,12 +74,12 @@
|
||||
|
||||
<div class="microphone">
|
||||
<div class="microphone_group1">
|
||||
<span class="font_name">扬 声 器 :</span>
|
||||
<el-switch v-model="play_sound_enabled" active-color="#13ce66" inactive-color="#ff4949" :disabled="!configEditable"> </el-switch>
|
||||
<span class="font_name">服务器扬声器</span>
|
||||
<el-switch v-model="play_sound_enabled" active-color="#13ce66" inactive-color="#ff4949" @change=saveConfig()> </el-switch>
|
||||
</div>
|
||||
<div class="microphone_group1" >
|
||||
<span class="font_name"> 麦 克 风 :</span>
|
||||
<el-switch v-model="source_record_enabled" active-color="#13ce66" inactive-color="#ff4949" :disabled="!configEditable"> </el-switch>
|
||||
<span class="font_name">服务器麦克风</span>
|
||||
<el-switch v-model="source_record_enabled" active-color="#13ce66" inactive-color="#ff4949" @change=saveConfig()> </el-switch>
|
||||
</div>
|
||||
</div>
|
||||
<div class="setting_wakeup">
|
||||
@ -90,10 +90,6 @@
|
||||
:label="item.label" :value="item.value">
|
||||
</option>
|
||||
</select></li>
|
||||
<li>
|
||||
<span class="font_name"> 声 音 合 成 :</span>
|
||||
<el-switch v-model="sound_synthesis_enabled" active-color="#13ce66" inactive-color="#ff4949" :disabled="!configEditable"> </el-switch>
|
||||
</li>
|
||||
<li style="display: flex;"> <span class="font_name" style="line-height: 36px;"> 敏 感 度 :</span>
|
||||
<el-slider style="width: 230px;" v-model="interact_perception_follow" :disabled="!configEditable"></el-slider></li>
|
||||
</ul>
|
||||
|
Loading…
Reference in New Issue
Block a user