Nailik / AndroidResampler

This is a simple Audio Resampler using Oboe Resampler in order to change Channel and SampleRate live.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android Resampler

This is a simple Audio Resampler using Oboe Resampler in order to change Channel and SampleRate.

How to Use

  • Add to dependencies
implementation("io.github.nailik:androidresampler:0.1")
  • create the Configuration with input and output settings.
val configuration = ResamplerConfiguration(
    quality = ResamplerQuality.BEST,
    inputChannel = ResamplerChannel.STEREO,
    inputSampleRate = 441800,
    outputChannel = ResamplerChannel.MONO,
    outputSampleRate = 16000
)
  • create the resampler, this also creates the OboeAudioProcessor
val resampler = Resampler(configuration)
  • to convert audio send in a ByteArray and you get back a ByteArray
  • Note: in case of same input and output configuration the input ByteArray is just send back directly
val data: ByteArray = resampler.resample(recordedAudio)
  • dispose the resampler when finished, note it cannot be used anymore afterwards
  • isDisposed can be used to check if resampler was disposed already
resampler.dispose()
val isDisposed = resampler.isDisposed

About

This is a simple Audio Resampler using Oboe Resampler in order to change Channel and SampleRate live.


Languages

Language:C++ 57.1%Language:Kotlin 39.2%Language:CMake 2.6%Language:C 1.1%