Codementor Events

Setting up sample Agora Video Call project with voice effects for Android

Published Oct 22, 2021
Setting up sample Agora Video Call project with voice effects for Android

Agora is a great platform that provides many useful tools for real-time audio and video communications. In this tutorial we'll set up basic Android application for 1to1 video conversation with Voice Effects feature, that allows to modify audiostream in almost anything you want.

Step 1: Create Agora account and set up a project

Once you signed up, go to your agora console and navigate to projects page. Click "Create" button.

screenshot 2021-10-21 в 17.42.41.png

Then, enter your project name, use case and select "Secure mode: APP ID + token" as authentication method.
screenshot 2021-10-21 в 16.42.02.png

Step 2: Get your APP ID and generate temporary token.

From projects page get your app id and click on key sign to generate temporary token. To generate token, you need to enter a channel name. Save it.

Note, that your token is valid for only 24 hours.
screenshot 2021-10-21 в 17.44.16.png

Step 3: Set up sample project

Clone Agora basic video call repository and find the Basic-Video-Call/One-to-One-Video/Agora-Android-Tutorial-1to1 sample project. That's what we need.

Fill in the app/src/main/res/values/strings.xml file with the App ID and temporary token generated in Agora Console.

<string name="agora_app_id"><#YOUR APP ID#></string>
// Replace #YOUR ACCESS TOKEN# with your temporary token in the string format
<string name="agora_access_token">#YOUR ACCESS TOKEN#</string>

Next, we need to install our agora sdk.
Open app/build.gradle and add the following line to the dependencies list:

dependencies {
    ...
    implementation 'io.agora.rtc:full-sdk:3.5.1'
}

We're almost ready to start.
Change in joinChannel method 'demoChannel1' to your channel name from previous step.

You can launch your program from Android Studio and test it on real android device. You can use Demo to join your channel with both web and android devices and see if everything is working.

Step 4: Fun part. Voice effects.

Agora engine provides voice effects feature. You can Check the docs to see the list of voice effects you can apply.
For example, you can import build in constants like this:

...

import static io.agora.rtc.Constants.VOICE_CHANGER_EFFECT_OLDMAN;


...

and apply this voice effect in joinChannel method:

        mRtcEngine.setAudioEffectPreset(VOICE_CHANGER_EFFECT_OLDMAN);

Check short demo with one of the voice effects!)

Conclusion

With platforms like Agora you can in a few minutes set up a project and play around with some cool technologies. If this is not a future, I don't know what is!

Discover and read more posts from Sam Bocharov
get started
post comments1Reply
Alex Qasri
3 years ago

Such an amazing guide Man. Thanks for sharing. I want to share this guide on my blog https://pickleballmate.com/