## Overview

This guide creates an `Internal Speakers` PipeWire output with the Star Labs EQ profile applied.

It is for Linux distributions that use PipeWire for audio.

## What you will do

You will:

- Set the real built-in speaker path to 100% so the EQ has the full range to work with.
- Create a user-level PipeWire configuration file.
- Restart the PipeWire audio services.
- Select `Internal Speakers` as your audio output.

## Before you start

Set your audio output to the built-in speakers before running the command below.

This is important because the EQ connects to whichever output is currently selected. If Bluetooth, HDMI, USB audio, or another external output is selected, the EQ may target that instead of the internal speakers.

## Step 1: Open a Terminal

Open the Terminal app.

Common shortcuts:

- On many distributions: press `Ctrl` + `Alt` + `T`
- Or open your app launcher and search for `Terminal`

## Step 2: Create the Internal Speakers profile

Copy and paste this command into the Terminal, then press `Enter`:

```bash
TARGET_SINK="$(wpctl inspect @DEFAULT_AUDIO_SINK@ | awk -F'= ' '/node.name =/{gsub(/"/,"",$2); print $2; exit}')"

if [ -z "$TARGET_SINK" ]; then
  echo "Could not find the current audio output. Please select the built-in speakers and try again."
  exit 1
fi

# Give the EQ the full real-speaker range to work with.
wpctl set-volume @DEFAULT_AUDIO_SINK@ 100%

mkdir -p ~/.config/pipewire/pipewire.conf.d

cat > ~/.config/pipewire/pipewire.conf.d/51-star-labs-eq.conf <<EOF
context.modules = [
    { name = libpipewire-module-filter-chain
        args = {
            node.description = "Internal Speakers"
            media.name       = "Internal Speakers"
            filter.graph = {
                nodes = [
                    {
                        type    = builtin
                        name    = eq_band_1
                        label   = bq_lowshelf
                        control = { "Freq" = 105.0 "Q" = 0.80 "Gain" = 3.0 }
                    }
                    {
                        type    = builtin
                        name    = eq_band_2
                        label   = bq_lowshelf
                        control = { "Freq" = 190.0 "Q" = 0.75 "Gain" = 7.0 }
                    }
                    {
                        type    = builtin
                        name    = eq_band_3
                        label   = bq_peaking
                        control = { "Freq" = 280.0 "Q" = 1.00 "Gain" = -0.5 }
                    }
                    {
                        type    = builtin
                        name    = eq_band_4
                        label   = bq_peaking
                        control = { "Freq" = 2800.0 "Q" = 1.10 "Gain" = 1.5 }
                    }
                    {
                        type    = builtin
                        name    = eq_band_5
                        label   = bq_highshelf
                        control = { "Freq" = 8500.0 "Q" = 0.70 "Gain" = 0.5 }
                    }
                ]
                links = [
                    { output = "eq_band_1:Out" input = "eq_band_2:In" }
                    { output = "eq_band_2:Out" input = "eq_band_3:In" }
                    { output = "eq_band_3:Out" input = "eq_band_4:In" }
                    { output = "eq_band_4:Out" input = "eq_band_5:In" }
                ]
            }
            audio.channels = 2
            audio.position = [ FL FR ]
            capture.props = {
                node.name        = "effect_input.star-labs-eq"
                node.description = "Internal Speakers"
                media.class      = "Audio/Sink"
                priority.session = 1600
            }
            playback.props = {
                node.name      = "effect_output.star-labs-eq"
                target.object  = "$TARGET_SINK"
                node.passive   = true
            }
        }
    }
]
EOF
```

Notes:

- This only changes your user account, not the whole system.
- You should not need to enter your password.
- The real speaker path is set to 100%; control listening volume using the new `Internal Speakers` output.

## Step 3: Restart PipeWire

Restart the audio services:

```bash
systemctl --user restart pipewire pipewire-pulse wireplumber
```

Audio may briefly stop while the services restart.

If this command reports that one of the services does not exist, reboot instead:

```bash
sudo reboot
```

## Step 4: Select Internal Speakers

Open your sound settings and select `Internal Speakers` as the output device.

If you prefer to use the command line, run:

```bash
wpctl status
```

Find `effect_input.star-labs-eq` under `Filters`, then set it as default with:

```bash
wpctl set-default ID
```

Replace `ID` with the number shown next to `effect_input.star-labs-eq`.

## Verify (optional)

You can check that the EQ is loaded with:

```bash
wpctl status
```

You should see `effect_input.star-labs-eq` under `Filters`.

## Undo (revert the change)

1. Remove the config file:

```bash
rm -f ~/.config/pipewire/pipewire.conf.d/51-star-labs-eq.conf
```

2. Restart PipeWire again:

```bash
systemctl --user restart pipewire pipewire-pulse wireplumber
```

3. Select your normal built-in speaker output again in sound settings.
