DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • 4 Email Validation and Verification Techniques for App Developers
  • What Are Microservices Architecture and How Do They Work?
  • How to Secure Your APIs
  • No Code Expectations vs Reality

Trending

  • Unlocking AI Coding Assistants Part 2: Generating Code
  • My LLM Journey as a Software Engineer Exploring a New Domain
  • The 4 R’s of Pipeline Reliability: Designing Data Systems That Last
  • Building Scalable and Resilient Data Pipelines With Apache Airflow
  1. DZone
  2. Data Engineering
  3. Databases
  4. How to Implement a Voice Changer Capability

How to Implement a Voice Changer Capability

This article explains how to implement a voice changing function into an app.

By 
Jackson Jiang user avatar
Jackson Jiang
DZone Core CORE ·
Apr. 22, 22 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
5.3K Views

Join the DZone community and get the full member experience.

Join For Free

Research has shown that our voice is often an indicator of our personalities, and this is why we're so fascinated with changing our voice to make it sound more fun and uplifting in, for example, videos and live streams.

As a mobile developer, I have implemented a voice changing function into my own app, which you can try out in my demo. This function allows users to mask their voice using seven preset voices: seasoned, cute, male, female, monster, cartoon, and robots.

Voice Changer Demo


I don't want to brag, but I myself still find this function amazing. Let's move on to how it's developed.

Making Preparations

Ensure you have completed these steps first.

Configuring the Project

Set the app authentication information.

This can be set via an API key or access token.

  • Call setAccessToken during app initialization to set an access token. This only needs to be set once.
Java
 
HAEApplication.getInstance().setAccessToken("your access token");
  • Or, use setApiKey to set an API key during app initialization. This only needs to be set once.
Java
 
HAEApplication.getInstance().setApiKey("your ApiKey");

Calling the File API

Call the file API for the voice changer function, which is necessary for calling back the file API.

Java
 
private ChangeSoundCallback callBack = new ChangeSoundCallback() {
    @Override
    public void onSuccess(String outAudioPath) {
        // Callback when the processing is successful.
    }
    @Override
    public void onProgress(int progress) {
        // Callback when the processing progress is received.
    }
    @Override
    public void onFail(int errorCode) {
        // Callback when the processing fails.
    }
    @Override
    public void onCancel() {
        // Callback when the processing is canceled.
    }
};

Implementing the Voice Changer Capability

Call applyAudioFile to change the voice.

Java
 
// Change the voice.
HAEChangeVoiceFile haeChangeVoiceFile = new HAEChangeVoiceFile();
ChangeVoiceOption changeVoiceOption = new ChangeVoiceOption();
changeVoiceOption.setSpeakerSex(ChangeVoiceOption.SpeakerSex.MALE);
changeVoiceOption.setVoiceType(ChangeVoiceOption.VoiceType.CUTE);
haeChangeVoiceFile.changeVoiceOption(changeVoiceOption);
// Call the API.
haeChangeVoiceFile.applyAudioFile(inAudioPath, outAudioDir, outAudioName, callBack);
// Cancel the task of changing the voice.
haeChangeVoiceFile.cancel();

And now it's implemented. Easy, right? I hope this article can help you develop your own voice changer, and feel free to leave a comment if you want to learn more about my development journey.

API IT app authentication dev Indicator (metadata) mobile

Opinions expressed by DZone contributors are their own.

Related

  • 4 Email Validation and Verification Techniques for App Developers
  • What Are Microservices Architecture and How Do They Work?
  • How to Secure Your APIs
  • No Code Expectations vs Reality

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!