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

# Sound models

> Train models on audio clips with the train-anything engine, then run them offline on your own hardware.

Source: https://docs.heurastudios.com/build/sound-models/

Heura Studios isn't limited to language models. The **train-anything engine** trains on rows of any kind: text, pictures or sound in; text, a label, a command or a number out. Sound is the first family beyond text: record clips in the browser, label them, train, and download a model that listens on your own computer.

*Diagram: A sound model: record or upload 2-second WAV clips and label each; the sound base (an Audio Spectrogram Transformer with a LoRA) learns the labels; downloaded, it listens on your computer and prints each label's command as one JSON line to your program, for example toggling lights on two claps. Nothing it hears leaves the computer.*

*The clap switch: two claps at the calibrated level become one JSON line for your program.*

## How the engine works

- **Rows.** Each row has an input (text, image or audio) and the right output (text, a label, a command or a number), and is marked as an example (trained on) or a test (held out).
- **Families.** The engine picks the base from the rows: Heura Arche for text, the sound base for audio clips. A model's settings can override it.
- **Judges.** Each kind of output has a judge: text uses must and must-not items, a label must match, a command must have the same fields and values (order, case and spacing aside), and a number must fall within the test's tolerance. Misses and false triggers are counted separately. Pass rates, held-out marking and the release gate work the same for every kind.

## Recording clips

Sound models add a **clips** tab to the notebook:

- **Record** 2 seconds from the microphone, or **upload** a WAV.
- **Label** each clip, and mark it as an example or a test.
- Play or delete any clip, and set the **trigger**: the label that fires the command.

Record your trigger in the conditions it will meet (rooms, distances, background noise), and record what it should ignore as labeled negatives.

## Training

A sound run trains up to 3 rounds of 3 epochs each, until 80% of the test clips pass. The sound base is an Audio Spectrogram Transformer trained on AudioSet, with a LoRA on its attention and a new label head for your labels. Each version records the library versions it was trained with, and a version that scores lower than the live one stays out unless the owner makes it live. Sound runs and text runs take turns on the trainer.

## Running it on your computer

Download the model from **Output**. The package holds `LISTEN.txt`, the listener in `runtime/listen.py`, an example program and the adapter:

```bash
# once, from where you'll clap: clap twice while a sound meter reads the level
python3 runtime/listen.py calibrate --db 110

# then listen, and start your program on each trigger
python3 runtime/listen.py --run "python3 example_lights.py"
```

When it hears the trigger at or above the calibrated level, and the model agrees, it prints the command as one JSON line, and with `--run` starts your program with that line on its standard input. Nothing it hears leaves the computer.

> **Note:**
>
> Today the engine trains text and sound clips. More kinds of input and output are in development.
