Created
February 9, 2020 12:27
-
-
Save troy-lamerton/7877277927b5be7e75e7d74f26403a30 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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