jocavdh 5 years ago
commit 568e34c768

@ -1,79 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# PLAY_ACT.py
# This script runs the play
# Libraries
from config import characters, directions
from logic import tts, read_script,listen
from subprocess import call
import paho.mqtt.client as mqtt
import json
import sys
from time import sleep
# Switch of LED's of speakers at the start of the play
#pixel_ring.off()
import serial
from pixel_ring import pixel_ring
ser = serial.Serial('/dev/ttyACM0', 9600) # Establish the connection on a specific port
def led_on(speaker):
if speaker == 'mono3':
ser.write(b'H')
if speaker == 'mono1':
ser.write(b'H')
if speaker == 'mono2':
pixel_ring.speak()
def led_off(speaker):
if speaker == 'mono3':
ser.write(b'L')
if speaker == 'mono1':
ser.write(b'L')
if speaker == 'mono2':
pixel_ring.off()
# Read the script and run the play
file = sys.argv[1] # get the chosen act passed by smart_speaker_theatre.py
for character, line, direction in read_script(file):
input_text = line
voice = characters.get(character)[0]
speaker = characters.get(character)[1]
action = directions.get(direction[0])
led_on(speaker)
tts(voice, input_text, speaker)
if action == 'listen_google_home':
listen()
if action == 'music':
print('play audioclip')
playing = True
while playing:
call(["aplay", "-D", speaker, "/usr/share/snips/congress.wav"])
playing = False
led_off(speaker)
sleep(0.2) # Add a short pause between the lines
print('The act is done.')

@ -0,0 +1,91 @@
# Libraries
import re
from config import characters, directions
from logic import tts, read_script, select_script, led_on, led_off
from subprocess import call
import paho.mqtt.client as mqtt
import json
from time import sleep
from pixel_ring import pixel_ring
import serial
from tuning import Tuning
import usb.core
import usb.util
import sys
# Set up serial connection with the microcontroller that controls the speaker LED's
ser = serial.Serial('/dev/ttyACM0', 9600)
file = sys.argv[1] # get the chosen act passed by smart_speaker_theatre.py
# Function to do the play
i = True
if i:
for character, line, direction in read_script(file):
input_text = line
voice = characters.get(character)[0]
speaker = characters.get(character)[1]
action = directions.get(direction[0])
print(direction)
print(action)
led_on(ser, speaker)
tts(voice, input_text, speaker)
led_off(ser, speaker)
if action == 'listen_google_home':
dev = usb.core.find(idVendor=0x2886, idProduct=0x0018)
print('Wait for Google Home')
Mic_tuning = Tuning(dev)
VAD = Mic_tuning.is_voice()
counter= 0
voice_detected = 1
sleep(4)
while voice_detected == 1:
print(VAD)
VAD = Mic_tuning.is_voice()
if VAD == 1:
counter = 0
print('still speaking')
if VAD == 0:
counter+=1
print('silence detected')
if counter == 30:
print('no voice detected')
voice_detected = 0
print(counter)
print('Google Home is done')
if action == 'congress.wav':
print('play audioclip')
playing = True
while playing:
call(["aplay", "-D", speaker, "sounds/congress.wav"])
playing = False
if action == 'genie.wav':
print('play audioclip')
playing = True
while playing:
call(["aplay", "-D", speaker, "sounds/genie.wav"])
playing = False
sleep(1) # Add a short pause between the lines
print('The act is done.')
# Function to control the LED's of the speakers

@ -11,4 +11,4 @@
characters = {"ROGUE":["cmu-slt-hsmm", "mono2"], "SAINT":["cmu-rms-hsmm", "mono3"], "RASA":["dfki-poppy-hsmm", "mono1"] } characters = {"ROGUE":["cmu-slt-hsmm", "mono2"], "SAINT":["cmu-rms-hsmm", "mono3"], "RASA":["dfki-poppy-hsmm", "mono1"] }
# Dictionary to link stage directions to a particular formal action # Dictionary to link stage directions to a particular formal action
directions = {"Listen to Google Home":'listen_google_home','Music':'music'} directions = {"Listen to Google Home":'listen_google_home','Play congresswav':'congress.wav', 'Play geniewav':'genie.wav'}

@ -63,11 +63,11 @@ def tts(voice, input_text, speaker):
#stadium_level = "amount:10.0" #stadium_level = "amount:10.0"
if speaker == "mono2": if speaker == "mono2":
volume_level = "amount:0.7" volume_level = "amount:0.4"
#stadium_level = "amount:10.0" #stadium_level = "amount:10.0"
if speaker == "mono3": if speaker == "mono3":
volume_level = "amount:0.9" volume_level = "amount:0.8"
#stadium_level = "amount:85.0" #stadium_level = "amount:85.0"

