# Audio

To obtain audio the `pipewire` server will be used with an `alsa-pipewire` plugin in combination with `wireplumber` as session manager. 

They may be installed with:

```
# xbps-install -Sy alsa-pipewire pipewire wireplumber
```

Subsequently copy `/usr/share/pipewire/pipewire.conf` to `/etc/pipewire/`.

```
# cp /usr/share/pipewire/pipewire.conf /etc/pipewire/
```

`/etc/pipewire/pipewire.conf` may be configured by inserting:

```
context.exec = [
    { path = "/usr/bin/wireplumber" args = "" }
    { path = "/usr/bin/pipewire" args = "-c pipewire-pulse.conf"}
]
```

Then `/etc/alsa/conf.d` may be created and pipewire configurations may be symlinked:

```
# ln -s /usr/share/alsa/alsa.conf.d/50-pipewire.conf /etc/alsa/conf.d/
# ln -s /usr/share/alsa/alsa.conf.d/99-pipewire-default.conf /etc/alsa/conf.d/
```

Pipewire needs to be started by Wayfire.

```
[autostart]
audio = pipewire
```

## Audio control

To obtain some control over the audio `pavucontrol`, `pamixer` and `pa-notify` may be installed.

```
# xbps-install -Sy pavucontrol pamixer pa-notify
```

Volume control bindings may be set with `pamixer` in `.config/wayfire.ini`.

```
[command]
binding_volumeup = KEY_VOLUMEUP
binding_volumedown = KEY_VOLUMEDOWN 
binding_mute = KEY_MUTE
command_volumeup = pamixer -i 5 -u
command_volumedown = pamixer -d 5 -u
command_mute = pamixer -t
```

To be notified when changing the volume `pa-notify` may be used. It needs to be started by Wayfire.

```
[autostart]
audio_notify = sleep 1; pa-notify -t 2
```

## Music control

To control music and other media `playerctl` may be used.

```
# xbps-install -Sy playerctl
```

The bindings may be set in `.config/wayfire.ini`.

```
[autostart]
audio_player = playerctld daemon

[command]
binding_playpause = KEY_PLAYPAUSE
binding_next = KEY_NEXTSONG
binding_previous = KEY_PREVIOUSSONG
command_playpause = playerctl play-pause
command_next = playerctl next
command_previous = playerctl previous
```
