# Block phaser

> A phaser and flanger you can plug in: its state, a panel that draws the sweep and an engine that plays it. Play a loop through it, switch the mode and turn the rate and the feedback

A shadcn/ui block from the [@audio-ui](https://www.audio-ui.dev/?utm_source=shadcn.exchange) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/audio-ui/block-phaser).

- Page, with a live preview: https://shadcn.exchange/r/audio-ui/block-phaser
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/audio-ui/block-phaser-light-0593db742aa6ca8a.png
- Registry item: https://www.audio-ui.dev/r/new-york-v4/block-phaser.json
- Listed: 2026-10-17, source last changed 2026-10-17

## Install

```bash
npx shadcn@latest add https://shadcn.exchange/r/audio-ui/block-phaser.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- npm packages: `@audio-ui/react`
- Registry items: `@audio-ui/phaser-panel`, `@audio-ui/phaser-device`, `@audio-ui/phaser-engine`, `@audio-ui/demo-loop`, `@audio-ui/play-toggle`, `@audio-ui/use-device-loop`, `@audio-ui/use-master-bus`

## Files

### `block-phaser.tsx`

```tsx
"use client";

import { useState } from "react";
import { PlayToggle } from "@/components/audio-ui/play-toggle";
import { PhaserPanel } from "@/components/audio-ui/devices/phaser/panel";
import { useDeviceLoop } from "@/hooks/use-device-loop";
import { useMasterBus } from "@/hooks/use-master-bus";
import { DEMO_TEMPO } from "@/lib/demo-loop";
import {
  type PhaserState,
  phaserDevice,
} from "@/components/audio-ui/devices/phaser/device";
import { createPhaserEngine } from "@/components/audio-ui/devices/phaser/engine";

const MASTER_VOLUME = 0.7;
/** The loop's own tempo, so a synced rate moves with its beat. */
const CONTEXT = { tempo: DEMO_TEMPO };

/**
 * A phaser and flanger you can plug in: its state, a panel that draws the sweep and an engine that plays it, each its own file. Play the loop, switch the mode and turn the rate and the feedback.
 */
export function BlockPhaser() {
  const [state, setState] = useState<PhaserState>(() =>
    phaserDevice.defaults()
  );
  const master = useMasterBus(MASTER_VOLUME);
  const { playing, toggle } = useDeviceLoop({
    context: CONTEXT,
    create: createPhaserEngine,
    destination: master,
    state,
  });
  return (
    <div className="rounded-xl h-full w-full min-w-0">
      <PhaserPanel onValueChange={setState} tempo={DEMO_TEMPO} value={state}>
        <PlayToggle
          label="Play a loop through it"
          onToggle={toggle}
          playing={playing}
        />
      </PhaserPanel>
    </div>
  );
}
```
