Commit Graph

40 Commits

Author SHA1 Message Date
Logan Cusano ceb2836371 Raise tail pad to 3s so short transmissions are not clipped
The recording window is anchored to OP25 control-channel timestamps, but
the buffered audio lags those by roughly 1.5s. Trim logs across seven
calls measured the offset at 0.84-1.62s, consistently present.

At a 1.0s pad a short call closed its window before the voice arrived:
a 0.97s control-channel call closed at T+1.97 while voice started around
T+1.5, capturing ~0.4s of speech and cutting mid-word. Confirmed by a
0.57s file whose final 0.10s measured -12.2dB against its own -18.2dB
average - clipped speech, not a tail - and by two short calls that
logged no trim at all because no trailing silence remained.

Being generous is free here: trim_silence already strips trailing
silence back to the guard margin before upload, so long calls are
unaffected while short ones gain the window they need. Over-capture
costs nothing; under-capture loses words permanently.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 22:34:17 -04:00
Logan Cusano 7c4a3f2f20 Make PulseAudio readiness mean a live connection, clear stale socket state
The pulse_socket named volume survives container recreation, so after a
compose recreate the previous container's /run/pulse/pid and native
socket were still present. PulseAudio read the stale pid file, decided a
daemon was already running, and refused to start:

    E: [pulseaudio] pid.c: Daemon already running.

The entrypoint still reported "PulseAudio socket ready" because it only
checked that the socket file existed - and a stale one did. Capture then
failed in a restart loop against a dead daemon.

Readiness in both the op25 entrypoint and drb-edge-node now means a
pactl probe actually succeeds. Stale pid/socket are removed only when
that probe fails, so a live daemon's socket is never deleted.

pulseaudio-utils was missing from the edge-node image (only libpulse0
was installed), so no pactl binary existed there at all - added.

Capture exits are now classified: a missing source logs at ERROR and
names the configured PULSE_SOURCE, rather than looking identical to
"daemon not up yet". Retrying forever against a wrong source name is how
the April PulseAudio failure stayed hidden.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 22:10:28 -04:00
Logan Cusano b0a8ed2a5a Fix tail truncation, decouple call length from buffer, trim silence
CI / lint (push) Failing after 4s
CI / test (push) Successful in 21s
Measured six recordings off a live P25 node and found two independent
defects causing lost audio at the end of calls:

- stop_recording() sliced the ring buffer immediately, so if the MP3
  muxer had not yet delivered the tail the file was silently short.
  Now waits (bounded, 2s) until buffered audio covers the end epoch.
- TGID-change closes used the new grant's epoch as the end with no pad
  at all, guaranteeing truncation on every split. Tail pad is now a
  setting, default raised 0.5s -> 1.0s.

The ring buffer also capped maximum call length: a call longer than the
buffer had its front silently clamped. The ring now serves the pre-roll
only, with a per-call accumulator for the rest, bounded at 4.8MB.
Clamping is loudly warned rather than silent.

Uploads averaged 63% silence, which inflates STT cost and is a known
Whisper hallucination trigger. Leading/trailing silence is now trimmed
conservatively (-40dB, 0.25s guard, internal pauses untouched).
started_at/ended_at still describe the call; new audio_* fields carry
the trimmed audio bounds so playback can map back to wall clock.
All-silence recordings are skipped and logged instead of uploaded.

