Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Builder

*** ** * ** ***

```
class Builder
```

|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||
| ↳ | [android.bluetooth.BluetoothLeAudioCodecConfig.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#) |

Builder for `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig`.

By default, the codec type will be set to `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#SOURCE_CODEC_TYPE_INVALID:kotlin.Int`

## Summary

| Public constructors ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#Builder()()` <br /> |
| `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#Builder(android.bluetooth.BluetoothLeAudioCodecConfig)(config: https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig)` <br /> |

| Public methods ||
|---|---|
| [BluetoothLeAudioCodecConfig](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig) | `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#build()()` Build `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig`. |
| [BluetoothLeAudioCodecConfig.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#setBitsPerSample(kotlin.Int)(bitsPerSample: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Set the bits per sample for LE audio codec config. |
| [BluetoothLeAudioCodecConfig.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#setChannelCount(kotlin.Int)(channelCount: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Set the channel count for Bluetooth LE audio codec config. |
| [BluetoothLeAudioCodecConfig.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#setCodecId(kotlin.Long)(codecId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Sets the codec ID. |
| [BluetoothLeAudioCodecConfig.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#setCodecPriority(kotlin.Int)(codecPriority: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Set codec priority for Bluetooth LE audio codec config. |
| [BluetoothLeAudioCodecConfig.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#setCodecType(kotlin.Int)(codecType: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Set codec type for Bluetooth LE audio codec config. |
| [BluetoothLeAudioCodecConfig.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#setFrameDuration(kotlin.Int)(frameDuration: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Set the frame duration for Bluetooth LE audio codec config. |
| [BluetoothLeAudioCodecConfig.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#setMaxOctetsPerFrame(kotlin.Int)(maxOctetsPerFrame: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Set the maximum octets per frame for Bluetooth LE audio codec config. |
| [BluetoothLeAudioCodecConfig.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#setMinOctetsPerFrame(kotlin.Int)(minOctetsPerFrame: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Set the minimum octets per frame for Bluetooth LE audio codec config. |
| [BluetoothLeAudioCodecConfig.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#setOctetsPerFrame(kotlin.Int)(octetsPerFrame: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Set the octets per frame for Bluetooth LE audio codec config. |
| [BluetoothLeAudioCodecConfig.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#setSampleRate(kotlin.Int)(sampleRate: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Set sample rate for Bluetooth LE audio codec config. |

## Public constructors

### Builder

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
Builder()
```

### Builder

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
Builder(config: BluetoothLeAudioCodecConfig)
```

| Parameters ||
|---|---|
| `config` | [BluetoothLeAudioCodecConfig](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig): This value cannot be `null`. |

## Public methods

### build

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun build(): BluetoothLeAudioCodecConfig
```

Build `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig`.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig` | new BluetoothLeAudioCodecConfig built. This value cannot be `null`. |

### setBitsPerSample

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setBitsPerSample(bitsPerSample: Int): BluetoothLeAudioCodecConfig.Builder
```

Set the bits per sample for LE audio codec config.

| Parameters ||
|---|---|
| `bitsPerSample` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): of this codec. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#BITS_PER_SAMPLE_NONE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#BITS_PER_SAMPLE_16:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#BITS_PER_SAMPLE_24:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#BITS_PER_SAMPLE_32:kotlin.Int` |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#` | the same Builder instance. This value cannot be `null`. |

### setChannelCount

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setChannelCount(channelCount: Int): BluetoothLeAudioCodecConfig.Builder
```

Set the channel count for Bluetooth LE audio codec config.

| Parameters ||
|---|---|
| `channelCount` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): of this codec. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#CHANNEL_COUNT_NONE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#CHANNEL_COUNT_1:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#CHANNEL_COUNT_2:kotlin.Int` |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#` | the same Builder instance. This value cannot be `null`. |

### setCodecId

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setCodecId(codecId: Long): BluetoothLeAudioCodecConfig.Builder
```

Sets the codec ID.

The codec identifier is 40 bits as defined by Bluetooth ASCS v1.0.1.

Currently, only the following Codec IDs are supported:

- **LC3:** 0x00_0000000006
- **Vendor Specific:** 0xNN_NNNNNNNNFF

| Parameters ||
|---|---|
| `codecId` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): The 40-bit codec identifier. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#` | the same Builder instance. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if the codecId is greater than 40 bits, or not supported (not LC3 or Vendor Specific). |

### setCodecPriority

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setCodecPriority(codecPriority: Int): BluetoothLeAudioCodecConfig.Builder
```

Set codec priority for Bluetooth LE audio codec config.

| Parameters ||
|---|---|
| `codecPriority` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): of this codec. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#CODEC_PRIORITY_DISABLED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#CODEC_PRIORITY_DEFAULT:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#CODEC_PRIORITY_HIGHEST:kotlin.Int` |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#` | the same Builder instance. This value cannot be `null`. |

### setCodecType

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setCodecType(codecType: Int): BluetoothLeAudioCodecConfig.Builder
```

Set codec type for Bluetooth LE audio codec config.

| Parameters ||
|---|---|
| `codecType` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): of this codec. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#SOURCE_CODEC_TYPE_LC3:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#SOURCE_CODEC_TYPE_OPUS:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#SOURCE_CODEC_TYPE_OPUS_HI_RES:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#SOURCE_CODEC_TYPE_VENDOR_SPECIFIC:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#SOURCE_CODEC_TYPE_INVALID:kotlin.Int` |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#` | the same Builder instance. This value cannot be `null`. |

### setFrameDuration

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setFrameDuration(frameDuration: Int): BluetoothLeAudioCodecConfig.Builder
```

Set the frame duration for Bluetooth LE audio codec config.

| Parameters ||
|---|---|
| `frameDuration` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): of this codec. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#FRAME_DURATION_NONE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#FRAME_DURATION_7500:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#FRAME_DURATION_10000:kotlin.Int` |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#` | the same Builder instance. This value cannot be `null`. |

### setMaxOctetsPerFrame

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setMaxOctetsPerFrame(maxOctetsPerFrame: Int): BluetoothLeAudioCodecConfig.Builder
```

Set the maximum octets per frame for Bluetooth LE audio codec config.

| Parameters ||
|---|---|
| `maxOctetsPerFrame` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): of this codec |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#` | the same Builder instance. This value cannot be `null`. |

### setMinOctetsPerFrame

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setMinOctetsPerFrame(minOctetsPerFrame: Int): BluetoothLeAudioCodecConfig.Builder
```

Set the minimum octets per frame for Bluetooth LE audio codec config.

| Parameters ||
|---|---|
| `minOctetsPerFrame` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): of this codec |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#` | the same Builder instance. This value cannot be `null`. |

### setOctetsPerFrame

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setOctetsPerFrame(octetsPerFrame: Int): BluetoothLeAudioCodecConfig.Builder
```

Set the octets per frame for Bluetooth LE audio codec config.

| Parameters ||
|---|---|
| `octetsPerFrame` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): of this codec |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#` | the same Builder instance. This value cannot be `null`. |

### setSampleRate

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setSampleRate(sampleRate: Int): BluetoothLeAudioCodecConfig.Builder
```

Set sample rate for Bluetooth LE audio codec config.

| Parameters ||
|---|---|
| `sampleRate` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): of this codec. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#SAMPLE_RATE_NONE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#SAMPLE_RATE_8000:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#SAMPLE_RATE_11025:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#SAMPLE_RATE_16000:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#SAMPLE_RATE_22050:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#SAMPLE_RATE_24000:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#SAMPLE_RATE_32000:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#SAMPLE_RATE_44100:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#SAMPLE_RATE_48000:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#SAMPLE_RATE_88200:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#SAMPLE_RATE_96000:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#SAMPLE_RATE_176400:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#SAMPLE_RATE_192000:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig#SAMPLE_RATE_384000:kotlin.Int` |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothLeAudioCodecConfig.Builder#` | the same Builder instance. This value cannot be `null`. |