# ContainedVoiceInputIndicator

## Functions summary

|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/xr/glimmer/ContainedVoiceInputIndicator.composable#ContainedVoiceInputIndicator(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color)( level: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier, backgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color )` A voice input indicator with a background container that displays sound activity to the user. |

## Functions

### ContainedVoiceInputIndicator

Artifact: [androidx.xr.glimmer:glimmer](https://developer.android.com/jetpack/androidx/releases/xr-glimmer) [View Source](https://cs.android.com/search?q=file:androidx/xr/glimmer/VoiceInputIndicator.kt+function:ContainedVoiceInputIndicator) Added in [1.0.0-alpha22](https://developer.android.com/jetpack/androidx/releases/xr-glimmer#1.0.0-alpha22)

```
@Composable
fun ContainedVoiceInputIndicator(
    level: () -> Float,
    modifier: Modifier = Modifier,
    backgroundColor: Color = GlimmerTheme.colors.primary
): Unit
```

A voice input indicator with a background container that displays sound activity to the user. In this version of the component, the indicator bars are transparent and cut through its background container.

This component can be used when accepting voice input to show that the app is listening to the user's input. The indicator responds to the `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/package-summary#ContainedVoiceInputIndicator(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color)` provided, showing a visual representation of the audio intensity.

See `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/VoiceInputIndicator.composable#VoiceInputIndicator(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color)` for the version of this component with solid indicator bars and no background container.

```kotlin
import androidx.compose.runtime.Composable
import androidx.xr.glimmer.VoiceInputIndicator

// Get audio input from microphone.
// Normalize audio input to level 0...1

// Pass normalized level to Composable.
VoiceInputIndicator(level = { level })
```

| Parameters |
|---|---|
| `level: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The level of the voice input, ranging from 0.0 (silence) to 1.0 (loudest). |
| `modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier = Modifier` | The modifier to be applied to the indicator. |
| `backgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = GlimmerTheme.colors.primary` | The color of the background container. |