Stream audio. Hear back every 2 seconds.
Send 16 kHz PCM from a microphone, a browser tab, a phone bridge or a server. Auscultare reads it in short overlapping stretches and answers as you go: each stretch, a rolling answer, and an alert when the voice turns not original.
- ready{"sessionId":"0b9e4c1a-7d3f-4e2b-a5c6-1f8e9d7c6b5a","model":{"name":"TrueSound","version":"2.1","demo":false},"windowSec":4,"hopSec":2,"rollingWindows":6,"remainingSec":1740,"maxSessionSec":3600,"note":null}
- status{"state":"listening"}
- 4.0swindow{"index":0,"start":0,"end":4,"speech":0.82,"signal":0.21,"flag":false,"lean":null}
- 4.0srolling{"at":4,"label":"inconclusive","signal":null,"lean":null,"windows":1}
- 6.0swindow{"index":1,"start":2,"end":6,"speech":0.91,"signal":0.17,"flag":false,"lean":null}
- 6.0srolling{"at":6,"label":"original","signal":0.19,"lean":null,"windows":2}
- 18.0swindow{"index":7,"start":14,"end":18,"speech":0.88,"signal":0.79,"flag":true,"lean":"ai_generated"}
- 18.0srolling{"at":18,"label":"ai_generated","signal":0.68,"lean":0.81,"windows":6}
- 18.0salert{"at":18,"label":"ai_generated","signal":0.68,"alertId":"c4d2e9f1-5a6b-4c7d-8e9f-0a1b2c3d4e5f"}
- usage{"seconds":30,"remainingSec":1710}
In short
Open wss://…/api/v1/live with a ticket (browsers) or your key (servers), send a start message, then binary frames of 16 kHz mono PCM16. Every 2 seconds you get a window event and a rolling answer over the last stretches with speech; an alert fires when that answer turns not original. Audio is never stored.
How a session goes
- ConnectServers send the key as
Authorization: Beareron the upgrade. Browsers and the extension use a one-use ticket in the URL. - Say startThe first message is JSON:
startwith the audio format. Frames sent before it are refused. - StreamBinary frames of 16 kHz mono PCM16, little-endian, as the audio comes. 250 ms frames are a good size.
- Listen
windowfor each stretch,rollingfor the answer so far,alertwhen it turns not original. - StopSend
stop(or close the socket).endbrings the session’s summary.
One engine, four doors
The app, the API, the Chrome extension and phone calls all reach the same streaming engine. The first three speak the protocol on this page.
| Door | URL | Sign-in |
|---|---|---|
| The app’s Live page | URLwss://auscultare.io/api/live?ticket=… | Sign-inThe session cookie, through a ticket |
| Your code | URLwss://auscultare.io/api/v1/live | Sign-inBearer key (servers) or ticket (browsers) |
| The Chrome extension | URLwss://auscultare.io/api/v1/live?ticket=… | Sign-inTicket from the extension’s key |
| Phone calls (Twilio) | URLwss://auscultare.io/api/telephony/twilio/<token> | Sign-inThe connector’s secret URL |
Tickets for browsers
A browser cannot set headers on a WebSocket and must never hold a key. Your server asks POST /api/v1/live/tickets with the key and hands the page the ticket: it works once, within 60 seconds.
Your server (Express): the key stays here, the page gets a one-use ticket
app.post('/auscultare/ticket', async (req, res) => {
// Check your own user's session first: whoever gets a ticket can listen on your workspace's allowance.
const r = await fetch('https://auscultare.io/api/v1/live/tickets', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.AUSCULTARE_KEY}` },
});
res.status(r.status).json(await r.json()); // { ticket, url, expiresAt }: one use, valid 60 s
});The start message
| Field | Type | Meaning |
|---|---|---|
| type | Type"start" | MeaningAlways start. |
| sampleRate | Type16000 | MeaningAlways 16000. |
| encoding | Type"pcm_s16le" | MeaningAlways pcm_s16le. |
| channels | Type1 | MeaningAlways 1 (mono). |
| label | Typestring? | MeaningWhat is being listened to, up to 120 characters (“Team call”). Shown in History. |
| input | Typestring? | Meaningmicrophone, tab, file, phone or other. For display. |
| model | Typestring? | MeaningA model id from GET /models; the default when left out. |
| windows | Typeboolean? | Meaningfalse sends only rolling, alert and end events. Default true. |
Any other format answers an error with bad_format.
{
"type": "start",
"sampleRate": 16000,
"encoding": "pcm_s16le",
"channels": 1,
"label": "Team call",
"input": "microphone",
"model": "truesound-2.1",
"windows": true
}Audio frames
- Signed 16-bit little-endian PCM, mono, 16000 Hz, in binary frames.
- Any length up to 64 KB a frame; 100 ms to 1 s is typical.
- Send as the audio comes, in real time.
- Send the start message within 15 seconds of opening the socket.
- 30 seconds without audio end the session (
idle_timeout). - A session lasts up to 60 minutes (60 seconds with a development key); start a new one right after.
- Sessions at once per workspace, every door and every phone track included: Free 3, Pro 10, Enterprise 50.
Timing
- The protocol reads stretches of 4 s, one every 2 s, once 4 s have arrived.
- The rolling answer covers the last 6 stretches with speech, about 14 s of audio: the same reading a file scan gives a clip of that length. It stays inconclusive until 2 stretches with speech have arrived.
- A stretch with under 30% speech, or under half a second of it, is not scored (its
signalis null). - An alert fires when the rolling answer turns not original, and again only after it went back to original or after 60 s.
- After a quiet spell the model takes about 25 s to start:
status: waking_model, and your audio is kept and read as soon as it is up.
Events
JSON text frames, one event each.
| Event | When |
|---|---|
| ready | WhenThe session is open: its id, the model, the timing, the seconds you may still use and the longest it may run. |
| status | Whenwaking_model while the model starts, then listening. |
| window | WhenOne stretch read: start, end, its share of speech, signal (null with too little speech), flag and lean. |
| rolling | WhenThe answer over the last stretches with speech: label (inconclusive until enough speech), signal, lean. |
| alert | WhenThe rolling answer turned not original. Also sent to your webhooks as live.alert. |
| usage | WhenEvery 10 s: seconds used in this session and seconds left this month. |
| error | WhenA code, a message and recoverable: false means the server closes next. |
| end | WhenWhy the session ended and its summary: the answer over the whole session, like a file scan. |
{"type":"ready","sessionId":"0b9e4c1a-7d3f-4e2b-a5c6-1f8e9d7c6b5a","model":{"name":"TrueSound","version":"2.1","demo":false},"windowSec":4,"hopSec":2,"rollingWindows":6,"remainingSec":1740,"maxSessionSec":3600,"note":null}
{"type":"status","state":"listening"}
{"type":"window","index":0,"start":0,"end":4,"speech":0.82,"signal":0.21,"flag":false,"lean":null}
{"type":"rolling","at":4,"label":"inconclusive","signal":null,"lean":null,"windows":1}
{"type":"window","index":1,"start":2,"end":6,"speech":0.91,"signal":0.17,"flag":false,"lean":null}
{"type":"rolling","at":6,"label":"original","signal":0.19,"lean":null,"windows":2}
{"type":"window","index":7,"start":14,"end":18,"speech":0.88,"signal":0.79,"flag":true,"lean":"ai_generated"}
{"type":"rolling","at":18,"label":"ai_generated","signal":0.68,"lean":0.81,"windows":6}
{"type":"alert","at":18,"label":"ai_generated","signal":0.68,"alertId":"c4d2e9f1-5a6b-4c7d-8e9f-0a1b2c3d4e5f"}
{"type":"usage","seconds":30,"remainingSec":1710}Error codes
| Code | Meaning |
|---|---|
| unauthorized | MeaningNo key or ticket, or one that is not valid (or a ticket used twice). |
| bad_format | MeaningThe start message asks for a format other than 16 kHz mono PCM16. |
| not_started | MeaningAudio arrived before the start message. |
| frame_too_large | MeaningA frame over 64 KB. |
| quota_exceeded | MeaningThe month’s live minutes are used up; the session ends. |
| plan_required | MeaningThe plan has no live listening. |
| too_many_sessions | MeaningToo many sessions at once in this workspace. |
| session_too_long | MeaningThe session reached 60 minutes. |
| idle_timeout | MeaningNo audio for 30 seconds. |
| detector_unavailable | MeaningThe detector could not answer. |
| internal | MeaningSomething broke on our side. |
Clients
A microphone in the browser, a file streamed from Node.js, the same from Python. Turn browser noise suppression off: it changes real voices, and real speech through strong noise suppression is wrongly flagged more often.
live.js · a microphone, read as you speak
const WORKLET = `class Pcm16 extends AudioWorkletProcessor {
constructor() {
super();
this.step = sampleRate / 16000; // e.g. 3 at 48 kHz
this.pos = 0; this.sum = 0; this.count = 0;
this.out = new Int16Array(4000); this.n = 0; // 250 ms
}
process(inputs) {
const input = inputs[0][0];
if (!input) return true;
for (let i = 0; i < input.length; i++) {
this.sum += input[i]; this.count++;
if (++this.pos >= this.step) {
this.pos -= this.step;
const s = Math.max(-1, Math.min(1, this.sum / this.count));
this.sum = 0; this.count = 0;
this.out[this.n++] = s < 0 ? s * 0x8000 : s * 0x7fff;
if (this.n === this.out.length) {
this.port.postMessage(this.out.buffer, [this.out.buffer]);
this.out = new Int16Array(4000); this.n = 0;
}
}
}
return true;
}
}
registerProcessor('pcm16', Pcm16);`;
export async function listen({ onRolling, onAlert } = {}) {
// 1. A one-use ticket from YOUR server (never put an API key in a page).
const { url } = await (await fetch('/auscultare/ticket', { method: 'POST' })).json();
// 2. The microphone. Browser noise suppression changes real voices: turn it off.
const media = await navigator.mediaDevices.getUserMedia({
audio: { channelCount: 1, noiseSuppression: false, echoCancellation: false, autoGainControl: false },
});
const ctx = new AudioContext();
await ctx.audioWorklet.addModule(URL.createObjectURL(new Blob([WORKLET], { type: 'text/javascript' })));
const source = ctx.createMediaStreamSource(media);
const pcm = new AudioWorkletNode(ctx, 'pcm16');
const mute = new GainNode(ctx, { gain: 0 });
source.connect(pcm).connect(mute).connect(ctx.destination);
// 3. The socket: "start" first, then binary frames of 16 kHz PCM16.
const ws = new WebSocket(url);
ws.binaryType = 'arraybuffer';
let ready = false;
ws.onopen = () => ws.send(JSON.stringify({ type: 'start', sampleRate: 16000, encoding: 'pcm_s16le', channels: 1, input: 'microphone', label: 'Browser' }));
pcm.port.onmessage = (e) => ready && ws.readyState === WebSocket.OPEN && ws.send(e.data);
ws.onmessage = (e) => {
const ev = JSON.parse(e.data);
if (ev.type === 'ready') ready = true;
else if (ev.type === 'status') console.log(ev.state); // waking_model, then listening
else if (ev.type === 'rolling') onRolling?.(ev.label, ev.signal); // the answer over the last ~14 s of speech
else if (ev.type === 'alert') onAlert?.(ev);
else if (ev.type === 'error' && !ev.recoverable) console.error(ev.code, ev.message);
else if (ev.type === 'end') console.log('session', ev.reason, ev.summary.label);
};
return function stop() {
if (ws.readyState === WebSocket.OPEN) ws.send(JSON.stringify({ type: 'stop' }));
media.getTracks().forEach((t) => t.stop());
void ctx.close();
};
}Nothing is recorded
Live audio is never stored. Only the events and the session’s summary are kept, without audio, for GET /api/v1/live/sessions. Usage counts the seconds streamed against the workspace’s live minutes.
Live listening is on Free, Pro, and Enterprise.