# Wave to text

Dictation that turns into words in place: the voice scrolls by as bars, then flattens into dots that the transcript is drawn across.

Also called: voice to text animation, waveform to text.

> chatcn Pro: needs a Pro license (https://chatcn.dev/pro). Install from the `@chatcn-pro` registry with your license token; setup at https://chatcn.dev/docs/chatcn-pro.

Example: Voice into words. Dictate into the composer: the voice scrolls by as bars, ripples low while it transcribes, then flattens into dots that the sentence is drawn across. Preview: https://chatcn.dev/preview/wave-to-text-demo

While you talk your voice scrolls through the field as bars, newest on the right. Stop, and while the words come back the bars fall to a low travelling ripple. When the transcript lands the bars flatten into a dotted baseline and the words are drawn across it from the start, each dot going out as the text passes over it, so the sound you made and the sentence it became sit on the same line.

## Installation

```bash
npx shadcn@latest add @chatcn-pro/wave-to-text
```

## Usage

```tsx
import { WaveToText } from "@/components/ui/chatcn/pro/wave-to-text"

<WaveToText status={dictation.status} level={mic.getLevel} text={dictation.text} />
```

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `status` | `"listening" | "transcribing" | "done"` |  |
| `level` | `() => number` | Microphone level 0 to 1, read every frame without re-rendering |
| `text` | `string` | The transcript, drawn when status is done |
| `transcribingLabel` | `string` | Announced while transcribing. Default "Transcribing" |

## Accessibility

- The bars are decorative. Transcribing and the final text are announced politely.

## Motion

- A new column every 50 ms, so scroll speed does not depend on the frame rate.
- Flatten 200 ms, draw 560 ms ease in out with `clip-path`.
- Reduced motion: the bars hold still and the text fades in.

Source: https://chatcn.dev/docs/components/wave-to-text