AudioUtil

object AudioUtil

Utility class for interacting with audio data.

Functions

Link copied to clipboard
fun boostPcm16Volume(pcm16Data: ByteArray, decibelBoost: Int): ByteArray

Increases the volume of PCM16 audio data. NOTE: This is for display purpose only and should NOT be performed on the audio file sent to the backend.

Link copied to clipboard
fun boostWavVolume(wavData: ByteArray, decibelBoost: Int, misnapMibiData: MiSnapMibiData? = null): ByteArray

Increases the volume of a WAV formatted audio data. NOTE: This is for display purpose only and should NOT be performed on the audio file sent to the backend.

Link copied to clipboard
fun getAudioBytesCount(duration: Long, sampleRate: Int): Int

Gets the audio size in bytes from a PCM16 formatted audio duration in milliseconds.

Link copied to clipboard
fun getAudioDuration(byteCount: Int, sampleRate: Int): Int

Gets the audio duration in milliseconds from the number of bytes of a PCM16 formatted data and its sample rate.

Link copied to clipboard
fun pcmToWav(pcmData: ByteArray, channelCount: Int, sampleRate: Int, bitsPerSample: Int, misnapMibiData: MiSnapMibiData? = null): ByteArray
fun pcmToWav(pcm16Samples: ShortArray, channelCount: Int, sampleRate: Int, bitsPerSample: Int, misnapMibiData: MiSnapMibiData? = null): ByteArray

Converts a PCM16 formatted data into WAV formatted data.