Talking chat bots, Captain Kirk, A.L.I.C.E.
An excerpt from 1000 questions every mobile assistant should be able to answer.
An ad that sounds like science fiction.
http://www.alicebot.org/superbot.html
Talking chat bots, Captain Kirk, A.L.I.C.E.
An excerpt from 1000 questions every mobile assistant should be able to answer.
An ad that sounds like science fiction.
http://www.alicebot.org/superbot.html
Using the Google speech API
(updated locally 1/21/2024 – changed binary path to sox for homebrew /opt/homebrew/bin/sox in [p call-google-speech]
Also changed some of the UI and logic for manual writing and sending.
(updated 1/21/2021)
This project demonstrates the Google speech-API. It records speech in Max, process it using the Google API, and displays the result in a Max [message] object.
https://github.com/tkzic/internet-sensors
folder: google-speech
sox: sox audio conversion program must be in the computer’s executable file path, ie., /usr/bin – or you can rewrite the [sprintf] input to [aka.shell] with the actual path. In our case we installed sox using Macports. The executable path is /opt/local/bin/sox – which is built into a message object in the subpatcher [call-google-speech]
get sox from: http://sox.sourceforge.net
note: this conversion may not be necessary with recent updates to Max and the Google speech API
Note: If you have a slow internet connection you may need to tweak the various delay times in the [call google-speech] sub patch.
Max [send] and [receive] objects pass data from this project to other projects that send Tweets from Max. Just run the patches at the same time.
Also, check out how this project is integrated into the Pandorabots chatbot API project
https://reactivemusic.net/?p=9834
Or anything else. The Google translation is amazingly accurate.
Speech recognition:
http://fennb.com/fast-free-speech-recognition-using-googles-in
Here’s a link to the manual for sox (audio converter)
This is an example of the curl command to run from the command line
curl \ --data-binary @test.flac \ --header 'Content-type: audio/x-flac; rate=16000' \ 'https://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&pfilter=2&lang=en-US&maxresults=6'
Ever wanted to connect your Legos and Tinkertoys together? Now you can — and much more. Announcing the Free Universal Construction Kit: a set of adapters for complete interoperability between 10 popular construction toys.
http://fffff.at/free-universal-construction-kit
Bi-directional communication from touchOSC to Arduino using an ethernet shield.
In this version, the Macbook is directly connected to the Arduino to provide a serial monitor for status updates.
How it works: press a toggle, or move a fader, in touchOSC – it sends a message to the Arduino which lights up, or fades, an LED – then sends back an OSC message to touchOSC to light up the toggle button. (note: local feedback should be off for the toggle button in touchOSC. This is the default)
https://github.com/tkzic/max-projects
folder: arduino-osc
***update 1/20/2016 there is a new sketch that uses the OSCuino library from CNMAT instead of ardosc. The sketches should be interchangeable. https://github.com/CNMAT/OSC . The sketch is in a folder called: OSCuino_tz and is based on work by Trippylightning at: http://trippylighting.com/teensy-arduino-ect/touchosc-and-arduino-oscuino/
Copy the OSC_ethernet_test1/ folder to Documents/Arduino. This puts it in the Arduino sketchbook.
The sketch uses: #include <ArdOSC.h>
Download ArdOSC from: https://github.com/recotana/ArdOSC
This post was the key to figuring out how to make this work: http://arduino.cc/forum/index.php?topic=137549.0
update 1/2016: A version of the Arduino sketch that uses a fixed IP instead of DHCP is located in the folder: OSC_ethernet_fixedIP/
The IP is set to 192.168.1.177 but you can change it to any valid address on your network.
// generic Arduino OSC program // works from Max or touchOSC // // plug LED into pin 5 (and gnd) // // requires ethernet shield // // use serial monitor to get the ip address // // use these OSC commands (will work from first page of touchOSC simple layout // // /1/fader1 // /1/toggle1 //
#include <SPI.h> #include <Ethernet.h> #include <ArdOSC.h>
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x0B, 0xCE }; //physical mac address
OSCServer server; OSCClient client;
int serverPort = 8000; //Touch OSC Port (outgoing) int destPort = 9000; //Touch OSC Port (incoming) int ledPin = 5; int flag=0;
void setup(){
pinMode(2, OUTPUT); Serial.begin(9600); Serial.println("DNS and DHCP-based OSC server"); // start the Ethernet connection: if (Ethernet.begin(mac) == 0) { Serial.println("Failed to configure Ethernet using DHCP"); // no point in carrying on, so do nothing forevermore: while(true); } // print your local IP address: Serial.print("Arduino IP address: "); for (byte thisByte = 0; thisByte < 4; thisByte++) { // print the value of each byte of the IP address: Serial.print(Ethernet.localIP()[thisByte], DEC); Serial.print("."); } Serial.println(); Serial.println();
//start the OSCserver server.begin(serverPort);
//add OSC callback function. One function is needed for every TouchOSC interface element that is to send/receive OSC commands. server.addCallback("/1/toggle1", &funcOnOff); server.addCallback("/1/fader1", &funcFader); }
void loop(){
if(server.aviableCheck()>0){ // Serial.println("alive! "); } }
//When the button on the TouchOSC inteface is pressed, a message is sent from the iDevice //to the Arduino to switch (togle) the LED on the Arduino on/off //then a messeage is sent bak from the Arduino to the iDevice to toggle the buttom on/off
void funcOnOff(OSCMessage *_mes){ float value = _mes->getArgFloat(0); //TouchOSC expects float values
//create new osc message OSCMessage newMes;
//set destination ip address & port no newMes.setAddress(_mes->getIpAddress(),destPort); newMes.beginMessage("/1/toggle1");
Serial.println(value); if(value < 1.0) { digitalWrite(ledPin, LOW); } else{ digitalWrite(ledPin, HIGH); }
newMes.addArgFloat(value);
//send osc message // // turn local feedback off on touch-osc control to test this client.send(&newMes);
}
// new callback for fader - using same comments //When the button on the TouchOSC inteface is pressed, a message is sent from the iDevice //to the Arduino to switch (togle) the LED on the Arduino on/off //then a messeage is sent bak from the Arduino to the iDevice to toggle the buttom on/off
void funcFader(OSCMessage *_mes){ float value = _mes->getArgFloat(0); //TouchOSC expects float values
//create new osc message OSCMessage newMes;
//set destination ip address & port no newMes.setAddress(_mes->getIpAddress(),destPort); newMes.beginMessage("/1/fader1");
Serial.println(value); int ledValue = value * 255.0; analogWrite(ledPin, ledValue);
newMes.addArgFloat(value);
//send osc message // // turn local feedback off on touch-osc control to test this client.send(&newMes);
}
http://www.tigoe.com/pcomp/code/arduinowiring/1135/#more-1135
from Tom Igoe
(update) I have got this working, exactly as described in the Igoe post – The code is in EthernetPachubeTweeter_tz1.
Essentially, anything that originates from the Arduino is sent to a feed in Pachube. That feed has a datastream which has a trigger which tweets any new data which arrives.
The next thing to try is figuring out whether this can be done as a single line http: request in curl, and therefore, from Max – or any other source
(update) – this is slightly broken – check out the post about converting cosm to xively https://reactivemusic.net/?p=6843]
by MikeGrusin at Sparkfun
Bi-directional wireless control of motors
tested 5/2014
The potentiometer on the control radio changes the motor speed of the RC car. A potentiometer on the other side controls the brightness of an LED at the controller.
The xbee code was adapted from Tom Igoe’s full-duplex Wireless example, chapter 6 – “Making Things Talk” (using an improved version from his blog: http://www.makingthingstalk.com/chapter6/30/#more-30
The xbee radios should be set up as directed – starting on p. 195
Here are the xbee settings:
ATMY | ATDL | ATDH | ATID | |
Radio 1 | 1234 | 5678 | 0 | 1111 |
Radio 2 | 5678 | 1234 | 0 | 1111 |
2 stacks:
1) arduino + wireless SD shield + xbee
2) arduino + motor shield + wireless SD shield + xbee (motor shield hooked to RC car motor)
Each stack has a potentiometer, tx/rx leds, LED for remote brightness control, and batteries.
The motor shield has connections to the RC car motor and 9V battery for power.
Code for radio 1: xbee_full_duplex2_radio1.ino
The motor side uses a few lines of code from an instructables.com motor shield tutorial. LED brightness is linked to motor speed – sent out on pin 3 – from the Arduino sketch:
http://www.instructables.com/id/Arduino-Motor-Shield-Tutorial/?ALLSTEPS
code for radio 2 (car): xbee_full_duplex2_radio2_motor.ino
When loading the sketch, set the slide switch on the Wireless-SD shield to ‘USB’ – then switch it back to “micro” to run.
If the controller radio (radio 1) is connected to a computer, open the Arduino serial monitor – or the sketch will block – and nothing will happen.
[wpdm_file id=20]
Re-assign some of the pins from the xbee example so they aren’t on the same ones as the motor shield is using: Here’s the pin layout that the motor shield uses. i.e.. these are the pins that are used in an Arduino sketch to control each motor function. This project only controls ‘speed’ on channel A (pin 3).
Function | Channel A | Channel B |
Direction | Digital 12 | Digital 13 |
Speed (PWM) | Digital 3 | Digital 11 |
Brake | Digital 9 | Digital 8 |
Current Sensing | Analog 0 | Analog 1 |
This Arduino forum post was also helpful – otherwise I would have assumed that the shields were incompatible:
Stacking Arduino Wifi Shield and Arduino Motor Shield