Created
October 27, 2019 11:57
-
-
Save julioz/97fea2db0940962a23e9e58b209c199e to your computer and use it in GitHub Desktop.
Audio Capture Record definition and configuration
This file contains 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 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