Do you want use google speech api to recognize text from a dictate?

If you want to add in your “test” project, (test project because it’s not a public API), you need to read Chrome Browser source code.
Here chromium url: src.chromium.org/viewvc/chrome/trunk/src/content/browser/speech
Chrome records audio chunks, accepts only a FLAC file, an open source audio codec (free lossless audio codec) file with a sample rate of 16000.0!
After upload to server:
https://www.google.com/speech-api/v1/recognize
and server responds with a json like this:
1 2 3 4 5 6 7 8 9 10 11 12 | { "status": 0, "id": "f3847b5dcu4d657f6667f3pk4sc0a8ca-2", "hypotheses": [ { "utterance": "it works", "confidence": 0.8012238 }, { "utterance": "it works" }] } |
Now, using ASIFormDataRequest we can send in POST a file to google url waiting for JSON.
Objective-c code:
1 2 3 4 5 6 7 8 9 10 11 12 13 | - (void) SpeechFromGooglezzz { NSURL *url = [NSURL URLWithString:@"https://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&lang=en-US"]; ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url]; NSString *filePath = [NSString stringWithFormat:@"%@%@", [[NSBundle mainBundle] resourcePath], @"tmpAudio.flac"]; NSData *myData = [NSData dataWithContentsOfFile:filePath]; [request addPostValue:myData forKey:@"Content"]; [request addPostValue:@"audio/x-flac; rate=16000" forKey:@"Content-Type"]; [request startSynchronous]; NSLog(@"req: %@", [request responseString]); } |
But now is there a big problem… objective-c and iphone don’t recognize FLAC files, you need an intermediate passage to send the correct audio file.
Set up your server with FFMPEG (an audio/video converting/editing tool) and prepare a PHP/JSP/etc. that accept in post an audio file, call a PHP EXEC and launch ffmpeg with flac codec.
Then upload from server to google and return response!
Here code to record and listen audio file from iPhone. Create two buttons and copy/paste code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | - (IBAction)StartRec:(id)sender { NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithFloat: 16000.0], AVSampleRateKey, [NSNumber numberWithInt: kAudioFormatMPEGLayer3], AVFormatIDKey, [NSNumber numberWithInt: 1], AVNumberOfChannelsKey, [NSNumber numberWithInt: AVAudioQualityMax], AVEncoderAudioQualityKey, nil]; NSError *error; NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@%@", [[NSBundle mainBundle] resourcePath], @"tmpAudio.mp3"]]; recorder = [[AVAudioRecorder alloc] initWithURL:url settings:settings error:&error]; if (recorder) { [recorder prepareToRecord]; [recorder record]; } else NSLog(@"%@", [error description]); } |
1 2 3 4 5 6 7 8 9 10 11 12 | - (IBAction)PlayAudio:(id)sender { NSString *path = [NSString stringWithFormat:@"%@%@", [[NSBundle mainBundle] resourcePath], @"tmpAudio.mp3"]; SystemSoundID soundID; NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO]; AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID); AudioServicesPlaySystemSound(soundID); } - (IBAction)StopRec:(id)sender { if (recorder) [recorder stop]; } |
That’s all, enjoy!
…and remember that speech function of google it’s a private API. You can’t use in a commercial app!
A very easy project this morning!
A robotic – automatic notifier for google plus with an arduino, a servo motor and an… icecream box! (plus.google.com)!

How it works?
A c# tool call and parse this url: https://plus.google.com/u/0/_/n/guc, that returns, as response, a txt file called response.txt that contains these informations:
)]}’ ["on.uc",2,300,"101932929612066440630"]
after “on.uc” we can see number 2. The number of notifications!
Google notification url was found reading html page of google+ login. “On Success“, open url. To show you if there are any notifications.
Yes!

Google si è ricordato di me e mi ha dedicato la sua home page + il mio profilo con gli auguri di compleanno!!!
cliccando sul logo… appaiono le striscioline colorate e i coriandoli che cadono nella pagina e si muovono con il mouse!
Che storia!
Bravi!
I’m happy!
Do you want an mp3 without use emule or torrents client, but simply typing in google?
Easy!!!

Copy and paste the code, to google search box!:
Only for MP3:
-inurl:(htm|html|php) intitle:”index of” +”last modified” +”parent directory” +description +size +(.mp3) “vasco”
Only for MP3, WMA, OGG:
-inurl:(htm|html|php) intitle:”index of” +”last modified” +”parent directory” +description +size +(.mp3|.wma|.ogg) “vasco”
It grub only a FTP public list of files mp3!
Replace “vasco” with you favourite singer!
If you replace MP3 with AVI, you can get videos of Vasco!
it’all!
Rif: albertopasca.it
Semplicemente geniali!!!
Attivate il volume…
Da notare il tasto “INSERT COIN” anzichè “Mi sento fortunato” che permette di giocare in due con i tasti A S D W!
e non è il logo statico solito…ma si può giocare!!!
…e con insert coin si gioca in multiplayer!
Fatto in HTML5 probabilmente e Javascript (jquery). Audio in flash….
Non avete fatto in tempo a trovarlo sulla home page… volete provarlo??? Dai ok… cliccate qui allora!
applausi applausi applausi!