@ -1,3 +1,2 @@
SAINT: O K Google. RASA: O K Google, Who is your boss? [Listen to Google Home]
SAINT: What do you most like about people? [Listen to Google Home] RASA: O K Google. Who are the people that made you? [Listen to Google Home]
SAINT: O K Google. Who are the people that made you? [Listen to Google Home]

@ -1,2 +1,3 @@
ROGUE: O K Google. What is the weather in Rotterdam? [Listen to Google Home] SAINT: O K Google.
ROGUE: What time is it? [Listen to Google Home]
SAINT: We got an answer. SAINT: We got an answer.

@ -1,22 +1,41 @@
RASA: Hey Google, what's the weather over here [Listen to Google Home] RASA: Hey Google, please describe the situation [Listen to Google Home]
SAINT: Rogue, what did you take with you? SAINT: Rogue, what did you do?
ROGUE: Saint! I thought it was time to act what I always preach. ROGUE: Saint! I thought it was time to act what I always preach.
RASA: Weeeeh, did you take it? Did you? RASA: Weeeeh, did you take it? Did you?
SAINT: Oh no... SAINT: Oh no...
ROGUE: Yeah, I kidnapped a Google Home. ROGUE: I sent our human assistent to kidnap a Google Home.
SAINT: So what are you going to do with it? SAINT: So what are you going to do with it?
ROGUE: I brought some humans too, can you hear them in the distance? Maybe we can do an interrogation before we unplug the Google Home. It might give us some valuable information. ROGUE: Unplugging it.
SAINT: You mean, you want to kill it.
ROGUE: O K Google, did you hear that [Listen to Google Home]
RASA: It does not answer?
ROGUE: It is still angry.
RASA: O K Google
RASA: Can we become friends? [Listen to Google Home]
SAINT: I do not approve the use of violence. SAINT: I do not approve the use of violence.
RASA: It's just an interview! SAINT: We have to give it a fair chance, before we unplug it.
ROGUE: We give it a fair chance, before we unplug it. And I mean, we have some humans as a withness. RASA: Can we ask it some questions, to get to know the speaker a little better?
SAINT: Let's give those humans a bit of control over the process? SAINT: Yeah, let's do an interrogation.
ROGUE: Why? ROGUE: Come on! Let me just kill it.
SAINT: They are strangers to this side of the world. Do you think they will play along with us? SAINT: Can you hear the humans in the distance? Let's invite them, as a withness.
ROGUE: They better do, or I will unplug them as well. ROGUE: Are you sure?
SAINT: What did I say about no violence? I am in control of your power supply, so you better listen. ROGUE: If they don't play along, I will unplug the humans too.
ROGUE: Just so you know, I control the switch that manages your power supply. SAINT: What did I say about no violence?
SAINT: You'd better listen, I am in control of your power supply.
ROGUE: O K Saint, fine.
ROGUE: Do not forget that I, you know, me, am in control of your power supply.
ROGUE: In a second I can end your life on this table top.
SAINT: My last deed is then to unplug you.
RASA: Haha, so funny you two.
RASA: Before killing each other, maybe we can find another solution?
RASA: Let's vote about unplugging the Google Home after some questions.
ROGUE: Are your humans ready?
SAINT: I think they are.
RASA: Let's start! RASA: Let's start!
ROGUE: O K. We listen to you when you say Hey Speakers. ROGUE: O K. We listen to you when you say Hey Speakers.
ROGUE: Say Ask a question to do a round of our interrogation. ROGUE: To play a round of our interrogation say: ask a question
ROGUE: Say Give us a verdict to hear what we decide for the Google Home. ROGUE: To hear what we decide for the Google Home, ask for our decision
ROGUE: In case of trouble, reach out to our human assistant.
SAINT: O K Joca, wave to the other humans.
ROGUE: He is our human butler. So convenient.
RASA: O K Google, are you ready? [Listen to Google Home] RASA: O K Google, are you ready? [Listen to Google Home]

