# Detector

class in `@dioramajs/audio/beat`

```ts
import { Detector } from '@dioramajs/audio/beat'
```

Beats from the energy of each frame: a rise above the running average by a margin, and near the
loudest recent energy (so a hi-hat between kicks is not one), no sooner than GAP after the last
beat. The sensitivity lowers both bars. Returns the strength 0..1 of a beat on this frame, 0 for
none. Deterministic: the same frames give the same beats.

```ts
class Detector
```

## Members

| Name | Type | Description |
| --- | --- | --- |
| `constructor` | `constructor(): Detector` |  |
| `reset` | `reset(): void` | Forgets the average, as after a pause or a seek. |
| `step` | `step(value: number, dt: number, sensitivity: number): number` | Takes the energy of one frame `dt` s long. |

Defined in [packages/audio/src/beat.ts](https://github.com/MasterKurosava/diorama/blob/main/packages/audio/src/beat.ts#L153).
