# Tempo & BPM API
> Musical timing maths as an API — turn a tempo into exact times. The durations endpoint gives the length of every note value (whole down to sixty-fourth, plus dotted and triplet variants) at a given BPM, in milliseconds, in hertz, and in samples at your sample rate. The delay endpoint is the producer's note-to-millisecond tool: the delay and reverb times for 1/1 to 1/32 (straight, dotted and triplet) so time-based effects lock to the tempo. The bar endpoint gives the duration of a bar for any time signature. The convert endpoint turns BPM into milliseconds per beat (and back) and names the Italian tempo marking — Largo, Adagio, Andante, Moderato, Allegro, Presto and the rest. Everything is computed locally and deterministically, so it is instant and private. Ideal for DAWs and music-production tools, drum machines and sequencers, delay and echo plug-ins, metronomes, and audio apps. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 4 endpoints. This is tempo and rhythm timing; for notes, intervals, chords and scales use a music-theory API.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/tempo-api/..."
```

## Pricing
- **Free** (Free) — 7,735 calls/Mo, 2 req/s
- **Starter** ($9/Mo) — 17,250 calls/Mo, 8 req/s
- **Pro** ($29/Mo) — 223,500 calls/Mo, 20 req/s
- **Mega** ($67/Mo) — 1,160,000 calls/Mo, 50 req/s

## Endpoints

### Tempo

#### `GET /v1/bar` — Bar / measure duration

**Parameters:**
- `bpm` (query, required, string) — Beats per minute Example: `120`
- `time_signature` (query, optional, string) — e.g. 4/4 Example: `4/4`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/tempo-api/v1/bar?bpm=120&time_signature=4%2F4"
```

**Response:**
```json
{
    "data": {
        "bpm": 120,
        "bar_ms": 2000,
        "beat_ms": 500,
        "beat_note": "1/4",
        "beats_per_bar": 4,
        "time_signature": "4/4",
        "bars_per_minute": 30,
        "bars_per_second": 0.5
    },
    "meta": {
        "timestamp": "2026-06-03T17:42:07.199Z",
        "request_id": "219777d8-4532-46d6-b6de-dd7080e96ff0"
    },
    "status": "ok",
    "message": "Bar duration",
    "success": true
}
```

#### `GET /v1/convert` — BPM <-> ms + tempo marking

**Parameters:**
- `bpm` (query, optional, string) — Beats per minute Example: `120`
- `ms` (query, optional, string) — Or ms per beat -> BPM

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/tempo-api/v1/convert?bpm=120"
```

**Response:**
```json
{
    "data": {
        "bpm": 120,
        "marking": "Allegro",
        "ms_per_beat": 500,
        "beats_per_second": 2
    },
    "meta": {
        "timestamp": "2026-06-03T17:42:07.305Z",
        "request_id": "74c1db89-c81d-4c19-ac66-2a8cbb6ebb5d"
    },
    "status": "ok",
    "message": "BPM convert",
    "success": true
}
```

#### `GET /v1/delay` — Tempo-synced delay times

**Parameters:**
- `bpm` (query, required, string) — Beats per minute Example: `128`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/tempo-api/v1/delay?bpm=128"
```

**Response:**
```json
{
    "data": {
        "bpm": 128,
        "note": "set a delay/reverb time in ms (or its rate in Hz) to sync to the tempo",
        "dotted": [
            {
                "hz": 0.355556,
                "ms": 2812.5,
                "division": "1/1 dotted"
            },
            {
                "hz": 0.711111,
                "ms": 1406.25,
                "division": "1/2 dotted"
            },
            {
                "hz": 1.42222,
                "ms": 703.125,
                "division": "1/4 dotted"
            },
            {
                "hz": 2.84444,
                "ms": 351.5625,
                "division": "1/8 dotted"
            },
            {
                "hz": 5.68889,
                "ms": 175.7813,
                "division": "1/16 dotted"
            },
            {
                "hz": 11.3778,
                "ms": 87.89063,
                "division": "1/32 dotted"
            }
        ],
        "triplet": [
            {
                "hz": 0.8,
                "ms": 1250,
                "division": "1/1 triplet"
            },
            {
                "hz": 1.6,
                "ms": 625,
                "division": "1/2 triplet"
            },
            {
                "hz": 3.2,
                "ms": 312.5,
                "division": "1/4 triplet"
            },
            {
                "hz": 6.4,
                "ms": 156.25,
                "division": "1/8 triplet"
            },
            {
     
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/durations` — Note durations at a BPM

**Parameters:**
- `bpm` (query, required, string) — Beats per minute Example: `120`
- `sample_rate` (query, optional, string) — Hz (default 44100) Example: `44100`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/tempo-api/v1/durations?bpm=120&sample_rate=44100"
```

**Response:**
```json
{
    "data": {
        "bpm": 120,
        "dotted": [
            {
                "hz": 0.333333,
                "ms": 3000,
                "note": "whole (dotted)",
                "samples": 132300
            },
            {
                "hz": 0.666667,
                "ms": 1500,
                "note": "half (dotted)",
                "samples": 66150
            },
            {
                "hz": 1.33333,
                "ms": 750,
                "note": "quarter (dotted)",
                "samples": 33075
            },
            {
                "hz": 2.66667,
                "ms": 375,
                "note": "eighth (dotted)",
                "samples": 16538
            },
            {
                "hz": 5.33333,
                "ms": 187.5,
                "note": "sixteenth (dotted)",
                "samples": 8269
            },
            {
                "hz": 10.6667,
                "ms": 93.75,
                "note": "thirty-second (dotted)",
                "samples": 4134
            },
            {
                "hz": 21.3333,
                "ms": 46.875,
                "note": "sixty-fourth (dotted)",
                "samples": 2067
            }
        ],
        "triplet": [
            {
                "hz": 0.75,
                "ms": 1333.333,
                "note": "whole (triplet)",
                "samples": 58800
            },
            {
                "hz": 1.5,
                "ms": 666.6667,
           
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Spec

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/tempo-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "name": "Tempo & BPM API",
        "notes": "BPM counts quarter notes (and the beat note in /v1/bar is the time-signature denominator). A quarter note at 120 BPM is 500 ms. Nothing is stored.",
        "version": "v1",
        "endpoints": [
            {
                "path": "/v1/durations",
                "params": {
                    "bpm": "beats per minute",
                    "sample_rate": "Hz (default 44100)"
                },
                "returns": "every note value's duration in ms, Hz and samples"
            },
            {
                "path": "/v1/delay",
                "params": {
                    "bpm": "beats per minute"
                },
                "returns": "tempo-synced delay/reverb times (straight, dotted, triplet)"
            },
            {
                "path": "/v1/bar",
                "params": {
                    "bpm": "beats per minute",
                    "time_signature": "e.g. 4/4"
                },
                "returns": "the bar/measure duration"
            },
            {
                "path": "/v1/convert",
                "params": {
                    "ms": "or a ms-per-beat to get BPM",
                    "bpm": "beats per minute"
                },
                "returns": "BPM ↔ ms and the Italian tempo marking"
            },
            {
                "path": "/v1/meta",
                "params": [],
                "returns": "this document"
            }
 
…(truncated, see openapi.json for full schema)
```


---
Marketplace page: https://www.oanor.com/api/tempo-api
OpenAPI spec: https://www.oanor.com/api/tempo-api/openapi.json
