Contents

Using Google speech API In Your iOS Application

 

1 Star2 Stars3 Stars4 Stars5 Stars (7 votes, average: 4.71 out of 5)
Loading...

 

Pham Van Hoang, hoangk55cd@gmail.com, is the author of this article and he contributes to RobustTechHouse Blog

 

Introduction

Unfortunately, if you want to start an iOS application with speech-recognition , unlike Android which comes with native development kit as supported by Google, there are no official APIs  supported by Apple at this time of writing.

If you have used Google services before, then you will know that the accuracy of Google’s speech recognition service is top notch. It is very accurate and supports online short utterances with no language model or vocabulary configuration. Sadly, there is no official Google Speech API support for iOS available, but there are work-arounds that we can deploy. You should note that this is available for development and personal use only.

Today, I am going to show you how to integrate Google Speech API in your application. In this article you’ll learn:

  • Google Speech API and how to request credentials key from Google.
  • How to integrate Google Speech API in your application.

[Video and Source Code]

Video:  https://www.youtube.com/watch?v=O_i54tj7jv8

Source code: SpeechAPIExample

[Google Speech API]

Host: https://www.google.com/speech-api/v2/recognize

Method: Post

Input:

lang: any valid locale (en-us, nl-be, fr-fr, etc.)

key: credentials key from Google. You’ll see you to get key bellow.

app: optional

output: json

Data:

FLAC

16-bit PCM

Headers: Content-Type (Ex: Content-Type: audio/x-flac; rate=44100;).  Make sure the rate in your header matches the sample rate you used for your audio capture.

You can find more about this API here from gillesdemey

 

Request credentials key from Google

  • First, make sure you are a member of chromium-dev@chromium.org . If not you can just subscribe to be chromium-dev and choose not to receive mail. The APIs are only visible to people subscribed to that group. gspeech_01
  • Make sure you are logged in with the Google account associated with the email address that you used to subscribe to chromium-dev.
  • Go to https://cloud.google.com/console
  • Click the blue Create Project button. And create your own project.
  • In a search box: Search for “Speech API” and enable the API. gspeech_02
  • Transfer to Credentials Key Screen , choose iOS platform and  add credentials to your own project

Now you have the credentials key of your own.

 

Integrating Google Speech API in your application

Now that you have all information needed to use the API, you just need to record the speech and send to the services through the API.

You can do your own class to record and handle the response. If you find that it take too much of your  time, you can see an example from this repository of mzeeshanid. However, this repository was deprecated and has some classes that are no longer needed. I have modified his repository just using SpeechToTextModule class. You can see the version I modified here.

Now, it’s time to integrate the module into your project.

Step1: You need to add SpeechToTextModule class and speex SDK to your project. gspeech_03

Step 2: Because this class is using non-arc, so make sure you mark the flag “-fno-objc-arc” in the header file of class SpeechToTextModule. gspeech_04 

Step 3: Replace your credentials key on GOOGLE_SPEECH_TO_TEXT_KEY line in SpeechToTextModule.m file. gspeech_05

Step 4: Import SpeechToTextModule  class and SpeechToTextModuleDelegate and create an instance. gspeech_06

Step 5: Create UI, in this project I just use a button to record/stop. And a background image behind the button to make an animation when recording the user speech (I have used an UIImage Category to display gif file). gspeech_07

 

Step 6: Handle record/stop action. When users tap button record, you need to start recording and also change the background button, start animating to notice user that your app is recording the speech. gspeech_08

Step 7: When user taps button again you need to stop recording and change the button background. The SpeechToTextModule class will send the data to Google server. gspeech_09

Step 8: Handle the data response in SpeechToTextModuleDelegate – – (BOOL)didReceiveVoiceResponse:(NSDictionary *)data by your own purposes. gspeech_10

You can see more in my example here: SpeechAPIExample. Hope you will find this post useful. If you have any questions, please leave the comments below. Thanks for reading.

 

References

https://github.com/mzeeshanid/iOS-Speech-To-Text

https://github.com/gillesdemey/google-speech-v2

 

Brought to you by the RobustTechHouse team (A top app development company in Singapore).  If you like our articles, please also check out our Facebook page.