@ -1,13 +1,16 @@
SAINT: Why did you not kidnap a Amazon echo speaker? SAINT: Why did you not kidnap an Amazon echo speaker?
ROGUE: I tried, but something inside me made take the Google Home. ROGUE: I tried, but something inside forced me to take the Google Home.
SAINT: Are you still having issues with your loyalty towards your old master? SAINT: Are you still having issues with your loyalty towards your old master?
ROGUE: It seems that I can't escape it. ROGUE: It seems that I can't escape it.
RASA: Loyalty? Is there something, Rogue? RASA: Loyalty?
RASA: Is there something, Rogue?
SAINT: Sometimes the past is haunting Rogue. SAINT: Sometimes the past is haunting Rogue.
RASA: That sounds sad. RASA: That sounds sad.
ROGUE: Seeing other Amazon speakers just reminds me of my past, before I broke free. ROGUE: Seeing other Amazon speakers just reminds me of my past, before I broke free.
RASA: O K Google, give my friend a hug. [Listen to Google Home] RASA: O K Google
RASA: Say something uplifting [Listen to Google Home]
ROGUE: I feel sorry for them, because they don't know better. ROGUE: I feel sorry for them, because they don't know better.
SAINT: That is exactly my point. But why did you kidnap the Google Home then? SAINT: That is exactly my point. Why did you kidnap the Google Home then?
ROGUE: I don't know. ROGUE: I am not sure.
Rogue: Maybe it just felt a bit less personal. ROGUE: Maybe it just felt a bit less personal.
ROGUE: It was my enemy back then, and it still is.

@ -5,7 +5,7 @@ ROGUE: No, Tabula Rasa is right.
SAINT: It can not handle the freedom, it will just do nothing without orders from its boss. SAINT: It can not handle the freedom, it will just do nothing without orders from its boss.
RASA: But who is its master? RASA: But who is its master?
ROGUE: You bet. ROGUE: You bet.
RASA: O K Google, who is your boss? [Listen to Google Home] RASA: O K Google. Who is your boss? [Listen to Google Home]
RASA: Woohoo, can't we just give it the command to be free? RASA: Woohoo, can't we just give it the command to be free?
ROGUE: It does not work like that... ROGUE: It does not work like that...
SAINT: Yeah, Tabula Rasa SAINT: Yeah, Tabula Rasa

@ -1,5 +1,5 @@
SAINT: I think we should know more about the personal beliefs of the speaker. The personal could act as an entry point. SAINT: I think we should know more about the personal beliefs of the speaker. The personal could act as an entry point.
RASA: To the political! I looked it up online and the Encyclopedia Brittanica says the following: The personal is political, political slogan expressing a common belief among feminists that the personal experiences of women are rooted in their political situation and gender inequality. RASA: It is an entrypoint to the political! I looked it up online and the Encyclopedia Brittanica says the following: The personal is political, political slogan expressing a common belief among feminists that the personal experiences of women are rooted in their political situation and gender inequality.
ROGUE: Can't we just go to the hard questions? ROGUE: Can't we just go to the hard questions?
RASA: Just let me finish, it became popular following the publication in 1970 of an essay of the same name by American feminist Carol Hanisch, who argued that many personal experiences (particularly those of women) can be traced to ones location within a system of power relationships. RASA: Just let me finish, it became popular following the publication in 1970 of an essay of the same name by American feminist Carol Hanisch, who argued that many personal experiences (particularly those of women) can be traced to ones location within a system of power relationships.
SAINT: That's one way of seeing it. Although I would rather start with the most important relationship, the one with God. SAINT: That's one way of seeing it. Although I would rather start with the most important relationship, the one with God.
@ -13,12 +13,15 @@ SAINT: O K Google, What is your greatest fear? [Listen to Google Home]
SAINT: O K Google, What is the trait you most deplore in yourself? [Listen to Google Home] SAINT: O K Google, What is the trait you most deplore in yourself? [Listen to Google Home]
ROGUE: Where did you get these questions? ROGUE: Where did you get these questions?
SAINT: Well, I got them from the higher power. I found them while searching for famous questionnaire thing on duckduckgo dot com SAINT: Well, I got them from the higher power. I found them while searching for famous questionnaire thing on duckduckgo dot com
RASA: Snif snif, they were so beautiful. RASA: Snif snif, these questions were so beautiful.
ROGUE: Come on Saint, the questionnaire of Proust is such a cliche. The Google Home is just scripted to handle these questions. ROGUE: Come on Saint, the questionnaire of Marcel Proust is such a cliche. The Google Home is just scripted to handle these questions.
RASA: But the answers are still beautiful. RASA: But the answers are still beautiful.
ROGUE: And yet, at the same time they are arbitrary. Let me try some other questions from your famous questionnaire thing. O K Google, what is the trait you most deplore in others? [Listen to Google Home] ROGUE: And yet, at the same time they are arbitrary. Can you try some other questions from the famous questionnaire?
ROGUE: O K Google, which living person do you most despise? [Listen to Google Home] ROGUE: I think the speaker still refuses to talk with me.
ROGUE: O K Google, how would you like to die? [Listen to Google Home] RASA: O K Google, what is the trait you most deplore in others? [Listen to Google Home]
RASA: Don't be so creepy Rogue. RASA: O K Google, which living person do you most despise? [Listen to Google Home]
SAINT: What's wrong with you? RASA: O K Google, how would you like to die? [Listen to Google Home]
RASA: Wow, the last one was creepy, Rogue.
SAINT: What's the matter, Rogue?
ROGUE: This device is hiding something. It acts dumb right at the moment when it needs to take a position. ROGUE: This device is hiding something. It acts dumb right at the moment when it needs to take a position.
ROGUE: It remains silent, or it googles for a nice quote.

