Hysen Labs
Open-source project
AndroidHensen/NDKVoice avatar
AndroidHensen

NDKVoice

【博客】AndroidStudio+CMake实现QQ变声效果

50 stars16 forksCLicense varies
01
DEEP OPEN-SOURCE ANALYSIS

NDKVoice: QQ-style voice effects via FMOD

A Chinese blog project that builds a voice changing effect on Android with Android Studio, CMake, and the NDK, piping audio through FMOD's pitch shift DSP.

02
DEEP OPEN-SOURCE ANALYSIS

What the project is

The repository backs a blog post on implementing a QQ-style voice changing effect on Android. The stack is Android Studio with CMake and the NDK, and the audio effect itself runs through the FMOD engine's system and sound APIs, with the project written in C. The blog framing matters here, because the repo is really a worked example rather than a reusable library, and the code follows the post's explanation step by step.

03
DEEP OPEN-SOURCE ANALYSIS

Setting up

Two prerequisites are listed. First, install ndk-build and cmake through the SDK Manager in Android Studio, so the build tooling is in place before any code is written. Second, download the Android platform source from FMOD's official download page, where the README notes you may need a VPN or to contact customer support to get at it. Both steps are spelled out so the environment part does not stall the project.

04
DEEP OPEN-SOURCE ANALYSIS

The FMOD flow

The code process is a short sequence of FMOD calls. Create the system with System_Create, then initialize it with 32 channels and the FMOD_INIT_NORMAL flag. Next, create a sound from a path string with the FMOD_DEFAULT flag, create a pitch shift DSP with createDSPByType, play the sound, and attach the DSP to the channel with addDSP so the effect applies to that stream. The last step closes the resources so the effect does not leak audio handles. That is the whole voice effect in outline, and the pitch shift is where the voice changing actually happens.

06
DEEP OPEN-SOURCE ANALYSIS

Official sources

07
Community notes

Community notes