Recommended Posts
Showing 42 comments
  • fallout 76 hacks

    Very interesting points you have remarked, appreciate it for putting up.

  • Kdhingra

    Thanks a ton!
    But I am having issue when using my google api key. Data is not showing.

  • Quickbooks error code 6123

    Learn how to fix the Quickbooks error code 6123. When a user is upgrading company files to a newly published version of QuickBooks Desktop, restoring a backup, or accessing a file on another computer, Quickbooks error code 6123 will occur.

  • QuickBooks Event Id 4

    Hey! Mind-blowing blog. Keep writing such beautiful blogs. In case you are struggling with issues on QuickBooks Event Id 4, dial QuickBooks Support Number. The team, on the other end, will assist you with the best technical services.

  • 에볼루션카지노

    Je ne suis pas vraiment un lecteur Internet pour être honnête mais vos blogs vraiment sympa, continue comme ça ! 에볼루션카지노 Je vais aller de l’avant et ajouter votre site à vos favoris pour revenir à l’avenir. advgamble.com

  • totosite

    I’ve been troubled for several days with this topic. totosite, But by chance looking at your post solved my problem! I will leave my blog, so when would you like to visit it?

  • Dave Jhone

    Luma 22 by TownX is a new development at Jumeirah Village Circle (JVC) that offers you studios, 1, 2, and 3-bedroom apartments with an attractive payment plan. Pleasantly cultivated like the getaway location where harmony and fun rule your existence. The concept offers supreme luxury to experience like a pro without any of the hassles of the establishment. A tranquil environment with natural components is created by the ideal fusion of luxury.

    Visit us-: https://invest-indubai.com/townx/townx-luma22-jvc-dubai

  • Lawyer For Bankruptcies

    your are a great author It’s contains many informative content filing chapter 7 bankruptcy in virginia
    keep write more article like this

  • useful article
    1st birthday wishes for baby boy from parents
    you can more images like this in my blog,

  • Nikita

    Like many other abstract concepts, happiness can have different definitions depending on human values ​​and life circumstances. The generally accepted http://valet.pp.ua definition of happiness is a state of emotional well-being, contentment, and enjoyment of life. For some people, happiness may be associated with achieving a goal or success in a career, for others – with love and close relationships, for others – with peace and harmony within oneself. Ultimately, happiness is an individual concept that each person defines for himself.

  • thanks for sharing.

  • mantra

    Hi
    Thanks for a marvelous posting! I really enjoyed reading it, you might be a great author.I will make certain to bookmark your blog and may come back in the foreseeable future.
    read more about latest movies :movierulz4

  • olivajohn

    Hi
    Thanks for a marvelous posting! I really enjoyed reading it, you might be a great author.
    read more :frameless shower doors

  • syntaxfix42

    Programming language questions and answers. Common questions include “Which programming language should I learn first?”, “What’s the difference between a compiled and interpreted language?”, and “How do I choose the right programming language for my project?”. Answers to these questions can help guide you in your coding journey and allow you to make informed decisions about the programming languages you choose to use. Additionally, staying informed about programming language updates and new features can help improve your skills and efficiency as a programmer. With the constant evolution of technology, it’s essential to stay current in the field of programming to remain competitive in the job market and to continue to develop innovative solutions that drive progress in the digital age.

  • baron corrz

    Hello everyone! Do you need help with an Epson printer not printing ? I will help you. I am a printer specialist working in customer support for the last 7 years. If you are facing issues or need any help, feel free to connect with me. I am always ready to help!

  • ARM Worldwide

    Thanks for sharing such great content. You know, #ARM Worldwide offers professional On Page SEO Audit to optimize your website’s performance. Their experts analyze content, meta tags, and on-page elements, providing valuable insights and recommendations for improved search engine visibility and user engagement.

  • Steve

    Thank you for sharing this article. Hey, I’m Mac Davis, a technical support specialist, and I can as sist you with https://www.quickbookstoolhub.co/blog/quickbooks-payroll-issues/. With my skills, I can quickly resolve any issues related to it, ensuring uninterrupted communications for individuals and businesses.

  • scsi cables

    “Wow, this article is incredibly informative! Integrating the Google Speech API into iOS applications opens up a world of possibilities for enhancing user experiences. The ability to convert spoken language into text not only improves accessibility but also introduces innovative ways to interact with apps.

  • Panying232

    Dear immortals, I need some inspiration to create https://www.wowtot.com

  • juitrew

    В нашем магазине хим товаров https://reaktivy.shop/ в Москве и по всей России мы предлагаем широкий выбор продуктов высокого качества, которые соответствуют самым строгим стандартам безопасности и эффективности. Мы предлагаем органические и неорганические реагенты, включая растворы и порошки, соли и кислоты различной концентрации и чистоты. Мы также предлагаем растворители для различных целей, включая промышленное использование, а также химические индикаторы, которые применяются для определения кислотности и щелочности растворов.

  • Panying232

    Dear Divines, I need some inspiration to create https://www.shanyicnc.com

  • Xexilian

    I really liked your article. Interesting and useful information. Thank you.

  • Panying232

    Dear Divines, I need some inspiration to create https://www.huigor-meshbag.com

  • Panying232

    Dear Divines, I need some inspiration to create https://www.food-ingredient.net

  • uodesxvn

    Dear immortals, I need some wow gold inspiration to create.

  • james joseph

    Need assistance with your assignments in Kuwait? Look no further! Our Assignment Help Kuwait Services are here to provide you with top-notch academic support. Get in touch with us for expert help in the English language.

  • nancy

    Looking for a reliable forklift rental service? We’ve got you covered! Our forklifts are well-maintained, and our rental process is hassle-free. Whether you need a forklift for a day or an extended period, we have flexible rental options to meet your needs. Contact us today for the best forklift rental service in town!

  • Bangalore Escorts Agency

    Your substance is completely splendid in many structures. I think this is amicable and educational material. I have gotten countless thoughts from your blog. Many thanks.

  • Do you need the perfect A’s but are unable to bear the workload or cannot comprehend the complex rules? No issue—we have everything to complete your essays request. Have time for your interests and self-improvement while “do my assignment online” service relieve you of the burden of university work and produce your essay request from scratch and at a price that is affordable for students. Since they were once where you are now—struggling with their own assignments—they started this company to assist students like you in succeeding. Send a request to have professional academic writers do your assignment to the best standard. The crew is happy to assist you at any moment. Day or night, chat with them online and they will try to answer all your queries do my economics assignment for me

  • A Traffic Lawyer in Nottoway, Virginia, is a legal professional specializing in addressing traffic-related legal matters in Nottoway County. These legal experts possess an in-depth knowledge of local and state traffic laws, offering crucial guidance to individuals facing traffic violations. They play a pivotal role in developing strategic defenses, negotiating with authorities, and representing clients in court to minimize penalties and protect their rights. In Nottoway, Virginia, Traffic Lawyers provide invaluable assistance, ensuring individuals receive expert legal counsel and support when confronting traffic offenses and working to achieve the best possible outcomes for their cases.

  • SMM Delhi

    This provides an excellent chance to investigate this website, and I’m thrilled to have discovered it. I’m grateful for the opportunity you’ve given us to take full advantage of this offer Online Social Media Marketing Course Delhi

  • duck life

    I appreciate you giving that knowledge. It is true that as of right now, Apple does not offer official APIs for iOS voice recognition. Nevertheless, voice recognition in iOS applications may be enabled using third-party frameworks and services. Although the iOS version of the Google Speech API is not officially supported, there are workarounds available, including the Microsoft Azure Cognitive Services Speech API and the Nuance Dragon Mobile SDK. It is important to consider the accuracy, security, and compliance of third-party libraries and services with applicable laws and regulations before using them.

  • rupikarai

    Excellent post! Really enjoyed your perspective and writing style. Looking forward to reading more. Keep up the fantastic work !sodala escort services

  • edhacare

    يقف مستشفى برجيل في أبوظبي شامخًا كمنارة للرعاية الصحية
    الاستثنائية في دولة الإمارات العربية المتحدة. تشتهر برجيل بتقنياتها الطبية المتطورة وفريقها من المهنيين المهرة، وتقدم خدمات رعاية صحية شاملة. من العلاجات المتخصصة في أمراض القلب وجراحة العظام والأورام إلى الإجراءات الجراحية المتقدمة ورعاية المرضى الرحيمة، يتفوق المستشفى في تقديم حلول الرعاية الصحية ذات المستوى العالمي. إن التزامها بالابتكار والرعاية التي تركز على المريض والنهج الشامل للرفاهية يجعل من برجيل خيارًا موثوقًا به للمرضى المحليين والدوليين على حدٍ سواء. مع التركيز على التميز، يواصل مستشفى برجيل أبوظبي وضع معايير في قطاع الرعاية
    الصحية، مما يضمن خدمات طبية لا مثيل لها.

    برجيل في أبوظبي شامخًا كمنارة للرعاية الصحية

Contact Us

We look forward to your messages. Please drop us a note for any enquiries and we'll get back to you, asap.

Not readable? Change text. captcha txt
NotificationPlatAndroid App Programming