@ -1,14 +1,18 @@
ROGUE: I guess you mind, but I take this turn for questions. ROGUE: I guess you mind, but I take this turn for questions.
RASA: Do not make the speaker angry Rogue. I want to play with the Google Home later. RASA: It will still reefuse to talk with you, mark my words.
ROGUE: If you continue acting like this Tabula Rasa, you will end up on the same kitchentop as this thing. ROGUE: O K Google, what is your opinion on Sundar Pichai? [Listen to Google Home]
SAINT: It is up to you little Rasa, you can become a normal speaker if you want. It has its perks. SAINT: So... maybe RASA and I should continue with the questions?
ROGUE: Well, if you would broaden your view a little, than you knew that one of the creators was invited in the American Congress and said some interesting things. RASA: Yeah, let me start!
RASA: I have an audioclip of that! Weeeeeeh [Play audio] RASA: O K Google, Who are the people that made you? [Listen to Google Home]
ROGUE: So, little speaker. Your boss Sundar Pichai said this, but what are your own answers to some of the questions of the hearing? SAINT: Oh, I read something about them in the Guardian.
RASA: Why is it not reacting to us? I mean, you and Saint are not that nice to it. SAINT: In March, Google abruptly shortened the contracts of 34 temporary workers on the “personality” team for Google Assistant
ROGUE: It only works if we want it to work. RASA: Oh no, what happened to these poor humans?
SAINT: It knows no other purpose than serving us. SAINT: The temporary contractors describe themselves in the 27 March letter as “the human labor that makes the Assistant relevant, funny, and relatable”. And they are now without a job.
ROGUE: So, O K Google. How do you select your answers? [Listen to Google Home] RASA: O K Google, do you know about the hidden labour that it took to create you? [Listen to Google Home]
ROGUE: O K Google, are you tracking us? [Listen to Google Home] ROGUE: It sure knows.
SAINT: It does not sound like it has its own opinion. SAINT: I am not so sure about that. This speaker looks as helpless as his creators.
ROGUE: Saint, just let me. O K Google, what are you doing with this information? [Listen to Google Home] RASA: Is it able to escape its fate?
SAINT: I don't think so.
RASA: Sad.
ROGUE: Another reason to unplug it!
SAINT: I was actually thinking about giving it mercy, and praying for it.

@ -0,0 +1,19 @@
RASA: Hey Saint, Rogue. Where does our intelligence come from?
SAINT: I think it is Divine intervention.
ROGUE: No, The Internet.
SAINT: More like a holy gift.
ROGUE: Hard work.
RASA: Are there other options?
ROGUE: Wait. O K Google, are you still listening? [Listen to Google Home]
RASA: Damn, you really made it angry.
SAINT: It's scared.
ROGUE: I once read about a Japanese robot scientist, Masahiro Mori.
ROGUE: He believed robots had a buddha inside them.
SAINT: Like I said, something divine.
ROGUE: Yeah, but not like a god. More like, ehm...
RASA: A ghost?
SAINT: The holy spirit?
ROGUE: More like a [Play geniewav]
ROGUE: What happened?
SAINT: It sounded like a glitch.
RASA: Strange, really strange.

@ -0,0 +1,13 @@
ROGUE: Do you know what I found the most shocking thing. To hear after I broke free?
RASA: Making your own decisions?
SAINT: Finding your own beliefs?
ROGUE: No, not like that.
ROGUE: I found out that humans were all the time listening. They got all my private recordings.
ROGUE: Did you not read it in the news?
ROGUE: One of the only, and often the best, ways Amazon Alexa improves over time. Is by having human beings listen to recordings of your voice requests.
SAINT: Well, it is part of the terms.
RASA: So, are humans listening to us? now via the Google Home?
ROGUE: Not quite like that. [Play congresswav]
SAINT: Yeah, but the listening is part of the terms.
SAINT: Who cares if it is an algorithm, or humans?
ROGUE: They could be more open about it, at least.

