저전력 블루투스 (BLE) 오디오를 기반으로 하는 블루투스 오디오 프로필
고품질 오디오 (예: 스테레오 오디오)의 양방향 스트리밍 허용
(샘플링 레이트 32kHz) 이는 LE API를 사용한 덕분에 가능해졌습니다.
등시 채널 (ISO). ISO는 동기 연결 지향적 프로토콜과 유사함
(SCO) 예약된 무선 대역폭도 사용하지만 대역폭은
예약이 더 이상 64Kbps로 제한되지 않으며 동적으로 조정할 수 있습니다.
블루투스 오디오 입력은 최신
거의 모든 용도에 적합한 AudioManager API
전화 통화는 제외됩니다. 이 가이드에서는 YouTube TV에서 스테레오 오디오를 녹음하는 방법을
BLE 오디오 히어러블입니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-08-18(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-18(UTC)"],[],[],null,["# Audio recording\n\nBluetooth audio profiles based on Bluetooth Low Energy (BLE) Audio\nallow bidirectional streaming of high quality audio (for example, stereo audio\nwith a 32 kHz sampling rate). This is possible thanks to the creation of the LE\nIsochronous Channel (ISO). ISO is similar to the Synchronous Connection-Oriented\n(SCO) Link because it also uses reserved wireless bandwidth, but the bandwidth\nreservation is no longer capped at 64 Kbps and can be dynamically adjusted.\n\nBluetooth audio input can use the latest\n[AudioManager API](/reference/android/media/AudioManager) for nearly all use\ncases, excluding phone calls. This guide covers how to record stereo audio from\nBLE Audio hearables.\n\nConfigure your application\n--------------------------\n\nFirst, configure your application to target the correct SDK in `build.gradle`: \n\n targetSdkVersion 31\n\nRegister audio callback\n-----------------------\n\nCreate an\n[`AudioDeviceCallback`](/reference/android/media/AudioManager#registerAudioDeviceCallback(android.media.AudioDeviceCallback,%20android.os.Handler))\nthat lets your application know of any changes to connected or disconnected\n`AudioDevices`. \n\n final AudioDeviceCallback audioDeviceCallback = new AudioDeviceCallback() {\n @Override\n public void onAudioDevicesAdded(AudioDeviceInfo[] addedDevices) {\n };\n @Override\n public void onAudioDevicesRemoved(AudioDeviceInfo[] removedDevices) {\n // Handle device removal\n };\n };\n\n audioManager.registerAudioDeviceCallback(audioDeviceCallback);\n\nFind BLE Audio Device\n---------------------\n\nGet a list of all connected audio devices with input supported, then use\n[`getType()`](/reference/android/media/AudioDeviceInfo#getType()) to see if\nthe device is a headset using\n[`AudioDeviceInfo.TYPE_BLE_HEADSET`](/reference/android/media/AudioDeviceInfo#TYPE_BLE_HEADSET). \n\n### Kotlin\n\n```kotlin\nval allDeviceInfo = audioManager.getDevices(GET_DEVICES_INPUTS)\nvar bleInputDevice: AudioDeviceInfo? = null\n for (device in allDeviceInfo) {\n if (device.type == AudioDeviceInfo.TYPE_BLE_HEADSET) {\n bleInputDevice = device\n break\n }\n }\n```\n\n### Java\n\n```java\nAudioDeviceInfo[] allDeviceInfo = audioManager.getDevices(GET_DEVICES_INPUTS);\nAudioDeviceInfo bleInputDevice = null;\nfor (AudioDeviceInfo device : allDeviceInfo) {\n if (device.getType() == AudioDeviceInfo.TYPE_BLE_HEADSET) {\n bleInputDevice = device;\n break;\n }\n}\n```\n\nStereo support\n--------------\n\nTo check if stereo microphones are supported on the selected device, see if the\ndevice has two or more channels. If the device only has one channel, set the channel mask to mono. \n\n### Kotlin\n\n```kotlin\nvar channelMask: Int = AudioFormat.CHANNEL_IN_MONO\nif (audioDevice.channelCounts.size \u003e= 2) {\n channelMask = AudioFormat.CHANNEL_IN_STEREO\n}\n```\n\n### Java\n\n```java\nif (bleInputDevice.getChannelCounts() \u003e= 2) {\n channelMask = AudioFormat.CHANNEL_IN_STEREO;\n};\n```\n\nSet up the audio recorder\n-------------------------\n\nAudio recorders can be set up using the standard `AudioRecord` builder.\nUse the channel mask to select stereo or mono configuration. \n\n### Kotlin\n\n```kotlin\nval recorder = AudioRecord.Builder()\n .setAudioSource(MediaRecorder.AudioSource.MIC)\n .setAudioFormat(AudioFormat.Builder()\n .setEncoding(AudioFormat.ENCODING_PCM_16BIT)\n .setSampleRate(32000)\n .setChannelMask(channelMask)\n .build())\n .setBufferSizeInBytes(2 * minBuffSizeBytes)\n .build()\n```\n\n### Java\n\n```java\nAudioRecord recorder = new AudioRecord.Builder()\n .setAudioSource(MediaRecorder.AudioSource.MIC)\n .setAudioFormat(new AudioFormat.Builder()\n .setEncoding(AudioFormat.ENCODING_PCM_16BIT)\n .setSampleRate(32000)\n .setChannelMask(channelMask)\n .build())\n .setBufferSizeInBytes(2*minBuffSizeBytes)\n .build();\n```\n\nSet preferred device\n--------------------\n\nSetting a preferred device informs the audio `recorder` which audio device\nyou wish to record with. \n\n### Kotlin\n\n```kotlin\nrecorder.preferredDevice = audioDevice\n```\n\n### Java\n\n```java\nrecorder.setPreferredDevice(bleInputDevice);\n```\n| **Note:** The user can manually override this preference in device settings.\n\nNow, you can record audio as outlined in [the MediaRecorder guide](/guide/topics/media/mediarecorder)."]]