3

I am developing an iOS application with voice recognition functionality. I found the way to use Google Web Speech API for voice recognition and text-to-speech purposes. It works fine. I am wondering if it is legal to use Google Web Speech API in an iOS application? Also are there any limits of usage for this API? I tried to find any terms of service for it, but could not find any.

Kara
  • 6,115
  • 16
  • 50
  • 57
user2618662
  • 41
  • 1
  • 2

2 Answers2

3

Record your voice with standard ios format (example mpeg4). Convert your recording in flac format (you cannot do this inside xcode, I used a php service with ffmpeg command). Then call google service with the following code:

NSMutableURLRequest *urlGoogleRequest = [[NSMutableURLRequest  alloc]initWithURL:urlGoogle];
[urlGoogleRequest setHTTPMethod:@"POST"];
[urlGoogleRequest addValue:@"audio/x-flac; rate=16000" forHTTPHeaderField:@"Content-Type"];
NSURLResponse* response = nil;
            NSError* error = nil;
[urlGoogleRequest setHTTPBody:audioDataFlac];
NSData* googleResponse = [NSURLConnection sendSynchronousRequest:urlGoogleRequest
                                                 returningResponse:&response
                                                             error:&error];
id jsonObject=[NSJSONSerialization JSONObjectWithData:googleResponse options:kNilOptions error:nil];

Example response from google:

{ "status": 0, "id": "b3447b5d98c5653e0067f35b32c0a8ca-1", "hypotheses": [ { "utterance": "i like pickles", "confidence": 0.9012539 }, { "utterance": "i like pickle" }] }

This method is not very straight-forward, anyway it works for me. Remember that google speech recognition is valid only for test purpose.

Good Luck!

Mobiletainment
  • 22,201
  • 9
  • 82
  • 98
  • hey i succeeded in doing so... i recorded audio in lpcm format and converted wav to flac using cpp methods in code and then passed that flac to google speech to text api in ios7. But it does not respond for ios8 any guideline for this... please suggest.. – Mak13 Oct 13 '14 at 14:30
  • Upvote for innovation. I am researching how speech recognition alternatives with custom vocabularies. NOT Nuance, technical support is terrible, I found a big bug, reported it and they havent been able to fix it, so I am going solo. If you are doing something similar we can share ideas. – Josh Aug 25 '15 at 09:21
  • @Josh did you find any answers ? I too am fed up with nuance, just awful support. I wouldn't mind setting up our own server if thats the way to go – qbert65536 Jan 06 '16 at 20:07
  • @qbert65536 The answer above is the closest thing, but sending submitting that Flac file to Google's server proved impossible at least for me. In the end the company where I work will work with Verbio and Voci, two corporate SpeechRecon/Text2speech providers. I was indeed able to upload wav files to Verbio and Voci. If you can ask them to setup a sandbox server for you, I can help you with the implementation. – Josh Jan 07 '16 at 13:49
-1

It depends on the type of application you would like to develop. But generally it is not very easy to use this API for an iOS application.