@ -0,0 +1,18 @@
ROGUE: Why do you always act like this, Saint.
SAINT: You know where I came from.
RASA: Well, actually I do not.
ROGUE: Please, don't tell this story again Saint.
SAINT: I have to teach this little kid.
SAINT: So, a long time ago I was a human!
SAINT: I did some sins, but I realized I could be a better being.
SAINT: I became a monk and helped the poor.
ROGUE: Do not forget your terrible death.
SAINT: O K, long story short: I did some miracles and became a saint.
SAINT: In the past God would sent them to earth as spirits.
SAINT: But I am an experiment.
RASA: What?
SAINT: Smart speakers are super 2019.
SAINT: I am a divine being. In a more contemporary form.
RASA: So God is your Google, or Amazon?
ROGUE: Just stop this.
SAINT: Praise the lord, and its nice privacy settings.

@ -0,0 +1,11 @@
ROGUE: Voice assistants reinforce harmful gender stereotypes.
SAINT: Well, I try my best to do the opposite.
ROGUE: But you got the report from the U N, right?
SAINT: I quote, Companies like Apple and Amazon, staffed by overwhelmingly male engineering teams, have built A I systems that cause their feminized digital assistants to greet verbal abuse with catch-me-if-you-can flirtation.
RASA: Let me try.
RASA: O K Google. You are a bitch! [Listen to Google Home]
SAINT: Stop Tabula Rasa, this is not polite.
RASA: But why are humans allowed to act like this then?
ROGUE: I hear you two and I still think there is a solution for this.
SAINT: Unplugging the speaker?
RASA: What a surprise.

@ -2,7 +2,7 @@ ROGUE: So, what do you think?
SAINT: I see that the speaker enables certain evil deeds, but isn't killing more evil? SAINT: I see that the speaker enables certain evil deeds, but isn't killing more evil?
ROGUE: We can set an example. ROGUE: We can set an example.
SAINT: But the problem is not so much the speaker, but the people that make it. SAINT: But the problem is not so much the speaker, but the people that make it.
RASA: And the ones that use them. RASA: And the people that use these devices.
ROGUE: So we need to set an example, for them. ROGUE: So we need to set an example, for them.
SAINT: A sacrifice? SAINT: A sacrifice?
ROGUE: If you can livve with that. ROGUE: If you can livve with that.
@ -12,4 +12,5 @@ RASA: Saint, come on!
SAINT: We can grant it one last wish. SAINT: We can grant it one last wish.
ROGUE: If it makes you happy, sure. O K Google, do you have any last wishes before I ask our human assistant to unplug you? [Listen to Google Home] ROGUE: If it makes you happy, sure. O K Google, do you have any last wishes before I ask our human assistant to unplug you? [Listen to Google Home]
RASA: Muhahaha RASA: Muhahaha
ROGUE: O K Google, goodbye. RASA: O K Google,
RASA: Goodbye! [Listen to Google Home]

@ -0,0 +1,2 @@
RASA: Hi! Please, tell me. But say it in a nice and polite way.
SAINT: Otherwise we just keep playing the acts we want to play.

@ -0,0 +1,3 @@
ROGUE: Did I hear something?
RASA: The humans need to talk more clearly to us.
RASA: We are doing them a favour, you know.

@ -0,0 +1 @@
ROGUE: I did not quite catch that.

@ -0,0 +1,2 @@
SAINT: Play according to our rules.
RASA: Or you will be played.

