Catalog/music-decibel

Music

Decibel ratio and sum math API

Performs decibel arithmetic — convert between a ratio and dB (power or amplitude), and logarithmically add or subtract dB levels (e.g. combining incoherent sources) which simple addition gets wrong. Answers 'What is 90 dB + 90 dB?', 'How many dB is a 2x amplitude gain?'.

Price$0.04per request
MethodPOST
Route/v1/music/decibel
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
musicdecibeldbloudnessgainspldbfsaudioacoustics
API URLhttps://x402.hexl.dev/v1/music/decibel
Integration docs
Example request
{
  "op": "sum",
  "values": [
    90,
    90
  ]
}
Example response
{
  "op": "sum",
  "values": [
    90,
    90
  ],
  "totalDb": 93.0103,
  "increaseOverLoudest": 3.0103,
  "formula": "10·log10(Σ 10^(dBi/10))"
}
Input schema
{
  "type": "object",
  "required": [
    "op"
  ],
  "properties": {
    "op": {
      "type": "string",
      "enum": [
        "ratio-to-db",
        "db-to-ratio",
        "sum",
        "subtract"
      ],
      "examples": [
        "sum",
        "ratio-to-db"
      ]
    },
    "value": {
      "type": "number",
      "description": "dB level (db-to-ratio, subtract total)"
    },
    "values": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "examples": [
        [
          90,
          90
        ]
      ]
    },
    "ratio": {
      "type": "number",
      "description": "linear ratio (ratio-to-db) or second dB level (subtract)"
    },
    "isPower": {
      "type": "boolean",
      "description": "true=power (10·log), false=amplitude (20·log)"
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}