added news acts, fallback for no recognition, added sounds
parent
29e8fab94f
commit
2a06096f38
@ -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
|
@ -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.
|
||||||
|
@ -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.
|
@ -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.
|
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
|
||||||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||||||
|
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…
Reference in New Issue