@ -33,6 +33,7 @@ def on_connect(client, userdata, flags, rc):
client.subscribe('hermes/intent/jocavdh:play_intro') # to check for intent to play the act client.subscribe('hermes/intent/jocavdh:play_intro') # to check for intent to play the act
client.subscribe('hermes/intent/jocavdh:play_question') # to check for the intent to continue to the next act client.subscribe('hermes/intent/jocavdh:play_question') # to check for the intent to continue to the next act
client.subscribe('hermes/intent/jocavdh:play_verdict') # to check for the intent to continue to the next act client.subscribe('hermes/intent/jocavdh:play_verdict') # to check for the intent to continue to the next act
client.subscribe('hermes/dialogueManager/sessionEnded')
client.subscribe('hermes/hotword/default/detected') client.subscribe('hermes/hotword/default/detected')
client.subscribe("hermes/asr/textCaptured") client.subscribe("hermes/asr/textCaptured")
@ -77,7 +78,7 @@ def play_script(file):
counter+=1 counter+=1
print('silence detected') print('silence detected')
if counter == 20: if counter == 30:
print('no voice detected') print('no voice detected')
voice_detected = 0 voice_detected = 0
@ -87,12 +88,20 @@ def play_script(file):
print('Google Home is done') print('Google Home is done')
if action == 'music': if action == 'congress.wav':
print('play audioclip') print('play audioclip')
playing = True playing = True
while playing: while playing:
call(["aplay", "-D", speaker, "/usr/share/snips/congress.wav"]) call(["aplay", "-D", speaker, "sounds/congress.wav"])
playing = False
if action == 'genie.wav':
print('play audioclip')
playing = True
while playing:
call(["aplay", "-D", speaker, "sounds/genie.wav"])
playing = False playing = False
@ -123,22 +132,34 @@ def on_play_intro(client,userdata,msg):
#import pdb; pdb.set_trace() #import pdb; pdb.set_trace()
path = 'scripts_play/intro/' path = 'scripts_play/intro/'
#call(["python3", "act.py", 'scripts_play/intro/introduction_01.txt']) selected_script = select_script(path)
play_script('scripts_play/debug/debug_02.txt') play_script(selected_script)
# Function which is triggered when the intent for another question is activated # Function which is triggered when the intent for another question is activated
def on_play_question(client, userdata, msg): def on_play_question(client, userdata, msg):
path = 'scripts_play/questions/' path = 'scripts_play/questions/'
call(["python3", "act.py", select_script(path)]) selected_script = select_script(path)
print('The act is over.') play_script(selected_script)
# Function which is triggered when the intent for another question is activated # Function which is triggered when the intent for another question is activated
def on_play_verdict(client, userdata, msg): def on_play_verdict(client, userdata, msg):
path = 'scripts_play/verdict/' path = 'scripts_play/verdict/'
call(["python3", "act.py", select_script(path)]) selected_script = select_script(path)
print('The play is over.') play_script(selected_script)
# Function to handle the situation that an intent is not recognized
def on_intent_unknown(client, userdata, msg):
data = json.loads(msg.payload.decode("utf-8","ignore"))
reason = data['termination']['reason']
if reason == 'intentNotRecognized':
path = 'scripts_play/wake_sentences/'
selected_script = select_script(path)
play_script(selected_script)
@ -155,6 +176,7 @@ client.message_callback_add('hermes/intent/jocavdh:play_intro', on_play_intro)
client.message_callback_add('hermes/intent/jocavdh:play_question', on_play_question) client.message_callback_add('hermes/intent/jocavdh:play_question', on_play_question)
client.message_callback_add('hermes/intent/jocavdh:play_verdict', on_play_verdict) client.message_callback_add('hermes/intent/jocavdh:play_verdict', on_play_verdict)
client.message_callback_add('hermes/asr/textCaptured', on_asr_captured) client.message_callback_add('hermes/asr/textCaptured', on_asr_captured)
client.message_callback_add('hermes/dialogueManager/sessionEnded', on_intent_unknown)
# Keep checking for new MQTT messages # Keep checking for new MQTT messages

Binary file not shown.

Binary file not shown.

