1
0
mirror of https://github.com/janvarev/Irene-Voice-Assistant.git synced 2025-11-23 22:45:08 +02:00

plugin_playwav_sounddevice.py - проигрывание WAV через sounddevice

доки - инфа, что rhvoice надо проигрывать через новый плагин playwav sounddevice
This commit is contained in:
janvarev
2022-05-10 00:00:14 +03:00
parent 268f380e20
commit c12c1af83c
2 changed files with 48 additions and 1 deletions

View File

@@ -0,0 +1,42 @@
# Playwav plugin for sounddevice engine
# author: Vladislav Janvarev
import os
from vacore import VACore
import sounddevice as sound_device
import soundfile as sound_file
modname = os.path.basename(__file__)[:-3] # calculating modname
# функция на старте
def start(core:VACore):
manifest = {
"name": "PlayWav through sounddevice",
"version": "1.0",
"require_online": False,
"playwav": {
"sounddevice": (init,playwav) # первая функция инициализации, вторая - проиграть wav-файл
}
}
return manifest
def start_with_options(core:VACore, manifest:dict):
pass
def init(core:VACore):
pass
def playwav(core:VACore, wavfile:str):
#AudioPlayer(wavfile).play(block=True)
filename = os.path.dirname(__file__)+"/../"+wavfile
#filename = 'timer/Sounds/Loud beep.wav'
# now, Extract the data and sampling rate from file
data_set, fsample = sound_file.read(filename, dtype = 'float32')
sound_device.play(data_set, fsample)
# Wait until file is done playing
status = sound_device.wait()
return