[Huawei Developers] Martin Bieber:
I. Background

1. Pain Points

l Portability: When broadcasting live in outdoor spaces, or recording vlogs, users have to carry around cumbersome recording equipment.

l Quality: The recording quality of a phone's microphone deteriorates the further the user gets from the phone.

l Convenience: Usage scenarios of wired headsets and microphones are restricted by their wires.

l Functionality: The headset monitoring feature (also known as the karaoke feature) is available on wired headsets, but is not yet supported on Bluetooth headsets.

2. Opportunities

l More freedom when shooting: Sound pickup at a distance of X meters.

l More true-to-life sound: High-quality audio at 48 kHz/16 bit.

l Dedicated feature: Audio Kit provides a customized headset monitoring effect for Bluetooth headsets.

3. Competing Products

l Mainstream True Wireless Stereo (TWS) headsets do not support general audio and video recording, and can only be used for phone calls.

l SmartMike+ is a dedicated TWS microphone which will be launched in October.

l Xiaomi's Bluetooth headset supports the Bluetooth karaoke function, but it is enabled by default, and can only be controlled by a dedicated APK.

​

II. Analysis of the Current Market

The development of the recording function and karaoke feature for Bluetooth headsets is still in progress. APKs in the market have not adapted to the two functions:

l Bluetooth HD recording is not yet available because the source of the Bluetooth HD recording is limited to DEFAULT, MIC, or CAMRECORD, and AudioManager.isBluetoothScoOn() cannot be set up.

l The Bluetooth karaoke feature is not yet available because it is provided to third-party apps via Audio Kit, and limited to wired headsets. If a Bluetooth headset is connected, a message should appear asking if the user wants to enable the karaoke feature, so adaptation is required for third-party apps. APIs of Audio Kit will be provided so that common Bluetooth headsets can be adapted.

III. Advanced Features of Huawei Bluetooth Headset

Selected Huawei Bluetooth headsets support recording at 48 KHz, as well as the headset monitoring (karaoke) feature. The 48 KHz Bluetooth recording feature enables high-quality audio recording, and saves high-frequency audio information as high-fidelity sound files, which makes the audio quality more natural and true-to-life. The Bluetooth headset's karaoke feature is designed to provide a real-time headset monitoring effect that was once only available to wired headsets. To bring these functions to your app, you will need to make some adaptations:

1. Detect the connection of the Bluetooth headset and obtain its advanced features;

2. Query whether the currently connected Bluetooth headset supports 48 KHz audio recording;

3. Use the corresponding API to perform 48 KHz recording;

4. Query whether the currently connected Bluetooth headset supports the karaoke feature;

5. Configure the karaoke feature by using related APIs.

3.1 Detecting Bluetooth Headset Connection and Obtaining Advanced Features

1. Use the following API to check whether a Bluetooth headset is connected:

public void registerAudioDeviceCallback(AudioDeviceCallback callback, Handler handler)

For details, please view: https://developer.android.com/refer...media.AudioDeviceCallback, android.os.Handler)

2. Obtain advanced features related to the Bluetooth device:

[MENTION=2056652]return[/MENTION] Returns EnhancedDeviceInfo for the device, which is used to query device information. If the device does not support the advanced feature, null is returned.

EnhancedDeviceInfo mEnhancedDeviceInfo = mHwAudioKit.getEnhancedDeviceInfo(info.getType());

Sample code:

mAudioManager.registerAudioDeviceCallback(new AudioDeviceCallback() {

[MENTION=439709]override[/MENTION]

public void onAudioDevicesAdded(AudioDeviceInfo[] addedDevices) {

for (AudioDeviceInfo info : addedDevices) {

Log.d(TAG, "onAudioDevicesAdded: " + info.getType());

if (mHwAudioKit != null) {

int deviceType = info.getType();

if (deviceType == AudioDeviceInfo.TYPE_BLUETOOTH_A2DP) {

try {

mEnhancedDeviceInfo = mHwAudioKit.getEnhancedDeviceInfo(info.getType());

Log.d(TAG,"enhancedDeviceInfo：" + mEnhancedDeviceInfo.toString());

} catch (UnsupportedVersionException e) {

e.printStackTrace();

}

}

}else {

mInfoTextView.setText(R.string.isInit);

}

}

}

[MENTION=439709]override[/MENTION]

public void onAudioDevicesRemoved(AudioDeviceInfo[] removedDevices) {

}

}, null);

3.2 Querying 48 KHz Recording Capability

//Return value: [MENTION=2056652]return[/MENTION] true indicates that 48 KHz recording is supported, while false indicates it is not.

boolean ret = mEnhancedDeviceInfo. isFullbandRecordSupported ();

3.3 Recording at 48 KHz Sampling Rate

Third-party apps can use the native Android API to perform 48 KHz recording. You can use OpenSL for recording, or you can call APIs such as AudioRecord and MediaRecord. Note that apps cannot set up the SCO (some apps may do so to ensure that the Bluetooth headset can be used for recording), and the source should be MediaRecorder.AudioSource.MIC (for audio recording) or MediaRecorder.AudioSource. CAMCORDER (for video recording).

3.4 Querying Karaoke Feature Capability

//Return value: [MENTION=2056652]return[/MENTION] true indicates that the karaoke feature is supported, while false indicates it is not.

boolean ret = mEnhancedDeviceInfo. isKaraokeSupported ();

3.5 Remarks

1. You can use AudioRecord, MediaRecord, or OpenSL for 48 KHz recording and karaoke feature for Bluetooth headset.

2. The Bluetooth headset does not save the set parameters of the karaoke feature. If the app detects that the Bluetooth headset is connected or disconnected (for example, when the Bluetooth headset is connected when the user is using a wired headset for karaoke), re-deliver the headset monitoring settings and enable the headset monitoring feature.