# AudioAttributes

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

# AudioAttributes

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/media/AudioAttributes "View this page in Java")  

```
class AudioAttributes : Parcelable
```

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

A class to encapsulate a collection of attributes describing information about an audio stream.

`AudioAttributes`supersede the notion of stream types (see for instance[AudioManager.STREAM_MUSIC](https://developer.android.com/reference/kotlin/android/media/AudioManager#STREAM_MUSIC:kotlin.Int)or[AudioManager.STREAM_ALARM](https://developer.android.com/reference/kotlin/android/media/AudioManager#STREAM_ALARM:kotlin.Int)) for defining the behavior of audio playback. Attributes allow an application to specify more information than is conveyed in a stream type by allowing the application to define:

- usage: "why" you are playing a sound, what is this sound used for. This is achieved with the "usage" information. Examples of usage are[USAGE_MEDIA](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_MEDIA:kotlin.Int)and[USAGE_ALARM](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_ALARM:kotlin.Int). These two examples are the closest to stream types, but more detailed use cases are available. Usage information is more expressive than a stream type, and allows certain platforms or routing policies to use this information for more refined volume or routing decisions. Usage is the most important information to supply in`AudioAttributes`and it is recommended to build any instance with this information supplied, see[AudioAttributes.Builder](https://developer.android.com/reference/kotlin/android/media/AudioAttributes.Builder)for exceptions.
- content type: "what" you are playing. The content type expresses the general category of the content. This information is optional. But in case it is known (for instance[CONTENT_TYPE_MOVIE](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#CONTENT_TYPE_MOVIE:kotlin.Int)for a movie streaming service or[CONTENT_TYPE_MUSIC](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#CONTENT_TYPE_MUSIC:kotlin.Int)for a music playback application) this information might be used by the audio framework to selectively configure some audio post-processing blocks.
- flags: "how" is playback to be affected, see the flag definitions for the specific playback behaviors they control.

`AudioAttributes`are used for example in one of the[AudioTrack](https://developer.android.com/reference/kotlin/android/media/AudioTrack)constructors (see[AudioTrack.AudioTrack(AudioAttributes, AudioFormat, int, int, int)](https://developer.android.com/reference/kotlin/android/media/AudioTrack#AudioTrack(android.media.AudioAttributes,%20android.media.AudioFormat,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int))), to configure a[MediaPlayer](https://developer.android.com/reference/kotlin/android/media/MediaPlayer)(see[MediaPlayer.setAudioAttributes(AudioAttributes)](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#setAudioAttributes(android.media.AudioAttributes))or a[android.app.Notification](https://developer.android.com/reference/kotlin/android/app/Notification.html#)(see[android.app.Notification#audioAttributes](https://developer.android.com/reference/kotlin/android/app/Notification.html#audioAttributes:android.media.AudioAttributes)). An`AudioAttributes`instance is built through its builder,[AudioAttributes.Builder](https://developer.android.com/reference/kotlin/android/media/AudioAttributes.Builder).

## Summary

|                                                                                                        Nested classes                                                                                                        ||
|---|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|   | [Builder](https://developer.android.com/reference/kotlin/android/media/AudioAttributes.Builder) Builder class for[AudioAttributes](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#)objects. |

|                                                                                                                                                                                                                            Constants                                                                                                                                                                                                                            ||
|----------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ALLOW_CAPTURE_BY_ALL](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#ALLOW_CAPTURE_BY_ALL:kotlin.Int) Indicates that the audio may be captured by any app.                                                                                                                                                                                     |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ALLOW_CAPTURE_BY_NONE](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#ALLOW_CAPTURE_BY_NONE:kotlin.Int) Indicates that the audio is not to be recorded by any app, even if it is a system app.                                                                                                                                                 |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ALLOW_CAPTURE_BY_SYSTEM](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#ALLOW_CAPTURE_BY_SYSTEM:kotlin.Int) Indicates that the audio may only be captured by system apps.                                                                                                                                                                      |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [CONTENT_TYPE_MOVIE](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#CONTENT_TYPE_MOVIE:kotlin.Int) Content type value to use when the content type is the audio typically accompanying a movie or TV program, containing a mix of dialogue, music and sound effects.                                                                            |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [CONTENT_TYPE_MUSIC](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#CONTENT_TYPE_MUSIC:kotlin.Int) Content type value to use when the content type is music.                                                                                                                                                                                    |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [CONTENT_TYPE_SONIFICATION](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#CONTENT_TYPE_SONIFICATION:kotlin.Int) Content type value to use when the content type is a sound used to accompany a user action, such as a beep or sound effect expressing a key click, or event, such as the type of a sound for a bonus being received in a game. |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [CONTENT_TYPE_SPEECH](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#CONTENT_TYPE_SPEECH:kotlin.Int) Content type value to use when the content type is speech.                                                                                                                                                                                 |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [CONTENT_TYPE_UNKNOWN](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#CONTENT_TYPE_UNKNOWN:kotlin.Int) Content type value to use when the content type is unknown, or other than the ones defined.                                                                                                                                              |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [FLAG_AUDIBILITY_ENFORCED](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#FLAG_AUDIBILITY_ENFORCED:kotlin.Int) Flag defining a behavior where the audibility of the sound will be ensured by the system.                                                                                                                                        |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [FLAG_HW_AV_SYNC](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#FLAG_HW_AV_SYNC:kotlin.Int) Flag requesting the use of an output stream supporting hardware A/V synchronization.                                                                                                                                                               |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [FLAG_LOW_LATENCY](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#FLAG_LOW_LATENCY:kotlin.Int) Flag requesting a low latency path when creating an AudioTrack.                                                                                                                                                                                  |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [SPATIALIZATION_BEHAVIOR_AUTO](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#SPATIALIZATION_BEHAVIOR_AUTO:kotlin.Int) Constant indicating the audio content associated with these attributes will follow the default platform behavior with regards to which content will be spatialized or not.                                               |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [SPATIALIZATION_BEHAVIOR_NEVER](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#SPATIALIZATION_BEHAVIOR_NEVER:kotlin.Int) Constant indicating the audio content associated with these attributes should never be virtualized.                                                                                                                    |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [USAGE_ALARM](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_ALARM:kotlin.Int) Usage value to use when the usage is an alarm (e.g. wake-up alarm).                                                                                                                                                                                        |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [USAGE_ASSISTANCE_ACCESSIBILITY](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_ASSISTANCE_ACCESSIBILITY:kotlin.Int) Usage value to use when the usage is for accessibility, such as with a screen reader.                                                                                                                                |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [USAGE_ASSISTANCE_NAVIGATION_GUIDANCE](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_ASSISTANCE_NAVIGATION_GUIDANCE:kotlin.Int) Usage value to use when the usage is driving or navigation directions.                                                                                                                                   |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [USAGE_ASSISTANCE_SONIFICATION](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_ASSISTANCE_SONIFICATION:kotlin.Int) Usage value to use when the usage is sonification, such as with user interface sounds.                                                                                                                                 |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [USAGE_ASSISTANT](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_ASSISTANT:kotlin.Int) Usage value to use for audio responses to user queries, audio instructions or help utterances.                                                                                                                                                     |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [USAGE_GAME](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_GAME:kotlin.Int) Usage value to use when the usage is for game audio.                                                                                                                                                                                                         |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [USAGE_MEDIA](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_MEDIA:kotlin.Int) Usage value to use when the usage is media, such as music, or movie soundtracks.                                                                                                                                                                           |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [USAGE_NOTIFICATION](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_NOTIFICATION:kotlin.Int) Usage value to use when the usage is notification.                                                                                                                                                                                           |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [USAGE_NOTIFICATION_COMMUNICATION_DELAYED](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_NOTIFICATION_COMMUNICATION_DELAYED:kotlin.Int) Usage value to use when the usage is notification for a non-immediate type of communication such as e-mail.                                                                                      |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [USAGE_NOTIFICATION_COMMUNICATION_INSTANT](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_NOTIFICATION_COMMUNICATION_INSTANT:kotlin.Int) Usage value to use when the usage is notification for an "instant" communication such as a chat, or SMS.                                                                                         |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [USAGE_NOTIFICATION_COMMUNICATION_REQUEST](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_NOTIFICATION_COMMUNICATION_REQUEST:kotlin.Int) Usage value to use when the usage is a request to enter/end a communication, such as a VoIP communication or video-conference.                                                                   |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [USAGE_NOTIFICATION_EVENT](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_NOTIFICATION_EVENT:kotlin.Int) Usage value to use when the usage is to attract the user's attention, such as a reminder or low battery warning.                                                                                                                 |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [USAGE_NOTIFICATION_RINGTONE](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_NOTIFICATION_RINGTONE:kotlin.Int) Usage value to use when the usage is telephony ringtone.                                                                                                                                                                   |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [USAGE_UNKNOWN](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_UNKNOWN:kotlin.Int) Usage value to use when the usage is unknown.                                                                                                                                                                                                          |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [USAGE_VOICE_COMMUNICATION](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_VOICE_COMMUNICATION:kotlin.Int) Usage value to use when the usage is voice communications, such as telephony or VoIP.                                                                                                                                          |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [USAGE_VOICE_COMMUNICATION_SIGNALLING](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_VOICE_COMMUNICATION_SIGNALLING:kotlin.Int) Usage value to use when the usage is in-call signalling, such as with a "busy" beep, or DTMF tones.                                                                                                      |

| Inherited constants ||
|---|---|
| From class[Parcelable](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#) |----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int) <br /> Descriptor bit used with[describeContents()](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#describeContents()): indicates that the Parcelable object's flattened representation includes a file descriptor. <br />                                                                                                                                                                                                        | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int) <br /> Flag for use with[writeToParcel](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#writeToParcel(android.os.Parcel,%20kotlin.Int)): the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`". Some implementations may want to release resources at this point. <br /> | ||

|                                                                                                                                                                                                        Public methods                                                                                                                                                                                                        ||
|------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [areHapticChannelsMuted](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#areHapticChannelsMuted())`()` Return if haptic channels are muted.                                                                                                                                                                 |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)         | [describeContents](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#describeContents())`()` <br />                                                                                                                                                                                                           |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [equals](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#equals(kotlin.Any))`(`other:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?`)` <br />                                                                                                                               |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)         | [getAllowedCapturePolicy](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#getAllowedCapturePolicy())`()` Return the capture policy.                                                                                                                                                                         |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)         | [getContentType](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#getContentType())`()` Return the content type.                                                                                                                                                                                             |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)         | [getFlags](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#getFlags())`()` Return the flags.                                                                                                                                                                                                                |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)         | [getSpatializationBehavior](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#getSpatializationBehavior())`()` Return the behavior affecting whether spatialization will be used.                                                                                                                             |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)         | [getUsage](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#getUsage())`()` Return the usage.                                                                                                                                                                                                                |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)         | [getVolumeControlStream](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#getVolumeControlStream())`()` Returns the stream type matching this`AudioAttributes`instance for volume control.                                                                                                                   |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)         | [hashCode](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#hashCode())`()` <br />                                                                                                                                                                                                                           |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [isContentSpatialized](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#isContentSpatialized())`()` Return true if the audio content associated with these attributes has already been spatialized, that is it has already been processed to offer a binaural or transaural immersive audio experience.      |
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)   | [toString](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#toString())`()` <br />                                                                                                                                                                                                                           |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)       | [writeToParcel](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#writeToParcel(android.os.Parcel,%20kotlin.Int))`(`dest:` `[Parcel](https://developer.android.com/reference/kotlin/android/os/Parcel.html#)`, `flags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> |

|                                                                                                                                                                        Properties                                                                                                                                                                         ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|
| static[Parcelable.Creator](https://developer.android.com/reference/kotlin/android/os/Parcelable.Creator.html#)\<[AudioAttributes](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#)!\> | [CREATOR](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#CREATOR:android.os.Parcelable.Creator) <br /> |

## Constants

### ALLOW_CAPTURE_BY_ALL

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

```
static val ALLOW_CAPTURE_BY_ALL: Int
```

Indicates that the audio may be captured by any app. For privacy, the following usages cannot be recorded: VOICE_COMMUNICATION\*, USAGE_NOTIFICATION\*, USAGE_ASSISTANCE\* and USAGE_ASSISTANT. On[android.os.Build.VERSION_CODES#Q](https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#Q:kotlin.Int), this means only[USAGE_UNKNOWN](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_UNKNOWN:kotlin.Int),[USAGE_MEDIA](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_MEDIA:kotlin.Int)and[USAGE_GAME](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_GAME:kotlin.Int)may be captured. See[android.media.projection.MediaProjection](https://developer.android.com/reference/kotlin/android/media/projection/MediaProjection)and[Builder.setAllowedCapturePolicy](https://developer.android.com/reference/kotlin/android/media/AudioAttributes.Builder#setAllowedCapturePolicy(kotlin.Int)).  

    Value: 1

### ALLOW_CAPTURE_BY_NONE

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

```
static val ALLOW_CAPTURE_BY_NONE: Int
```

Indicates that the audio is not to be recorded by any app, even if it is a system app. It is encouraged to use[ALLOW_CAPTURE_BY_SYSTEM](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#ALLOW_CAPTURE_BY_SYSTEM:kotlin.Int)instead of this value as system apps provide significant and useful features for the user (such as live captioning and accessibility). See[Builder.setAllowedCapturePolicy](https://developer.android.com/reference/kotlin/android/media/AudioAttributes.Builder#setAllowedCapturePolicy(kotlin.Int)).  

    Value: 3

### ALLOW_CAPTURE_BY_SYSTEM

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

```
static val ALLOW_CAPTURE_BY_SYSTEM: Int
```

Indicates that the audio may only be captured by system apps. System apps can capture for many purposes like accessibility, live captions, user guidance... but abide to the following restrictions: - the audio cannot leave the device - the audio cannot be passed to a third party app - the audio cannot be recorded at a higher quality than 16kHz 16bit mono See[Builder.setAllowedCapturePolicy](https://developer.android.com/reference/kotlin/android/media/AudioAttributes.Builder#setAllowedCapturePolicy(kotlin.Int)).  

    Value: 2

### CONTENT_TYPE_MOVIE

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

```
static val CONTENT_TYPE_MOVIE: Int
```

Content type value to use when the content type is the audio typically accompanying a movie or TV program, containing a mix of dialogue, music and sound effects.  

    Value: 3

### CONTENT_TYPE_MUSIC

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

```
static val CONTENT_TYPE_MUSIC: Int
```

Content type value to use when the content type is music.  

    Value: 2

### CONTENT_TYPE_SONIFICATION

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

```
static val CONTENT_TYPE_SONIFICATION: Int
```

Content type value to use when the content type is a sound used to accompany a user action, such as a beep or sound effect expressing a key click, or event, such as the type of a sound for a bonus being received in a game. These sounds are mostly synthesized or short Foley sounds.  

    Value: 4

### CONTENT_TYPE_SPEECH

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

```
static val CONTENT_TYPE_SPEECH: Int
```

Content type value to use when the content type is speech.  

    Value: 1

### CONTENT_TYPE_UNKNOWN

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

```
static val CONTENT_TYPE_UNKNOWN: Int
```

Content type value to use when the content type is unknown, or other than the ones defined.  

    Value: 0

### FLAG_AUDIBILITY_ENFORCED

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

```
static val FLAG_AUDIBILITY_ENFORCED: Int
```

Flag defining a behavior where the audibility of the sound will be ensured by the system. To ensure sound audibility, the system only uses built-in speakers or wired headphones and specifically excludes wireless audio devices.

Note this flag should only be used for sounds subject to regulatory behaviors in some countries, such as for camera shutter sound, and not for routing behaviors.  

    Value: 1

### FLAG_HW_AV_SYNC

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

```
static val FLAG_HW_AV_SYNC: Int
```

Flag requesting the use of an output stream supporting hardware A/V synchronization.  

    Value: 16

### FLAG_LOW_LATENCY

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

```
static val FLAG_LOW_LATENCY: Int
```

**Deprecated:** *Use[AudioTrack.Builder.setPerformanceMode(int)](https://developer.android.com/reference/kotlin/android/media/AudioTrack.Builder#setPerformanceMode(kotlin.Int))with[AudioTrack.PERFORMANCE_MODE_LOW_LATENCY](https://developer.android.com/reference/kotlin/android/media/AudioTrack#PERFORMANCE_MODE_LOW_LATENCY:kotlin.Int)to control performance.*

Flag requesting a low latency path when creating an AudioTrack. When using this flag, the sample rate must match the native sample rate of the device. Effects processing is also unavailable. Note that if this flag is used without specifying a bufferSizeInBytes then the AudioTrack's actual buffer size may be too small. It is recommended that a fairly large buffer should be specified when the AudioTrack is created. Then the actual size can be reduced by calling[AudioTrack.setBufferSizeInFrames(int)](https://developer.android.com/reference/kotlin/android/media/AudioTrack#setBufferSizeInFrames(kotlin.Int)). The buffer size can be optimized by lowering it after each write() call until the audio glitches, which is detected by calling[AudioTrack.getUnderrunCount()](https://developer.android.com/reference/kotlin/android/media/AudioTrack#getUnderrunCount()). Then the buffer size can be increased until there are no glitches. This tuning step should be done while playing silence. This technique provides a compromise between latency and glitch rate.  

    Value: 256

### SPATIALIZATION_BEHAVIOR_AUTO

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

```
static val SPATIALIZATION_BEHAVIOR_AUTO: Int
```

Constant indicating the audio content associated with these attributes will follow the default platform behavior with regards to which content will be spatialized or not.  

    Value: 0

**See Also**

- <https://developer.android.com/reference/kotlin/android/media/AudioAttributes#getSpatializationBehavior()>
- [android.media.Spatializer](https://developer.android.com/reference/kotlin/android/media/Spatializer)  

### SPATIALIZATION_BEHAVIOR_NEVER

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

```
static val SPATIALIZATION_BEHAVIOR_NEVER: Int
```

Constant indicating the audio content associated with these attributes should never be virtualized.  

    Value: 1

**See Also**

- <https://developer.android.com/reference/kotlin/android/media/AudioAttributes#getSpatializationBehavior()>
- [android.media.Spatializer](https://developer.android.com/reference/kotlin/android/media/Spatializer)  

### USAGE_ALARM

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

```
static val USAGE_ALARM: Int
```

Usage value to use when the usage is an alarm (e.g. wake-up alarm).  

    Value: 4

### USAGE_ASSISTANCE_ACCESSIBILITY

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

```
static val USAGE_ASSISTANCE_ACCESSIBILITY: Int
```

Usage value to use when the usage is for accessibility, such as with a screen reader.  

    Value: 11

### USAGE_ASSISTANCE_NAVIGATION_GUIDANCE

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

```
static val USAGE_ASSISTANCE_NAVIGATION_GUIDANCE: Int
```

Usage value to use when the usage is driving or navigation directions.  

    Value: 12

### USAGE_ASSISTANCE_SONIFICATION

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

```
static val USAGE_ASSISTANCE_SONIFICATION: Int
```

Usage value to use when the usage is sonification, such as with user interface sounds.  

    Value: 13

### USAGE_ASSISTANT

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

```
static val USAGE_ASSISTANT: Int
```

Usage value to use for audio responses to user queries, audio instructions or help utterances.  

    Value: 16

### USAGE_GAME

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

```
static val USAGE_GAME: Int
```

Usage value to use when the usage is for game audio.  

    Value: 14

### USAGE_MEDIA

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

```
static val USAGE_MEDIA: Int
```

Usage value to use when the usage is media, such as music, or movie soundtracks.  

    Value: 1

### USAGE_NOTIFICATION

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

```
static val USAGE_NOTIFICATION: Int
```

Usage value to use when the usage is notification. See other notification usages for more specialized uses.  

    Value: 5

### USAGE_NOTIFICATION_COMMUNICATION_DELAYED

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

```
static val USAGE_NOTIFICATION_COMMUNICATION_DELAYED: Int
```

**Deprecated:** *Use[USAGE_NOTIFICATION](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_NOTIFICATION:kotlin.Int)which is handled the same way as this usage by the audio framework*

Usage value to use when the usage is notification for a non-immediate type of communication such as e-mail.  

    Value: 9

### USAGE_NOTIFICATION_COMMUNICATION_INSTANT

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

```
static val USAGE_NOTIFICATION_COMMUNICATION_INSTANT: Int
```

**Deprecated:** *Use[USAGE_NOTIFICATION](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_NOTIFICATION:kotlin.Int)which is handled the same way as this usage by the audio framework*

Usage value to use when the usage is notification for an "instant" communication such as a chat, or SMS.  

    Value: 8

### USAGE_NOTIFICATION_COMMUNICATION_REQUEST

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

```
static val USAGE_NOTIFICATION_COMMUNICATION_REQUEST: Int
```

**Deprecated:** *Use[USAGE_NOTIFICATION](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#USAGE_NOTIFICATION:kotlin.Int)which is handled the same way as this usage by the audio framework*

Usage value to use when the usage is a request to enter/end a communication, such as a VoIP communication or video-conference.  

    Value: 7

### USAGE_NOTIFICATION_EVENT

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

```
static val USAGE_NOTIFICATION_EVENT: Int
```

Usage value to use when the usage is to attract the user's attention, such as a reminder or low battery warning.  

    Value: 10

### USAGE_NOTIFICATION_RINGTONE

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

```
static val USAGE_NOTIFICATION_RINGTONE: Int
```

Usage value to use when the usage is telephony ringtone.  

    Value: 6

### USAGE_UNKNOWN

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

```
static val USAGE_UNKNOWN: Int
```

Usage value to use when the usage is unknown.  

    Value: 0

### USAGE_VOICE_COMMUNICATION

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

```
static val USAGE_VOICE_COMMUNICATION: Int
```

Usage value to use when the usage is voice communications, such as telephony or VoIP.  

    Value: 2

### USAGE_VOICE_COMMUNICATION_SIGNALLING

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

```
static val USAGE_VOICE_COMMUNICATION_SIGNALLING: Int
```

Usage value to use when the usage is in-call signalling, such as with a "busy" beep, or DTMF tones.  

    Value: 3

## Public methods

### areHapticChannelsMuted

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

```
fun areHapticChannelsMuted(): Boolean
```

Return if haptic channels are muted.

|                                                                  Return                                                                  ||
|------------------------------------------------------------------------------------|------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true`if haptic channels are muted,`false`otherwise. |

### describeContents

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

```
fun describeContents(): Int
```

|                                                                                                                                                                               Return                                                                                                                                                                               ||
|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either`0`or[android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int) |

### equals

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

```
fun equals(other: Any?): Boolean
```

|                     Parameters                     ||
|-------|---------------------------------------------|
| `obj` | the reference object with which to compare. |

|                                                                           Return                                                                           ||
|------------------------------------------------------------------------------------|------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true`if this object is the same as the obj argument;`false`otherwise. |

### getAllowedCapturePolicy

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

```
fun getAllowedCapturePolicy(): Int
```

Return the capture policy.

|                                                                                                                                                                                                                                                                                                                                                                                                                Return                                                                                                                                                                                                                                                                                                                                                                                                                 ||
|----------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | the capture policy set by[Builder.setAllowedCapturePolicy(int)](https://developer.android.com/reference/kotlin/android/media/AudioAttributes.Builder#setAllowedCapturePolicy(kotlin.Int))or the default if it was not called. Value is[android.media.AudioAttributes#ALLOW_CAPTURE_BY_ALL](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#ALLOW_CAPTURE_BY_ALL:kotlin.Int),[android.media.AudioAttributes#ALLOW_CAPTURE_BY_SYSTEM](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#ALLOW_CAPTURE_BY_SYSTEM:kotlin.Int), or[android.media.AudioAttributes#ALLOW_CAPTURE_BY_NONE](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#ALLOW_CAPTURE_BY_NONE:kotlin.Int) |

### getContentType

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

```
fun getContentType(): Int
```

Return the content type.

|                                                                                                                             Return                                                                                                                             ||
|----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | one of the values that can be set in[Builder.setContentType(int)](https://developer.android.com/reference/kotlin/android/media/AudioAttributes.Builder#setContentType(kotlin.Int)) |

### getFlags

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

```
fun getFlags(): Int
```

Return the flags.

|                                                  Return                                                  ||
|----------------------------------------------------------------------------|------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a combined mask of all flags |

### getSpatializationBehavior

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

```
fun getSpatializationBehavior(): Int
```

Return the behavior affecting whether spatialization will be used.

|                                                                                                                                                                                                                                           Return                                                                                                                                                                                                                                           ||
|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | the spatialization behavior Value is[android.media.AudioAttributes#SPATIALIZATION_BEHAVIOR_AUTO](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#SPATIALIZATION_BEHAVIOR_AUTO:kotlin.Int), or[android.media.AudioAttributes#SPATIALIZATION_BEHAVIOR_NEVER](https://developer.android.com/reference/kotlin/android/media/AudioAttributes#SPATIALIZATION_BEHAVIOR_NEVER:kotlin.Int) |

### getUsage

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

```
fun getUsage(): Int
```

Return the usage.

|                                                                                                                       Return                                                                                                                       ||
|----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | one of the values that can be set in[Builder.setUsage(int)](https://developer.android.com/reference/kotlin/android/media/AudioAttributes.Builder#setUsage(kotlin.Int)) |

### getVolumeControlStream

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

```
fun getVolumeControlStream(): Int
```

Returns the stream type matching this`AudioAttributes`instance for volume control. Use this method to derive the stream type needed to configure the volume control slider in an[android.app.Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)with[android.app.Activity#setVolumeControlStream(int)](https://developer.android.com/reference/kotlin/android/app/Activity.html#setVolumeControlStream(kotlin.Int))for playback conducted with these attributes.  
Do not use this method to set the stream type on an audio player object (e.g.[AudioTrack](https://developer.android.com/reference/kotlin/android/media/AudioTrack),[MediaPlayer](https://developer.android.com/reference/kotlin/android/media/MediaPlayer)) as this is deprecated, use`AudioAttributes`instead.

|                                                                                                                                                                                                                                                                                               Return                                                                                                                                                                                                                                                                                                ||
|----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a valid stream type for`Activity`or stream volume control that matches the attributes, or[AudioManager.USE_DEFAULT_STREAM_TYPE](https://developer.android.com/reference/kotlin/android/media/AudioManager#USE_DEFAULT_STREAM_TYPE:kotlin.Int)if there isn't a direct match. Note that`USE_DEFAULT_STREAM_TYPE`is not a valid value for[AudioManager.setStreamVolume(int, int, int)](https://developer.android.com/reference/kotlin/android/media/AudioManager#setStreamVolume(kotlin.Int,%20kotlin.Int,%20kotlin.Int)). |

### hashCode

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

```
fun hashCode(): Int
```

|                                                     Return                                                     ||
|----------------------------------------------------------------------------|------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a hash code value for this object. |

### isContentSpatialized

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

```
fun isContentSpatialized(): Boolean
```

Return true if the audio content associated with these attributes has already been spatialized, that is it has already been processed to offer a binaural or transaural immersive audio experience.

|                                                           Return                                                            ||
|------------------------------------------------------------------------------------|-----------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true`if the content has been processed |

### toString

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

```
fun toString(): String
```

|                                                          Return                                                          ||
|----------------------------------------------------------------------------------|----------------------------------------|
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | a string representation of the object. |

### writeToParcel

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

```
fun writeToParcel(
    dest: Parcel, 
    flags: Int
): Unit
```

|                                                                                                                                                                                                                                                                                     Parameters                                                                                                                                                                                                                                                                                     ||
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `dest`  | [Parcel](https://developer.android.com/reference/kotlin/android/os/Parcel.html#):The Parcel in which the object should be written. This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                            |
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Additional flags about how the object should be written. May be 0 or[PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int). Value is either`0`or a combination of[android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int), and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |

## Properties

### CREATOR

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

```
static val CREATOR: Parcelable.Creator<AudioAttributes!>
```