# Channel EQ

> A channel EQ device: a low shelf, a sweepable mid bell, a high shelf, a high-pass switch and an output level, a panel with a handle on the mid band, a Web Audio engine and tools for agents.

```tsx
import { useState } from "react";
import {
  type ChannelEqState,
  channelEqDevice,
} from "@/components/audio-ui/devices/channel-eq/device";
import { createChannelEqEngine } from "@/components/audio-ui/devices/channel-eq/engine";
import { ChannelEqPanel } from "@/components/audio-ui/devices/channel-eq/panel";
import { useDeviceLoop } from "@/hooks/use-device-loop";
import { useDeviceSignal } from "@/hooks/use-device-signal";
import { useMasterBus } from "@/hooks/use-master-bus";
import { useDemoSound } from "@/hooks/use-demo-source";

const MASTER_VOLUME = 0.7;

/**
 * A channel EQ you can plug in: its state, a panel that draws the curve it
 * plays with a handle on the mid band and an engine that plays it, each its
 * own file and none knowing the others. Play the loop and drag the handle: the
 * spectrum behind is what comes out.
 */
export function BlockChannelEq() {
  const [state, setState] = useState<ChannelEqState>(() =>
    channelEqDevice.defaults()
  );
  const master = useMasterBus(MASTER_VOLUME);
  const sound = useDemoSound("groove");
  const { engine } = useDeviceLoop({
    create: createChannelEqEngine,
    destination: master,
    sound,
    state,
  });
  const signal = useDeviceSignal(engine, channelEqDevice);
  return (
    <div className="rounded-xl h-full w-full min-w-0">
      <ChannelEqPanel onValueChange={setState} signal={signal} value={state} />
    </div>
  );
}
```

The EQ of a mixer strip, simpler than the [equalizer](/docs/components/base/equalizer): a low shelf, a mid bell you sweep, a high shelf and a high-pass for the rumble. It is a [device](/docs/devices): a state, a panel, an engine and tools, each its own file.

## Installation

**CLI**

```bash
npx shadcn@latest add @audio-ui/channel-eq
```

It installs the device's state, its engine and its panel to `components/audio-ui/devices/channel-eq/`. The demo above, which wires them to a loop, is `@audio-ui/block-channel-eq`.

**Manual**

**1. Install the packages:**

```bash
npm install @ui-sdk/core@0.1.0-beta.14 @ui-sdk/react@0.1.0-beta.14
```

**2. Add the pieces you want. All of them, or only the state and the panel if your engine is elsewhere:**

```bash
npx shadcn@latest add @audio-ui/channel-eq-device @audio-ui/channel-eq-panel @audio-ui/channel-eq-engine
```

**3. Copy and paste the demo that wires them, if you want it.**

```tsx title="components/examples/block-channel-eq.tsx"
import { useState } from "react";
import {
  type ChannelEqState,
  channelEqDevice,
} from "@/components/audio-ui/devices/channel-eq/device";
import { createChannelEqEngine } from "@/components/audio-ui/devices/channel-eq/engine";
import { ChannelEqPanel } from "@/components/audio-ui/devices/channel-eq/panel";
import { useDeviceLoop } from "@/hooks/use-device-loop";
import { useDeviceSignal } from "@/hooks/use-device-signal";
import { useMasterBus } from "@/hooks/use-master-bus";
import { useDemoSound } from "@/hooks/use-demo-source";

const MASTER_VOLUME = 0.7;

/**
 * A channel EQ you can plug in: its state, a panel that draws the curve it
 * plays with a handle on the mid band and an engine that plays it, each its
 * own file and none knowing the others. Play the loop and drag the handle: the
 * spectrum behind is what comes out.
 */
export function BlockChannelEq() {
  const [state, setState] = useState<ChannelEqState>(() =>
    channelEqDevice.defaults()
  );
  const master = useMasterBus(MASTER_VOLUME);
  const sound = useDemoSound("groove");
  const { engine } = useDeviceLoop({
    create: createChannelEqEngine,
    destination: master,
    sound,
    state,
  });
  const signal = useDeviceSignal(engine, channelEqDevice);
  return (
    <div className="rounded-xl h-full w-full min-w-0">
      <ChannelEqPanel onValueChange={setState} signal={signal} value={state} />
    </div>
  );
}
```

**Agent**

Paste this prompt to your agent. It does the rest: it installs the skill, adds the component and wires it to your audio.

```text
Install the audio/ui skill with `npx skills add ouestlabs/audio-ui`, then follow it to add the channel eq from audio/ui to my project and wire it to my audio code. Read the docs at https://www.audio-ui.dev/llms.txt first.
```

To let the agent read the docs live, connect the [MCP server](/docs/mcp). More in [Agent Skill](/docs/agents).

## Controls

| Control | Range | Default | What it does |
| --- | --- | --- | --- |
| On | On or off | On | Turns the device on. Off, the signal passes through unchanged. |
| HP 80 Hz | On or off | Off | Cuts everything under 80 Hz. |
| Low | -15 dB to 15 dB | 0 dB | The gain of the low shelf, at 100 Hz. |
| Mid freq | 120 Hz to 7.5 kHz | 1 kHz | The centre of the mid bell. Drag the handle on the curve across to set it. |
| Mid | -12 dB to 12 dB | 0 dB | The gain of the mid bell. Drag the handle up or down to set it. |
| High | -15 dB to 15 dB | 0 dB | The gain of the high shelf, at 6 kHz. |
| Output | -12 dB to 12 dB | 0 dB | The level of the output. |

## Panel

The panel draws the curve of the four filters and the output level, with a handle on the mid band.

```tsx
import { ChannelEqPanel } from "@/components/audio-ui/devices/channel-eq/panel";
import { channelEqDevice } from "@/components/audio-ui/devices/channel-eq/device";

const [state, setState] = useState(() => channelEqDevice.defaults());

<ChannelEqPanel onValueChange={setState} value={state} />;
```

## Engine

Create it, connect it and update it as for any device: see [The engine](/docs/devices#the-engine).

Four filters in series and an output gain, the same the curve draws. With the high-pass off, it is a 10 Hz high-pass, which passes the whole spectrum, so the curve and the sound agree. `channelEqBands(state)` gives the filters.
