Skip to main content
Glama
Train Horn SPL MCP

Train Horn SPL MCP

Train Horn SPL MCP

A small, open-source Model Context Protocol server that estimates how a train horn's sound-pressure level changes with distance.

The calculation is free-field only: inverse-square spreading (20 * log10 of the distance ratio) plus, when you give a frequency, ISO 9613-1 atmospheric absorption. It will not replace a calibrated sound level meter, and it does not model ground effect, barriers, wind, or reflections.

Portable, battery-powered train horn kits are often specified at one reference distance. This server is a working notebook for turning that figure into a first-order level at another distance, or for asking how far a chosen target level would fall. For product context on cordless and battery-powered train horns, see Horn Guns.

Tools

Tool

What it does

spl_at_distance

Estimate SPL at target_distance_m from a free-field level at ref_distance_m.

distance_for_target_spl

Solve for the distance at which the estimated SPL equals target_spl_db.

a_weighting

IEC 61672-1 A-weighting in dB at a single frequency.

spl_at_distance / distance_for_target_spl arguments

  • source_spl_db (required): free-field level at the reference distance, in dB

  • ref_distance_m (required): that reference distance, in metres

  • target_distance_m or target_spl_db (required, depending on the tool)

  • frequency_hz (optional): pure-tone frequency for ISO 9613-1 absorption. If omitted, only inverse-square spreading is applied.

  • temperature_c (optional, default 20)

  • humidity_pct (optional, default 70)

  • pressure_kpa (optional, default 101.325)

Every result includes a caveats field stating the limits of the model.

Related MCP server: Personal Agent Auditory Acoustic Decibel Dosimeter Skill

Install and run

Requires Python 3.11+.

With uvx (no install)

uvx --from git+https://github.com/bosshorncom-cmd/train-horn-spl-mcp train-horn-spl-mcp

With pip

pip install git+https://github.com/bosshorncom-cmd/train-horn-spl-mcp
train-horn-spl-mcp

The process speaks MCP over stdio.

MCP config example

Claude Desktop, Cursor, or any MCP host that reads a mcpServers map:

{
  "mcpServers": {
    "train-horn-spl": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/bosshorncom-cmd/train-horn-spl-mcp",
        "train-horn-spl-mcp"
      ]
    }
  }
}

Equivalent pip form:

{
  "mcpServers": {
    "train-horn-spl": {
      "command": "train-horn-spl-mcp"
    }
  }
}

Caveats

  • Free-field point-source estimate only.

  • No ground effect, reflections, barriers, wind, turbulence, or temperature gradients.

  • ISO 9613-1 absorption is defined for a pure tone (or a narrow band). A train horn is broadband; a fuller estimate needs a spectrum.

  • A-weighting is returned at one frequency. An overall dB(A) level also needs that spectrum.

  • Not a substitute for a calibrated Type 1 or Type 2 sound level meter, or for a field measurement.

Development

git clone https://github.com/bosshorncom-cmd/train-horn-spl-mcp
cd train-horn-spl-mcp
uv sync --dev
uv run pytest

License

MIT. Public contact: info@hornguns.com

Available Tools

3 tools
a_weightingA

Return the IEC 61672-1 A-weighting in decibels at one frequency.

Useful when converting a tonal component toward an A-weighted level.
A broadband train horn still needs a spectrum; this is not a complete
dB(A) calculation by itself.

Args:
    frequency_hz: Frequency in hertz (must be > 0).

Inputs: frequency_hz (required). Returns: object

distance_for_target_splA

Estimate the free-field distance at which SPL equals a target level.

Solves the inverse of spl_at_distance numerically. Same model and caveats:
inverse-square spreading, plus ISO 9613-1 absorption when frequency_hz is
set.

Args:
    source_spl_db: Free-field sound-pressure level at the reference
        distance, in decibels.
    ref_distance_m: Distance at which source_spl_db applies, in metres.
    target_spl_db: Desired sound-pressure level, in decibels.
    frequency_hz: Pure-tone frequency for ISO 9613-1 absorption. Leave
        unset to apply spreading only.
    temperature_c: Air temperature in degrees Celsius (default 20).
    humidity_pct: Relative humidity in percent (default 70).
    pressure_kpa: Atmospheric pressure in kilopascals (default 101.325).

Inputs: source_spl_db (required), target_spl_db (required), ref_distance_m (required), frequency_hz, +3 more. Returns: object

spl_at_distanceA

Estimate free-field SPL at a target distance.

Starts from a sound-pressure level already measured or specified at
ref_distance_m and applies inverse-square spreading (20 * log10 of the
distance ratio). If frequency_hz is set, also applies ISO 9613-1
atmospheric absorption over the path difference.

Args:
    source_spl_db: Free-field sound-pressure level at the reference
        distance, in decibels.
    ref_distance_m: Distance at which source_spl_db applies, in metres.
    target_distance_m: Distance at which to estimate the level, in metres.
    frequency_hz: Pure-tone frequency for ISO 9613-1 absorption. Leave
        unset to apply spreading only.
    temperature_c: Air temperature in degrees Celsius (default 20).
    humidity_pct: Relative humidity in percent (default 70).
    pressure_kpa: Atmospheric pressure in kilopascals (default 101.325).

Inputs: source_spl_db (required), ref_distance_m (required), target_distance_m (required), frequency_hz, +3 more. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool targets a distinct operation: forward propagation (spl_at_distance), the numerical inverse (distance_for_target_spl), and a frequency-domain weighting helper (a_weighting). The argument signatures differ clearly (target_distance_m vs target_spl_db), so an agent can pick correctly without reading the bodies.

    Naming Consistency4/5

    All three names are snake_case and follow a consistent 'quantity or model being returned' convention rather than verb_noun (spl_at_distance, distance_for_target_spl, a_weighting). This is predictable and readable, but the lack of a verb prefix makes it slightly less self-documenting than an ideal pattern.

    Tool Count4/5

    Three tools is small but well-matched to a narrowly scoped acoustic calculator: forward model, inverse model, and a weighting utility. Every tool earns its place, with no filler or redundancy.

    Completeness3/5

    The core forward/inverse propagation pair is covered, but the domain surface is incomplete: there is no way to apply A-weighting across a spectrum or to chain weighting with propagation in one call, and the tool description itself admits a_weighting is not a complete dB(A) calculation. Ground reflection, barriers, and multi-band train-horn spectra are also unaddressed.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables calculation of NIOSH/OSHA cumulative noise dose, equivalent continuous sound level (Leq), 8-hour time-weighted average, and Ward-model temporary threshold shift recovery from acoustic exposure inputs.
      MIT
    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables deterministic, zero-dependency audiological analysis of distortion-product emissions, SNR/clinical pass criteria, and outer hair cell fatigue scoring so agents can assess cochlear health and headphone noise overexposure.
      MIT