Also: log measured control-channel idle on idle-timeout closes so
CALL_IDLE_TIMEOUT can be tuned from data, and quiet the httpx logger
which emitted ~170k lines/day of poll noise.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 21:39:36 -04:00
Logan Cusano efdbe7d803 Move recording and Discord voice to PulseAudio
CI / lint (push) Failing after 26s
CI / test (push) Successful in 41s
2026-08-04 19:53:45 -04:00
Logan Cusano 9addce7716 chore: Update Makefile targets for local building and git update shorthand 2026-07-13 00:16:50 -04:00
Logan Cusano cc9af6ff26 feat: Buffer offline call_end events and relay them upon MQTT reconnection 2026-07-13 00:16:24 -04:00
Logan Cusano 857325af85 feat: Add local system override and manual entry controls with offline systems caching
CI / lint (push) Failing after 5s
CI / test (push) Successful in 19s
Build edge-node / build (push) Successful in 32s
2026-07-12 23:06:05 -04:00
Logan Cusano 9f026fa262 update: scanner dashboard UI and Docker configuration for edge node
CI / lint (push) Failing after 5s
CI / test (push) Successful in 20s
Build edge-node / build (push) Successful in 33s
2026-07-12 21:44:36 -04:00
Logan Cusano 3fbdc50536 feat: implement FastAPI router, web + local UI updates, and metadata monitoring for the edge node
CI / lint (push) Failing after 31s
CI / test (push) Successful in 45s
Build edge-node / build (push) Successful in 8m44s
2026-07-12 21:30:30 -04:00
Logan 16f6e0de95 audio fixes attempt
CI / lint (push) Failing after 6s
CI / test (push) Successful in 19s
Build edge-node / build (push) Successful in 7m54s
Build op25 / build (push) Successful in 1h25m50s
2026-05-23 14:59:48 -04:00
Logan dccbab00d6 feat: bot Discord presence + system name on voice join
CI / lint (push) Failing after 35s
CI / test (push) Successful in 46s
Build edge-node / build (push) Successful in 11m13s
- RadioBot.join() accepts system_name parameter
- Sets bot activity to ActivityType.listening → system name on connect
- Clears presence (activity=None) on leave
- main.py passes system_name from MQTT payload to radio_bot.join()
2026-05-10 19:47:22 -04:00
Logan ad9d128522 Install deps with setup
CI / lint (push) Successful in 5s
CI / test (push) Successful in 18s
2026-04-21 23:40:06 -04:00
Logan 36f82d9e3d Use UV for pip
CI / lint (push) Successful in 5s
CI / test (push) Successful in 19s
Build edge-node / build (push) Successful in 1m40s
2026-04-21 22:36:09 -04:00
Logan 177aa52175 Fix compose
CI / lint (push) Successful in 5s
CI / test (push) Successful in 19s
2026-04-21 22:23:15 -04:00
Logan 432e455853 Add updates
CI / lint (push) Successful in 6s
CI / test (push) Successful in 21s
Build edge-node / build (push) Successful in 38s
2026-04-21 01:51:40 -04:00
Logan 0bc80b92bd remove validation step
CI / lint (push) Successful in 4s
CI / test (push) Successful in 18s
2026-04-21 01:12:33 -04:00
Logan 7ede156d07 Add run workflow on demand
CI / lint (push) Successful in 4s
CI / test (push) Successful in 18s
2026-04-21 01:08:38 -04:00
Logan 5c3860eb28 Update secret
CI / lint (push) Successful in 5s
CI / test (push) Successful in 18s
2026-04-21 01:04:40 -04:00
Logan d0e4734cf9 Linting + touches
CI / lint (push) Successful in 8s
Build edge-node / build (push) Failing after 22s
Build icecast / build (push) Failing after 23s
CI / test (push) Successful in 23s
Build op25 / build (push) Failing after 16s
2026-04-21 00:56:50 -04:00
Logan c5984f6318 CI Fixes 2
CI / lint (push) Failing after 4s
CI / test (push) Successful in 18s
2026-04-21 00:51:12 -04:00
Logan 2b8578a1c4 CI Fixes
CI / test (push) Failing after 4s
CI / lint (push) Failing after 3s
2026-04-21 00:45:27 -04:00
Logan 01496ea9e7 Bump version, add builds, add setup
CI / lint (push) Failing after 42s
CI / test (push) Failing after 45s
Build edge-node / build (push) Failing after 1m42s
2026-04-20 00:14:50 -04:00
Logan 6ac05eff64 more call recording fixes 2026-04-19 16:38:15 -04:00
Logan 6878155230 Call recorder updates 2026-04-19 15:24:53 -04:00
Logan 6b38f191a8 switch back to icecast???? 2026-04-13 00:16:03 -04:00
Logan f028f08d6b Fix pulseaudio breaking 2026-04-13 00:09:54 -04:00
Logan be785a453c metadata fixes 2026-04-12 21:58:24 -04:00
Logan 4e41df9f95 updates 2026-04-12 03:34:11 -04:00
Logan 3cf5bc0d05 updates 2026-04-12 03:26:33 -04:00
Logan 33cad7ed24 updates 2026-04-12 03:05:48 -04:00
Logan 26d21d42e1 Updates back on claude 2026-04-12 01:32:05 -04:00
Logan f8c58dbda8 gemini changes 2 2026-04-11 22:28:46 -04:00
Logan b4b2f19e10 gemini changes? idk 2026-04-11 22:23:59 -04:00
Logan fb86d79930 File Change
op25-container/system.pa	New PulseAudio config: auth-anonymous=1 so the edge-node can connect without group membership
op25-container/Dockerfile	Copies system.pa into /etc/pulse/system.pa
drb-edge-node/Dockerfile	Added libpulse0 — ffmpeg needs this runtime library to use -f pulse
drb-edge-node/app/internal/call_recorder.py	Switched recording from Icecast (burst-buffer overlap) to PulseAudio monitor (zero-delay, exact call boundaries)
2026-04-11 21:16:32 -04:00
Logan d201d8124e Issue 1 — Discord Audio (PulseAudio)
docker-compose.yml: Added a pulse_socket named volume mounted at /run/pulse in both op25 and edge-node. Also set PULSE_SERVER=unix:/run/pulse/native in edge-node so libpulse (and ffmpeg's pulse input) finds the right socket.

discord_radio.py: Removed _icecast_url and changed _play_stream() to use -f pulse -i default.monitor. This reads directly from the PulseAudio sink monitor — zero buffer delay. The PULSE_SERVER env var is inherited by the ffmpeg subprocess.

Note: default.monitor captures whatever audio is playing on the default sink. If OP25 uses a named virtual sink, you may need to replace default.monitor with <sink_name>.monitor (run pactl list sinks short inside the op25 container to find the name).

Issue 2 — No audio URL / GCS credentials

storage.py: storage.Client() was using ADC but ADC isn't configured in the container. Now uses storage.Client.from_service_account_json(settings.gcp_credentials_path) when GCP_CREDENTIALS_PATH is set — same credential file Firebase already loads.

You also need to mount the key file into the server container in docker-compose.yml:

c2-core:
  volumes:
    - ./gcp-key.json:/app/gcp-key.json:ro
And set GCS_BUCKET=your-bucket-name in .env.

Issue 3 — Token orphaning

mqtt_manager.py: Every checkin now includes "discord_connected": radio_bot.is_connected.

mqtt_handler.py: On checkin, if discord_connected is explicitly False, calls release_token(node_id). Only fires on explicit false (missing field = unknown = no action).

node_sweeper.py: When a node is swept to offline, its token is released too. This covers the case where the node stops checking in entirely (crash/power loss).
2026-04-11 20:29:33 -04:00
Logan e47a9623b5 VC Update 2026-04-11 20:01:47 -04:00
Logan 97ebcad3bc Discord bot updates 2026-04-11 13:43:59 -04:00
Logan c843bac5b7 readme update 2026-04-06 02:47:02 -04:00
Logan 7de55f9885 changes 2026-04-06 00:23:33 -04:00
Logan 1a9c92b6db Initial commit — DRB client (edge node) stack
Includes edge-node (FastAPI/MQTT/Discord voice), op25-container (SDR decoder),
and icecast (audio streaming).
2026-04-05 19:01:51 -04:00