Post Processing
getPresetsNames
The method String[] VoicemodSDK.getPresetsNames() give you an array with the current voices names.
Convert methods
Given an audio or video file, the convert methods give you the possibility to generate a new file with audio modified. Indicating in the voiceName parameter any of the values returned by getPresetsNames.
VoicemodSDK.convertAudio( Uri source, String voiceName, ConvertListener handler)
1 2 3 4 5 6 7 8 9 10 11 12 |
// Example of convertAudio call using file from assets folder. VoicemodSDK.convertAudio( Uri.parse("file:///android_asset/" + filename), "alien", new VoicemodSDK.ConvertListener() { public void onCompleted(String error, Uri audioOutputPath) { // Check possible error if (error == null) { // Play, send, share the audio file with path audioOutputPath } else { Log.d("ERROR", error); } } }); |
VoicemodSDK.convertVideo( Uri source, String voiceName, ConvertListener handler)
1 2 3 4 5 6 7 8 9 10 11 12 |
// Example of convertVideo call using file stored on file system. VoicemodSDK.convertVideo( Uri.parse("file:///" + filepath + "/" + filename), "alien", new VoicemodSDK.ConvertListener() { public void onCompleted(String error, Uri videoOutputPath) { // Check possible error if (error == null) { // Play, send, share the video file with path videoOutputPath } else { Log.d("ERROR", error); } } }); |
ConvertListener handler
When the audio or video has been processed, a call will be made to the method:
1 |
ConvertListener.onCompleted(String error, Uri audioOutputPath) |
In the audioOutputPath argument is the path where the modified file was stored.
This call is made in a thread other than UiThread, so if the action modifies the interface a call to runOnUiThread should be made.
Uri source
In the source parameter we specify the source path of the file to be modified.
Currently supported sources are:
- File system files, with structure file://$FILE_PATH.
Example: file:///data/user/0/net.voicemod.android.voicemodsdkexample/files/Video_SDK.mp4 - Files in the assets folder, with the structure file:///android_asset/$ASSET_PATH
Example: file:///android_asset/demo-offline.m4a
Convert supported formats
The convert supported formats are the ones specified in the next url:
https://developer.android.com/guide/topics/media/media-formats.html
For example, you can record audio with the classes of the Android SDK, as shown in this example:
https://developer.android.com/guide/topics/media/mediarecorder.html#example
For best quality conversions sample rate must be changed to 44100 or 48000.
1 |
mRecorder.setAudioSamplingRate(44100); |
On future releases we are going to support more sample rates doing resampling.