

HMS ML Kit offers great features to developers allowing them add big values to their projects. Each feature becomes an individual project especially when it comes to Language/Voice related kits.
The linguistic term “Transcription” means presenting a speech or conversation in a plain text form.
Transcription in the linguistic sense is the systematic representation of language in written form.
HMS ML Kit particularly comes with 2 different Audio Transcription SDKs for this great purpose.
- Audio File Transcription
- Real Time Transcription
In this article, I’ll be referencing Real Time Transcription using phone’s microphone as audio source. If you are looking to transcribe through audio files, please have a look at article below:
The Android application uses microphone as a source, and conveys audio data to HMS cloud, then Real Time Transcription engine returns text almost simultaneously.
I suggest you to clone this repository and practice it with a finished project.
If you’re a beginner, this part might look a bit complicated, but don’t worry, each step is very simple and clear. Let’s start to:
- Configure your Android Project and Integrate AppGallery resources. Follow the official guides of HMS:
2. Enable ML Kit Services for your app at Step-6
https://developer.huawei.com/consumer/en/codelab/HMSPreparation/index.html#0
3. Add dependency into your build.gradle (app)
dependencies{ // other dependenciesimplementation 'com.huawei.hms:ml-computer-voice-realtimetranscription:2.1.0.300'
}
4. Sync gradle with your project.
We have naturally limitations on Real Time Transcription. If you are planning to work over the limits, you might want to change your mind.
+---------------+---------+---------+--------+
| Location | Chinese | English | French |
+---------------+---------+---------+--------+
| Europe | √ | √ | √ |
| Russia | - | √ | - |
| Asia | √ | √ | √ |
| Africa | √ | √ | √ |
| Latin America | √ | √ | √ |
| China | √ | √ | - |
+---------------+---------+---------+--------++-----------+--------------+
| Engine | Max Duration |
+-----------+--------------+
| Real Time | 5 Hours |
+-----------+--------------++-------------------+
| Supported Devices |
+-------------------+
| Huawei Phones |
| Honor Phones |
+-------------------+
Pricing: HMS mostly provides monthly free quota for cloud services, or even most services are fully free in trial period. Real Time Transcription service is priced by February 11, 2021 with pay-as-you-go model.
| Free Quota | Price |
|------------------|---------------------|
| 60 minutes/month | EUR0.003/15 seconds |
Service Pricing and Subscription
Let’s finally get into development. Firstly, we need to declare permissions:
Declare variables:
Inside onCreate :
Engine start/stop methods, suitable for a button click listener:
Declare the rttListener in order to process response data:
Perfect! We achieved to make it. Now we are able to transcribe human voice in real time!
References:
- HMS ML Kit Real Time Transcription: