Skip to content

Instantly share code, notes, and snippets.

@julioz
Created October 27, 2019 11:57
Show Gist options
  • Save julioz/97fea2db0940962a23e9e58b209c199e to your computer and use it in GitHub Desktop.
Save julioz/97fea2db0940962a23e9e58b209c199e to your computer and use it in GitHub Desktop.
Audio Capture Record definition and configuration
val config = AudioPlaybackCaptureConfiguration.Builder(mediaProjection)
.addMatchingUsage(AudioAttributes.USAGE_MEDIA)
.build()
val audioFormat = AudioFormat.Builder()
.setEncoding(AudioFormat.ENCODING_PCM_16BIT)
.setSampleRate(8000)
.setChannelMask(AudioFormat.CHANNEL_IN_MONO)
.build()
audioRecord = AudioRecord.Builder()
.setAudioFormat(audioFormat)
.setAudioPlaybackCaptureConfig(config)
.build()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment