From 392a4cac6fbf088b15077bb45df5a3c8debfa069 Mon Sep 17 00:00:00 2001 From: shodan Date: Sat, 3 Oct 2026 22:56:18 +0200 Subject: [PATCH 01/21] feat(http): stream WAV audio to the speaker with POST /play The request body is parsed as it arrives and written straight to I2S, so a clip of any length plays with about 1.5 KB of buffering. I2S backpressure paces the upload to real time; animation, eyes and LED keep updating between speaker writes because loop() is blocked while the body streams. Accepts 16-bit mono PCM at SAMPLE_RATE and answers 415 with the reason otherwise. Auth and Wi-Fi checks run before any audio plays. Co-Authored-By: Claude Opus 5.5 (1M context) --- platformio.ini | 1 + src/audio/audio.cpp | 33 ++++ src/audio/audio.h | 2 + src/audio/wav_parser.cpp | 237 +++++++++++++++++++++++ src/audio/wav_parser.h | 73 +++++++ src/audio/wav_stream.cpp | 41 +--- src/http/json.cpp | 16 +- src/http/json.h | 2 + src/http/play_handlers.cpp | 118 +++++++++++ src/http/play_handlers.h | 8 + src/http/routes.cpp | 7 + src/http/settings_handlers.cpp | 2 +- test/test_wav_parser/test_wav_parser.cpp | 208 ++++++++++++++++++++ 13 files changed, 701 insertions(+), 47 deletions(-) create mode 100644 src/audio/wav_parser.cpp create mode 100644 src/audio/wav_parser.h create mode 100644 src/http/play_handlers.cpp create mode 100644 src/http/play_handlers.h create mode 100644 test/test_wav_parser/test_wav_parser.cpp diff --git a/platformio.ini b/platformio.ini index 47dad924..f950b4a7 100644 --- a/platformio.ini +++ b/platformio.ini @@ -51,6 +51,7 @@ build_src_filter = -<**/*.*> + + + +