---
sidebar_position: 0
---

# audio

The `sos.management.audio` API groups methods for managing audio settings.

<details>
    <summary>Volume Management Capabilities</summary>
		| Capability | Description |
		|:------------|:-------------|
		| `SET_VOLUME` | If device can set volume level |
		| `GET_VOLUME` | If device can get current volume level |

		If you want to check if the device supports those capabilities, use [`sos.management.supports()`](https://developers.signageos.io/sdk/sos_management/#supports).
</details>

## Methods

### getVolume()

The `getVolume()` method returns the current volume level of the device.

```ts expandable
getVolume(): Promise<number>;
```

#### Return value

A promise that resolves to the current volume level, which is a value between 0 and 100.

#### Example

```ts
const currentVolume = await sos.management.audio.getVolume();
console.log(`Current volume level is: ${currentVolume}`); // e.g. 75
```

<Separator />

### setVolume()

The `setVolume()` method sets the volume level of the device.

```ts expandable
setVolume(volume: number): Promise<void>;
```

#### Params

| Name     | Type     | Required         | Description              |
|----------|----------|------------------|--------------------------|
| `volume` | `number` |  <div>Yes</div>  | Value between 0 and 100. |

#### Return value

A promise that resolves when the volume is set.

#### Possible errors

If the volume is not a number or is outside the range of 0 to 100.

#### Example

```ts
await sos.management.audio.setVolume(50);
```

:::note[GitHub Example]

- [ Example applet with setting volume](https://github.com/signageos/applet-examples/tree/master/examples/management-js-api/volume)

:::

## API Example

```ts
import { sos } from '@signageos/front-applet';

void sos.onReady(async () => {
	await sos.management.audio.getVolume(); // Returns number e.g. 39

	await sos.management.audio.setVolume(90);
});

```