---
title: "changeVolume(by:for:)"
framework: mediadevice
role: symbol
role_heading: Instance Method
path: "mediadevice/mediadeviceextension/changevolume(by:for:)"
---

# changeVolume(by:for:)

Changes the volume by a specified number of increments for the specified device.

## Declaration

```swift
@MainActor func changeVolume(by increments: Int, for device: MediaOutputDevice)
```

## Parameters

- `increments`: The number of volume increments to increase or decrease by.
- `device`: The device for which to change the volume.

## Mentioned in

Creating a media device extension

## Discussion

Discussion For a group of devices, individual device volume changes should influence the group volume. Called when a device supports MediaOutputDevice.VolumeControl.relative. Grouping For a group of devices, all devices in the group must support MediaOutputDevice.VolumeControl.relative.
