Forum des Objets Communicants et Solutions pour les Libérer...
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.

Forum des Objets Communicants et Solutions pour les Libérer...


 
AccueilAccueil  GalerieGalerie  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  Connexion  
Le Deal du moment :
Cartes Pokémon : la prochaine extension ...
Voir le deal

 

 SOLVED: English TTS from NabAlive (and possibly other languages)

Aller en bas 
2 participants
AuteurMessage
gjd
Lapin nain
Lapin nain



Localisation : London
Nbr de messages : 1
Carottes : 4171

SOLVED: English TTS from NabAlive (and possibly other languages) Empty
MessageSujet: SOLVED: English TTS from NabAlive (and possibly other languages)   SOLVED: English TTS from NabAlive (and possibly other languages) Icon_minitimeJeu 20 Déc 2012 - 19:29

Up until the Violet platform was switched off, we were using our Nabaztag to read out alarms from our Nagios monitoring system. Since NabAlive came about I've been looking to set this back up again, but only having French TTS was causing our English status messages to be somewhat unintelligable.

I decided to have another look at this as we've got a platform change freeze at the moment, and it's much easier to do than I was expecting. It turns out Google Translate has a text to speech facility where you can send it a string and it returns an MP3, here's an example:

http://translate.google.com/translate_tts?ie=UTF-8&tl=en&q=Hello+World

You can paste this directly into the TTS box in the nabaztag.com actions interface, and the MP3 returned is read out by your Nabaztag.

But if you want to script this, pasting into a browser isn't much use, so here is what happens behind the scenes when you submit the URL:

http://www.nabaztag.com/nabaztags/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/play?url=http%3A%2F%2Ftranslate.google.com%2Ftranslate_tts%3Fie%3DUTF-8%26tl%3Den%26q%3Dhello%2Bworld

where xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx is the API key for your rabbit.

This lead on to me putting together a quick script in Perl to do the encoding and post the request for me:

Code:
#! /usr/bin/perl

# send_nabaztag_tts.pl - Provides English Text to speech for your Nabaztag on the NabAlive platform via Google Translate
# (C)2012 Gareth Davis - No rights reserved - This script is freely distributable

use LWP;
use HTTP::Request::Common;
use URI::Escape;

my $browser = LWP::UserAgent->new;

if  ( @ARGV[0] eq "" || @ARGV[1] eq "" )
{
    die "USAGE: $0 Token Message\n";
}


my $token = @ARGV[0];
my $text = @ARGV[1];

my $baseurl='http://www.nabaztag.com/nabaztags/'.$token.'/play?url=http%3A%2F%2Ftranslate.google.com%2Ftranslate_tts%3Fie%3DUTF-8%26tl%3Den%26q%3D';
my $encodedtext = uri_escape($text);

$encodedtext=~s/%20/%2B/gi;

$url = $baseurl.$encodedtext;
print "Requesting $url\n";
my $response = $browser->get( $url );

if (!$response->is_success) {
        print "FAIL: ".$response->content;
}

You then call the Perl script with:
Code:
send_nabaztag_tts.pl  xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx "Hello World"
I worked this out by sniffing the web transactions going backwards and forward between the web browser and nabaztag.com, so this probably isn't officially supported. I did try using the official API, but kept getting Error 500 messages for reasons I didn't understand.

Although the Google Translate TTS API is in beta, it supports a number of languages other than English. You would need to play with the tl=en perameter in the URL to switch to another language.

Enjoy!
Revenir en haut Aller en bas
jpp77350
Red Kryptonite Nabz
Red Kryptonite Nabz
jpp77350


Age : 58
Localisation : 77 LE MEE SUR SEINE
Nabaztag : CRISTAL77 & ANDROID V2
Nbr de messages : 10713
Carottes : 13564

SOLVED: English TTS from NabAlive (and possibly other languages) Empty
MessageSujet: Re: SOLVED: English TTS from NabAlive (and possibly other languages)   SOLVED: English TTS from NabAlive (and possibly other languages) Icon_minitimeJeu 20 Déc 2012 - 21:10

thank's anyway for the job and investigations!
All the tips & tricks, to keep alive and go on, our beloved rabitt's are welcome! SOLVED: English TTS from NabAlive (and possibly other languages) Svp
Revenir en haut Aller en bas
 
SOLVED: English TTS from NabAlive (and possibly other languages)
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» SOLVED: Apple's devices wifi + Nabaztag
» Unofficial English forums - All english all the time :-)
» Unofficial English forums - All english all the time :-)
» Rabbit all green except middle light
» [SOLVED] microphone broken? solid red lights

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Forum des Objets Communicants et Solutions pour les Libérer... :: IV. I Don't Speak French! :: NabAlive, the New Official server for your Nabaztag:tags-
Sauter vers: