[Developers]

PSAP CPR Cadence Engine

Someone calls 911. Their spouse has collapsed, isn't breathing, and has no pulse. The caller has never performed CPR. The nearest paramedic unit is six minutes out. In that gap, the CPR Cadence Engine takes over.

Category: GeospatialLast Updated: Apr 2, 2026
geospatialai

Overview#

Someone calls 911. Their spouse has collapsed, isn't breathing, and has no pulse. The caller has never performed CPR. The nearest paramedic unit is six minutes out. In that gap, the CPR Cadence Engine takes over.

When the AI voice assistant identifies a cardiac arrest scenario and activates a CPR protocol, the Cadence Engine generates a precise 110 BPM metronome tone and injects it directly into the active phone call as mulaw-encoded audio frames. The caller hears an audible beat to compress to, while the AI continues checking in and giving guidance. The engine maintains drift-corrected timing, pauses intelligently when the caller speaks, and performs automatic check-ins every 60 beats to confirm the caller's status.

This capability enables PSAP AI systems to deliver life-saving CPR coaching over the phone without requiring a human dispatcher to count aloud, while maintaining medically accurate compression timing consistent with American Heart Association guidelines.

Key Features#

  • 110 BPM Drift-Corrected Timing: The cadence loop uses wall-clock drift correction on each beat to maintain precise 110 BPM timing (approximately 545ms per beat) over extended CPR sessions. Timing accuracy is maintained regardless of system load or audio processing latency.

  • Precomputed Audio Tables: A 64K-entry PCM16-to-mulaw lookup table is precomputed at module load time, enabling O(1) per-sample encoding. Resampling index arrays for common Twilio chunk sizes are cached (limited to 64 entries) to avoid repeated numpy allocations every 20ms.

  • Caller-Aware Pausing: The cadence engine pauses automatically when the caller is speaking, preventing the metronome from interfering with voice communication. The engine resumes when speech ends without requiring manual intervention.

  • Automatic Check-Ins: Every 60 beats (approximately 33 seconds), the cadence engine pauses to allow the AI to check in with the caller, asking about the patient's status and the caller's ability to continue. At the two-minute mark (220 beats), a longer check-in assesses whether the patient has regained consciousness or breathing.

  • Session-Level State Management: Each active cadence session tracks beat count, BPM, paused/stopped state, and check-in interval. Multiple concurrent cadence sessions across different calls are supported without interference.

  • Non-Blocking Error Handling: The cadence engine never blocks on errors. If audio generation or WebSocket transmission fails, the engine logs the error and continues the timing loop, ensuring the caller is not left in silence during a critical medical emergency.

Use Cases#

  • AI-Guided CPR: When a caller reports a person who is unresponsive and not breathing, the AI voice assistant activates the CPR protocol and starts the cadence engine, providing the caller with an audible timing guide for chest compressions.
  • Bystander Assistance: Untrained bystanders performing CPR for the first time receive consistent, accurate compression timing without requiring a human dispatcher to count aloud, freeing dispatchers for other emergency coordination.
  • Extended CPR Sessions: The cadence engine maintains accurate timing over sessions lasting 10 minutes or more, with regular check-ins that monitor both the patient's condition and the caller's physical endurance.

Integration#

The CPR Cadence Engine is activated by the medical protocol state machine when a CPR step is reached in the active protocol. It connects to the voice AI session for speech detection and pause control, and the call summary service for recording cadence activation in the incident timeline.

Open Standards#

  • ITU-T G.711 (µ-law): The cadence engine generates and transmits audio exclusively as G.711 µ-law-encoded PCM at 8 kHz mono, matching the telephony codec mandated by the PSTN and used by Twilio Media Streams for all call audio.
  • RFC 6455 (WebSocket): Beat audio frames are injected into the live call via a JSON-framed WebSocket connection (Twilio Media Streams protocol), which is built on the IETF WebSocket standard.
  • AHA/ERC CPR Guidelines (100, 120 BPM): The default cadence of 110 BPM and the two-minute check-in interval directly implement the compression-rate and rescuer-endurance recommendations from the American Heart Association and European Resuscitation Council guidelines.
  • NENA i3 / NENA-STA-010 (NG9-1-1): The SOP protocol engine that activates the cadence operates within the wider NG9-1-1 call-processing architecture; incident records conform to NENA-STA-010 EIDO structures, and call-quality scoring references NENA/APCO answer-time standards.
  • APCO/NENA Pre-Arrival Instruction Standards: The structured SOP cards (adult CPR, infant CPR, choking) follow the step-by-step pre-arrival instruction methodology defined by APCO and NENA for PSAP caller guidance, including critical-step marking and dispatcher briefing templates.
  • SIP (RFC 3261): The underlying PSAP call session that the cadence engine injects audio into is established and managed over SIP; the G.711 codec negotiation and call-leg signalling rely on SIP/SDP.

Last Reviewed: 2026-04-02 Last Updated: 2026-04-14

Ready to Build?

Get started with our APIs or contact our integration team for support.