Hello,
I am using matrix voice to do a conversational agent. this agent has a wake word using your tutorial https://matrix-io.github.io/matrix-documentation/matrix-core/python-examples/wakeword/ (in python)
and then once the word is detected, it passes to another file to start the conversation using kernel modules from this tutorial https://matrix-io.github.io/matrix-documentation/matrix-voice/resources/microphone/
both scripts work perfectly fine alone however when I call the wake word which will take me to the conversational script, the microphone stops hearing.
I think the problem is that the microphone of the wake word is still on recognition so i tried to stop the recognition service doing a function like this
def stopwakewordservice():
# Define zmq socket
context = zmq.Context()
# Create a Pusher socket
socket = context.socket(zmq.PUSH)
# Connect Pusher to configuration socket
socket.connect('tcp://{0}:{1}'.format(matrix_ip, wakeword_port))
# Create a new driver config
config = driver_pb2.DriverConfig()
# Enable verbose option
config.wakeword.stop_recognition=True
# Send driver configuration through ZMQ socket
socket.send(config.SerializeToString())
print ('stop wake words for wakewords')
and then i added to your function in your tutorial this
def wakeword_data_callback(data):
# Extract data
data = io_pb2.WakeWordParams().FromString(data[0])
# Log data
print('{0}'.format(data))
# Run actions based on the phrase heard
# CHANGE TO YOUR PHRASE
if data.wake_word == 'WAKE UP':
print ('I HEARD WAKE UP START!\n')
stopwakewordservice()
conversationalagent.main() # this will go to the main script where the user can have a conversation with the matrix voice.
config_socket() #wakeword service is enabled again
Process(target=register_data_callback, args=(wakeword_data_callback, matrix_ip, wakeword_port)).start()
as a result, the script where it contains my voice recognition and conversational agents works, however, I get an error RuntimeError: IOLoop is already running which I understand that the async process of the wake word is still running. is stopping the wake word service and then re-enable it is wrong? should I stop the async loop? how? how can I turn off only the microphones of the wake word and then reopen them?? is there a solution where you can help me. HOW??
please and thank you…