Skip to content

Instantly share code, notes, and snippets.

@troy-lamerton
Created February 9, 2020 12:27
Show Gist options
  • Save troy-lamerton/7877277927b5be7e75e7d74f26403a30 to your computer and use it in GitHub Desktop.
Save troy-lamerton/7877277927b5be7e75e7d74f26403a30 to your computer and use it in GitHub Desktop.
val sampleRate = 48000
val channelConfig = AudioFormat.CHANNEL_IN_MONO
val pcm16 = AudioFormat.ENCODING_PCM_16BIT
val pcmBufSize = AudioRecord.getMinBufferSize(
sampleRate,
channelConfig,
pcm16
) * 5
val fullAudioRecorder = AudioRecord.Builder()
.setAudioPlaybackCaptureConfig(audioPlaybackCaptureConfiguration)
.setAudioFormat(
AudioFormat.Builder()
.setSampleRate(sampleRate)
.setEncoding(pcm16)
.setChannelMask(channelConfig)
.build()
)
.setBufferSizeInBytes(pcmBufSize)
.build()
fullAudioRecorder.startRecording()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment