How to change Frequency of Voice in Android | Techbirds
As everyone knows that every person has different voice. It all because of different frequency rate of different people. So we can change voice by changing frequency rate.
In android to change frequency we use “Soundpool“.
The SoundPool class manages and plays audio resources for applications. A SoundPool is a collection of samples that can be loaded into memory from a resource inside the APK or from a file in the file system. The SoundPool library uses the MediaPlayer service to decode the audio into a raw 16-bit PCM mono or stereo stream. This allows applications to ship with compressed streams without having to suffer the CPU load and latency of decompressing during playback.
Below I am writting a code that changes frequency of a recorded voice.
AudioManager audioManager = (AudioManager) getSystemService(AUDIO_SERVICE); float actualVolume = (float) audioManager.getStreamVolume(AudioManager.STREAM_MUSIC); float maxVolume = (float) audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC); float volume = actualVolume / maxVolume; SoundPool soundPool; // Is the sound loaded already? if (loaded) { soundPool.play(soundID, volume, volume, 1, 0, fspeed); Log.e(“Test”, “Played sound”);
}
Here, fspeed is Frequency speed change it from 0.5 to 2.5 for different voice
soundID is recorded sound file
2,427 total views, 1 views today
Share this On