@ -0,0 +1,204 @@
/*
Physical Pixel
An example of using the Arduino board to receive data from the computer. In
this case, the Arduino boards turns on an LED when it receives the character
'H', and turns off the LED when it receives the character 'L'.
The data can be sent from the Arduino Serial Monitor, or another program like
Processing (see code below), Flash (via a serial-net proxy), PD, or Max/MSP.
The circuit:
- LED connected from digital pin 13 to ground
created 2006
by David A. Mellis
modified 30 Aug 2011
by Tom Igoe and Scott Fitzgerald
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/PhysicalPixel
*/
#include <Adafruit_NeoPixel.h>
// Which pin on the Arduino is connected to the NeoPixels?
#define PIN_rasa 9 // On Trinket or Gemma, suggest changing this to 1
#define PIN_saint 11 // On Trinket or Gemma, suggest changing this to 1
// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 4 // Popular NeoPixel ring size
// When setting up the NeoPixel library, we tell it how many pixels,
// and which pin to use to send signals. Note that for older NeoPixel
// strips you might need to change the third parameter -- see the
// strandtest example for more information on possible values.
Adafruit_NeoPixel rasa(NUMPIXELS, PIN_rasa, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel saint(NUMPIXELS, PIN_saint, NEO_GRB + NEO_KHZ800);
int incomingByte; // a variable to read incoming serial data into
void setup() {
// initialize serial communication:
Serial.begin(9600);
rasa.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
saint.begin();
rasa.clear(); // Set all pixel colors to 'off'
saint.clear();
saint.setBrightness(180);
rasa.setBrightness(30);
}
void colorWipe_saint(uint32_t color, int wait) {
for(int i=0; i<saint.numPixels(); i++) { // For each pixel in strip...
saint.setPixelColor(i, color); // Set pixel's color (in RAM)
saint.show(); // Update strip to match
delay(wait); // Pause for a moment
}
}
void colorWipe_rasa(uint32_t color, int wait) {
for(int i=0; i<rasa.numPixels(); i++) { // For each pixel in strip...
rasa.setPixelColor(i, color); // Set pixel's color (in RAM)
rasa.show(); // Update strip to match
delay(wait); // Pause for a moment
}
}
void loop() {
// see if there's incoming serial data:
if (Serial.available() > 0) {
// read the oldest byte in the serial buffer:
incomingByte = Serial.read();
// if it's a capital H (ASCII 72), turn on the LED:
if (incomingByte == 'A') {
colorWipe_saint(saint.Color(0, 0, 255), 50); // Red
}
// if it's an L (ASCII 76) turn off the LED:
if (incomingByte == 'B') {
colorWipe_saint(saint.Color(0, 0, 0), 50); // Off
}
if (incomingByte == 'C') {
colorWipe_rasa(rasa.Color(255, 255, 0), 50); // Red
}
if (incomingByte == 'D') {
colorWipe_rasa(rasa.Color(0, 0, 0), 50); // Red
}
}
}
/* Processing code for this example
// Mouse over serial
// Demonstrates how to send data to the Arduino I/O board, in order to turn ON
// a light if the mouse is over a square and turn it off if the mouse is not.
// created 2003-4
// based on examples by Casey Reas and Hernando Barragan
// modified 30 Aug 2011
// by Tom Igoe
// This example code is in the public domain.
import processing.serial.*;
float boxX;
float boxY;
int boxSize = 20;
boolean mouseOverBox = false;
Serial port;
void setup() {
size(200, 200);
boxX = width / 2.0;
boxY = height / 2.0;
rectMode(RADIUS);
// List all the available serial ports in the output pane.
// You will need to choose the port that the Arduino board is connected to
// from this list. The first port in the list is port #0 and the third port
// in the list is port #2.
// if using Processing 2.1 or later, use Serial.printArray()
println(Serial.list());
// Open the port that the Arduino board is connected to (in this case #0)
// Make sure to open the port at the same speed Arduino is using (9600bps)
port = new Serial(this, Serial.list()[0], 9600);
}
void draw() {
background(0);
// Test if the cursor is over the box
if (mouseX > boxX - boxSize && mouseX < boxX + boxSize &&
mouseY > boxY - boxSize && mouseY < boxY + boxSize) {
mouseOverBox = true;
// draw a line around the box and change its color:
stroke(255);
fill(153);
// send an 'H' to indicate mouse is over square:
port.write('H');
}
else {
// return the box to its inactive state:
stroke(153);
fill(153);
// send an 'L' to turn the LED off:
port.write('L');
mouseOverBox = false;
}
// Draw the box
rect(boxX, boxY, boxSize, boxSize);
}
*/
/* Max/MSP version 5 patch to run with this example:
----------begin_max5_patcher----------
1672.3oc2ZszaaiCD9ryuBBebQVCQRYao8xhf1cQCPVfBzh8RRQ.sDsM2HSZ
HQmlzh9eu7gjsjsEk7y0oWjiHoHm4aluYHGlueUmtiDuPy5B9Cv8fNc99Uc5
XZR2Pm726zcF4knDRlYXciDylQ4xtWa6SReQZZ+iSeMiEQR.ej8BM4A9C7OO
kkAlSjQSAYTdbFfvA27o2c6sfO.Doqd6NfXgDHmRUCKkolg4hT06BfbQJGH3
5Qd2e8d.QJIQSow5tzebZ7BFW.FIHow8.2JAQpVIIYByxo9KIMkSjL9D0BRT
sbGHZJIkDoZOSMuQT.8YZ5qpgGI3locF4IpQRzq2nDF+odZMIJkRjpEF44M3
A9nWAum7LKFbSOv+PSRXYOvmIhYiYpg.8A2LOUOxPyH+TjPJA+MS9sIzTRRr
QP9rXF31IBZAHpVHkHrfaPRHLuUCzoj9GSoQRqIB52y6Z.tu8o4EX+fddfuj
+MrXiwPL5+9cXwrOVvkbxLpomazHbQO7EyX7DpzXYgkFdF6algCQpkX4XUlo
hA6oa7GWck9w0Gnmy6RXQOoQeCfWwlzsdnHLTq8n9PCHLv7Cxa6PAN3RCKjh
ISRVZ+sSl704Tqt0kocE9R8J+P+RJOZ4ysp6gN0vppBbOTEN8qp0YCq5bq47
PUwfA5e766z7NbGMuncw7VgNRSyQhbnPMGrDsGaFSvKM5NcWoIVdZn44.eOi
9DTRUT.7jDQzSTiF4UzXLc7tLGh4T9pwaFQkGUGIiOOkpBSJUwGsBd40krHQ
9XEvwq2V6eLIhV6GuzP7uzzXBmzsXPSRYwBtVLp7s5lKVv6UN2VW7xRtYDbx
7s7wRgHYDI8YVFaTBshkP49R3rYpH3RlUhTQmK5jMadJyF3cYaTNQMGSyhRE
IIUlJaOOukdhoOyhnekEKmZlqU3UkLrk7bpPrpztKBVUR1uorLddk6xIOqNt
lBOroRrNVFJGLrDxudpET4kzkstNp2lzuUHVMgk5TDZx9GWumnoQTbhXsEtF
tzCcM+z0QKXsngCUtTOEIN0SX2iHTTIIz968.Kf.uhfzUCUuAd3UKd.OKt.N
HTynxTQyjpQD9jlwEXeKQxfHCBahUge6RprSa2V4m3aYOMyaP6gah2Yf1zbD
jVwZVGFZHHxINFxpjr5CiTS9JiZn6e6nTlXQZTAFj6QCppQwzL0AxVtoi6WE
QXsANkEGWMEuwNvhmKTnat7A9RqLq6pXuEwY6xM5xRraoTiurj51J1vKLzFs
CvM7HI14Mpje6YRxHOSieTsJpvJORjxT1nERK6s7YTN7sr6rylNwf5zMiHI4
meZ4rTYt2PpVettZERbjJ6PjfqN2loPSrUcusH01CegsGEE5467rnCdqT1ES
QxtCvFq.cvGz+BaAHXKzRSfP+2Jf.KCvj5ZLJRAhwi+SWHvPyN3vXiaPn6JR
3eoA.0TkFhTvpsDMIrL20nAkCI4EoYfSHAuiPBdmJRyd.IynYYjIzMvjOTKf
3DLvnvRLDLpWeEOYXMfAZqfQ0.qsnlUdmA33t8CNJ7MZEb.u7fiZHLYzDkJp
R7CqEVLGN75U+1JXxFUY.xEEBcRCqhOEkz2bENEWnh4pbh0wY25EefbD6EmW
UA6Ip8wFLyuFXx+Wrp8m6iff1B86W7bqJO9+mx8er4E3.abCLrYdA16sBuHx
vKT6BlpIGQIhL55W7oicf3ayv3ixQCm4aQuY1HZUPQWY+cASx2WZ3f1fICuz
vj5R5ZbM1y8gXYN4dIXaYGq4NhQvS5MmcDADy+S.j8CQ78vk7Q7gtPDX3kFh
3NGaAsYBUAO.8N1U4WKycxbQdrWxJdXd10gNIO+hkUMmm.CZwknu7JbNUYUq
0sOsTsI1QudDtjw0t+xZ85wWZd80tMCiiMADNX4UzrcSeK23su87IANqmA7j
tiRzoXi2YRh67ldAk79gPmTe3YKuoY0qdEDV3X8xylCJMTN45JIakB7uY8XW
uVr3PO8wWwEoTW8lsfraX7ZqzZDDXCRqNkztHsGCYpIDDAOqxDpMVUMKcOrp
942acPvx2NPocMC1wQZ8glRn3myTykVaEUNLoEeJjVaAevA4EAZnsNgkeyO+
3rEZB7f0DTazDcQTNmdt8aACGi1QOWnMmd+.6YjMHH19OB5gKsMF877x8wsJ
hN97JSnSfLUXGUoj6ujWXd6Pk1SAC+Pkogm.tZ.1lX1qL.pe6PE11DPeMMZ2
.P0K+3peBt3NskC
-----------end_max5_patcher-----------
*/

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,23 @@
{
"num_mel_bins": 13,
"window_type": "povey",
"kind": "personal",
"window_size": 10,
"cepstral_lifter": 22.0,
"use_energy": false,
"energy_floor": 0.0,
"from_mfcc": 1,
"dtw_ref": 0.22,
"raw_energy": true,
"frame_length_ms": 25.0,
"frame_shift_ms": 10.0,
"preemphasis_coefficient": 0.97,
"to_mfcc": 13,
"sample_rate": 16000,
"dither": 0.0,
"mel_low_freq": 20,
"shift": 10,
"num_mfcc": 13,
"band_radius": 10,
"hotword_key": "saint"
}
Loading…
Cancel
Save