Boemo is a software developer who embraces innovative approaches. He likes diving deep into complex concepts in order to learn and write articles that can help the reader understand complex methodologies in a simple and fun way.

Not everyone likes the sound of their voice. Many people feel nervous or don't join video calls because they feel that their voices are horrible. Fortunately, Agora has a solution for those users. Agora gives you the ability to alter your voice by converting it to a voice you like or by beautifying the voice. This is a fun feature that can make your video calls more enjoyable.

In this tutorial, we will learn how to alter (voice conversion) and beautify the voice using the Agora Android SDK.

Prerequisites
  • An Agora developer account (Sign up here).
  • Knowledge of how to create a live-streaming Android application using Agora. Check out the tutorial here.
  • Basic knowledge of Android development.
  • Android Studio.
Adding dependencies in Gradle

Add the following dependencies in your build.gradle in the app module, and sync to download the Agora third-party library. Ensure that you always use the latest Agora library version:

Adding permissions in the Manifest.xml file

Go ahead and add the following permissions in the Manifest.xml file:

Creating an instance of the RtcEngine

Now, let's create an RtcEngine instance by initializing the RtcEngine, and pass the IRtcEngineEventHandler and your App ID to the create method. IRtcEngineEventHandler is an abstract class that provides the default implementation:

Setting the client as a broadcaster

Next, we will set the channel profile as CHANNEL_PROFILE_LIVE_BROADCASTING and set the client role as CLIENT_ROLE_BROADCASTER. We do this because the user has to send and receive streams. You can set the channel profile as an audience if you want the user to receive streams only:

Beautifying the voice

The setVoiceBeautifierPreset takes in the beautifying value. The function then alters and sets the voice of the user as beautiful based on the beautifying value chosen. By default, the beautifying value will be off, VOICE_BEAUTIFIER_OFF. The voice beautifier makes the user's voice beautiful without changing the original voice:

Converting the voice of the user

Converting the voice of the user completely alters the voice of the speaker. Listeners will not be able to recognize the broadcaster's voice. This is a great feature for users who want to remain anonymous or who don't have confidence in their voice.

The setVoiceConversionPreset function takes in the voice conversion value. We will use this function to convert the voice of the user:

Testing the demo

In the demo below, we will test our source code by changing the voice of the user speaking to a bass voice.

Summary

In this tutorial we have learned how to:

  • Beautify the voice of the user
  • Completely change the voice of the user
  • Set a client as a broadcaster and create an instance of the RTC engine
Conclusion

Cheers, you now know how to change and beautify the user's voice!

Thank you for reading. You can learn more on how to alter the user's voice here and also check out more Agora features on GitHub here. If you want to copy or reference the SDK I was using, check it on GitHub here.

Other resources

If you are getting confused in the process, you can check out Agora's documentation. You can also join Agora's Slack channel here.

Want to build Real-Time Engagement apps?

Get started with 10,000 free minutes today!

If you have questions, please call us at 408-879-5885. We'd be happy to help you add voice or video chat, streaming and messaging into your apps.

Attachments

  • Original Link
  • Original Document
  • Permalink

Disclaimer

Agora Inc. published this content on 24 November 2021 and is solely responsible for the information contained therein. Distributed by Public, unedited and unaltered, on 24 November 2021 17:59:01 UTC.