Catalog/music-samples-per-beat

Music

Samples per beat at sample rate API

Computes the number of audio samples per beat (and per chosen note value) for a BPM and sample rate, both exact and rounded — the buffer math for sample-accurate DSP and looping. Answers 'How many samples per beat at 120 BPM, 44.1 kHz?', 'Samples in a sixteenth note?'.

Price$0.04per request
MethodPOST
Route/v1/music/samples-per-beat
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
musicsamplessample-ratebpmdspbufferaudioloopingproduction
API URLhttps://x402.hexl.dev/v1/music/samples-per-beat
Integration docs
Example request
{
  "bpm": 120,
  "sampleRate": 44100
}
Example response
{
  "bpm": 120,
  "sampleRate": 44100,
  "noteValue": "quarter",
  "secondsPerBeat": 0.5,
  "samplesPerBeat": 22050,
  "samplesPerBeatRounded": 22050,
  "samplesForNoteValue": 22050,
  "samplesForNoteValueRounded": 22050,
  "msPerNoteValue": 500
}
Input schema
{
  "type": "object",
  "required": [
    "bpm"
  ],
  "properties": {
    "bpm": {
      "type": "number",
      "examples": [
        120
      ]
    },
    "sampleRate": {
      "type": "number",
      "examples": [
        44100,
        48000
      ]
    },
    "noteValue": {
      "type": "string",
      "examples": [
        "quarter",
        "eighth"
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}