wlanjie / trinity

android video record editor muxer sdk
Apache License 2.0
892 stars 271 forks source link

Changing from AudioRecord to Superpowered SDK for audio recording #132

Open priyankjain12 opened 3 years ago

priyankjain12 commented 3 years ago

Hi, I have changed the recording functionality of the application form using the AudioRecord to the Superpowered SDK as it's faster than the default AudioRecord. Now the thing is that I have initialized the "record_processor.cc" file in c++ with this sample rate and buffer size in the "AudioRecordRecorderServiceImpl.kt" file.

        val audioManager =
            context.getSystemService(AppCompatActivity.AUDIO_SERVICE) as? AudioManager
        if (audioManager != null) {
            sampleRateString = audioManager.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE)
            bufferSizeString =
                audioManager.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER)
        }
        if (sampleRateString == null) sampleRateString = "48000"
        if (bufferSizeString == null) bufferSizeString = "480"
        val sampleRateInt = sampleRateString.toInt()
        val bufferSizeInt = bufferSizeString.toInt()

        recordProcessor = AudioRecordProcessor()
        recordProcessor?.initAudioBufferSize(sampleRateInt, bufferSizeInt, speed)

After integrating the Superpowered SDK, I am able to run the project and do the actual recording but the recorded video has distorted audio or we can say that there is much noise in the produced video. So is there any way to solve this issue? Can you please guide me here?

I am attaching your project with superpowered SDK as a reference to what I have done.

You can check the "Android_JNI_audio_record_processor_init" and "Android_JNI_audio_record_processor_flush_audio_buffer_to_queue" method from the trinity_jni.cc to see my implementation of the Superpowered SDK.

So can you please guide me or help me in removing the noise in the recorded video.

Trinity with the superpowered project - https://drive.google.com/file/d/109L5As8MvOGkmadZn-RqJAMSreH8AazL/view?usp=sharing

Short link - http://bit.ly/trinitysuper