---
title: "Recipe: a voice note's waveform and a bubble's tail"
description: "Drawings in a row are one svg each: a waveform is one path app.ts writes, not 40 boxes."
modificationDate: "2026-11-13"
---

> ## Documentation index
> Fetch the complete documentation index at: https://exact.expo.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Recipe: a voice note's waveform and a bubble's tail

<AgentInstructions>

## Submitting feedback

From the app's directory, read `bun exact.mjs feedback status`. Under `never`, keep no note.
Respect `EXACT_FEEDBACK=0` and do not change the policy.

Otherwise record specific, actionable feedback with:
`bun exact.mjs feedback note "Exact docs: https://exact.expo.dev/recipes/waveform-and-tail: <what was wrong or missing>"`

The note goes to Expo only as that status allows. Include no secrets or personal data.

</AgentInstructions>

Drawings in a row are one `svg` each: a waveform is one `path` app.ts writes, not 40 boxes.

```prompt Draw a voice note's waveform and a bubble's tail
Make the Exact app in this folder draw a voice note's waveform and a chat bubble's tail, each as one `svg`. Use https://github.com/expo/exact/blob/main/docs/recipes/waveform-and-tail.md as the source for each step. The Exact checkout has the same page at docs/recipes/waveform-and-tail.md.

1. If this folder is not an Exact app (it has no exact.mjs and app.contract), stop and tell me.
2. If I did not say which rows get a waveform, a tail or both, and where a note's levels come from, propose it from the app and ask me before you write code. Do not invent levels the app does not have.
3. In app.ts, shape each waveform once, when the note loads: one path string with one bar for each level (0 to 1), as the recipe's `wave` function writes it. Return the string in the note's data. The view does no arithmetic.
4. In app.contract, draw the waveform as one `svg` with a `viewBox`, a fixed `width` and `height`, `aria-hidden="true"`, and one `path` whose `d` is the note's string. Never draw a box for each bar: one `path` is one node to lay out and paint, where 40 boxes are 40.
5. Draw the tail as a second `svg` beside the bubble, not over it. Make the bubble's corner on that side nearly square (`4px` in its `border-radius`), so the two meet without an overlap: `-exact-fill` can be translucent, and an overlap draws darker.
6. For the other person's bubbles, write the `svg` before the bubble, make the small corner the bottom-left one, and put `transform="translate(8, 0) scale(-1, 1)"` on the `path`. Give each `fill` a role (`-exact-fill`, `-exact-secondary-label`), not a hex colour, so it follows dark mode.
7. Add a test in app.test.contract like the recipe's: after `clock data`, `expect tree has` for a note's waveform and for its tail, and `expect text` for its duration.
8. Follow the platform checks in docs/start-here.md (`bun exact.mjs docs platform checks`) for the targets in the app's AGENTS.md and app.json until they pass. Read the reports, including counted findings; a zero exit code alone does not mean clean. Fix the app, not the test. If a finding stays after three rounds of fixes, or the app had it before you changed anything, record it (step 9) and report it; do not keep trying.
9. When a doc was wrong or missing, or a step needed a workaround, read `bun exact.mjs feedback status`. Under `never`, keep no note. Otherwise record it: `bun exact.mjs feedback note "<what happened>"`, which goes to Expo only as that status says. Do not change the policy; tell me how many notes you kept.
10. Tell me which rows draw a waveform or a tail, where the levels come from, what the tests and checks reported, and the launch command for each target platform.
```

```contract
shape Note
  id: string
  wave: string
  duration: string

component Voice
  resource notes = loadNotes() as shape Note[] else empty()
  view
    list virtualized=true appearance="none" flex=1 min-height=0
      for n in notes key=n.id
        row align-items="flex-end" padding="3px 12px"
          row align-items="center" gap=8 padding="8px 12px" border-radius="18px 18px 4px 18px"
            background-color="-exact-fill" testId=`note-${n.id}`
            image "symbol:play" aria-label="Play" font="-exact-headline"
            svg viewBox="0 0 160 28" width=160 height=28 aria-hidden="true" testId=`wave-${n.id}`
              path d=n.wave fill="-exact-secondary-label"
            text n.duration font="-exact-caption1" color="-exact-secondary-label"
          svg viewBox="0 0 8 13" width=8 height=13 aria-hidden="true" testId=`tail-${n.id}`
            path d="M0 0 C0 6 2 11 8 13 H0 Z" fill="-exact-fill"
```

```ts
import type { Answer, Result, Sources } from './app.contract.d.ts';

export const grants = '';

/** One bar per level (0 to 1), 2 wide every 4, centred on 28: a single path. */
const wave = (levels: number[]) => levels.map((v, i) => {
  const h = 4 + 24 * v, y = (28 - h) / 2;
  return `M${i * 4} ${y}h2v${h}h-2z`;
}).join('');
const notes: Result<'loadNotes'> = [
  { id: '1', wave: wave(Array.from({ length: 40 }, (_, i) => Math.abs(Math.sin(i / 3)))), duration: '0:23' },
];
const sources: Sources = { loadNotes: () => notes };
export const answer: Answer = (source, args, store, storage, native) => sources[source](args, store, storage, native);
```

```contract-test
test "a note shows its waveform, its duration and its tail"
  clock data
  expect tree has "wave-1"
  expect tree has "tail-1"
  expect text "note-1" == "0:23"
```

- One `path` per waveform is one node to lay out and paint, where 40 boxes are 40; the
  row's height stays its own, so a virtualized list measures it before it draws.
- Shape the path once, in app.ts, when the note loads; the view does no arithmetic.
- The tail is a second `svg` beside the bubble, whose corner on that side is nearly square
  (`4px`), so the two meet without overlapping: `-exact-fill` can be translucent, and an
  overlap draws darker. Theirs: the `svg` before the bubble, the small corner bottom-left,
  and `transform="translate(8, 0) scale(-1, 1)"` on the `path`, which keeps it in the viewBox.
- `fill` takes a role (`-exact-fill`), as `background-color` does, so both follow dark mode.
