News & Time Bulletin Engine (bulletin-engine.js)
Since 2026-08-11 the station has real top-of-hour radio: a R128-mastered
spoken bulletin (station open + Cairo time check → weather → headlines → return
to music) generated on demand and scheduled to air hourly. bulletin-engine.js
is self-contained (requires paths.js only).
What it generates
| Output | Format |
|---|---|
media/news/NEWS_<ts>.mp3 | ~34–37 s Arabic spoken bulletin, Break-tagged |
| Loudness | Two-pass EBU R128 → −14 LUFS / −1.5 dBTP (identical to imaging-engine, sits at music loudness) |
Bulletin recipe (4 segments)
- Station open + Cairo time check —
timeCheckArabic(): "إنها الآن الساعة التاسعة مساءً بتوقيت القاهرة" (word-hours + minutes + period صباحاً / ظهراً / مساءً / ليلاً). - Weather — Open-Meteo Cairo (free, no API key): temperature + WMO description + wind.
- Headlines — the first 3 lines of
E:\radionew\news.txt(editable, one per line, Arabic). "وأبرز العناوين: …". - Return — "الآن عودة للموسيقى".
Each segment is TTS'd separately (edge-tts, ar-EG-ShakirNeural, rate +8%) using
-f temp files (never shell args — Arabic/backtick-safe), concatenated with
0.55 s silence, loudnorm pre-pass, then R128 master.
Scheduler wiring (smart-scheduler.js)
newsis a full imaging category: indecks,categories,imagingCategories,isImaging, and the 10-minELEMENT_COOLDOWNlist.- Quality-gate exempt — a 35 s bulletin would fail the 45 s music floor, so
newsis on the probe-exempt list. NEWS_EVERYcadence slot (~every 20–24 tracks ≈ hourly) forces a news pick in every daypart (deep night included) — same pattern as theAD_EVERYslot.radio-engine.jsmediaPathsmapsnews: media/news.
Server (server.js)
| Endpoint | Purpose |
|---|---|
POST /api/bulletin/generate | Generate a bulletin + resync the rotation + push |
GET /api/bulletin/status | Latest file, current headlines, live Cairo time-check sentence |
scheduleBulletinAutoGen() runs at boot +30 s and every BULLETIN_HOURS
(default 1 h, chained setTimeout; 0 disables). MCP tools:
generate_bulletin, bulletin_status.
Updating headlines
Edit E:\radionew\news.txt (one headline per line), then
POST /api/bulletin/generate — or just wait for the next hourly run (it re-reads
the file). All content is Arabic; English listeners get English music around it.
Critical gotcha: SYSTEM-session python
The engine runs as SYSTEM (ServerGuard, session 0) where bare python resolves
to the WindowsApps stub → edge-tts spawns fail silently with
✗ TTS failed for segment 0..3 / Done (FAILED: all-tts-failed).
PYTHON_BIN must be the
absolute C:/Users/omar/AppData/Local/Programs/Python/Python312/python.exe.
Prerequisites
pip install edge-tts(edge_tts 7.2.8); endpointspeech.platform.bing.comreachable (HTTP 200).- ffmpeg at
C:/ffmpeg/bin.
Deployed live 2026-08-11: 37.1 s bulletin, news deck 1, remote m3u head
annotate:type=news:NEWS_*.mp3, file size-verified remotely (890591 bytes).
See also
- Smart Scheduler — NEWS deck + cadence slot.
- Imaging engine — the sibling loudness-mastered generators.
- Equations — R128 (§1), cooldowns (§10), cadence (§15).