Add stereo and bass enhance APIs via PEQ overlay.
Expose POST /api/audio/stereo-enhance and bass-enhance with 0–100 levels, persist enhancements in AudioProfile, and document the virtual EQ mapping in the manual and SigmaStudio chapter. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -184,9 +184,11 @@ The handler reads \texttt{audio::AudioService::currentProfile()}.
|
||||
{"mixer":{"si4684_left_db":0,"si4684_right_db":0,"esp32_left_db":0,
|
||||
"esp32_right_db":0,"mix_left_db":0,"mix_right_db":0},
|
||||
"master":{"left_db":0,"right_db":0},
|
||||
"eq":[{"gain_db":0,"center_hz":40,"q":1.414}, ...]}
|
||||
"eq":[{"gain_db":0,"center_hz":40,"q":1.414}, ...],
|
||||
"enhancements":{"stereo_level":0,"bass_level":0}}
|
||||
\end{drcode}
|
||||
Six EQ bands are always present (\texttt{eq} array length~6).
|
||||
Enhancement levels are 0--100; at 0 the base EQ band settings apply.
|
||||
\end{drnote}
|
||||
|
||||
HTTP status: \textbf{200 OK}; \textbf{503} when the audio service is
|
||||
@@ -217,6 +219,32 @@ applies it to the DSP, and persists to NVS. Success response:
|
||||
\texttt{\{"status":"saved"\}}. HTTP status: \textbf{200 OK}; \textbf{500}
|
||||
on apply/persist failure.
|
||||
|
||||
\subsection{\texttt{POST /api/audio/stereo-enhance}}
|
||||
\label{sec:api-audio-stereo-enhance}
|
||||
|
||||
Adjusts stereo depth via a psychoacoustic PEQ overlay on bands 3--5
|
||||
(1\,kHz / 3\,kHz / 8\,kHz). This is \emph{not} true M/S widening---there
|
||||
is no dedicated SigmaStudio widener block; see
|
||||
Section~\ref{sec:ss-enhancements}.
|
||||
|
||||
\begin{drnote}[Request body]
|
||||
\begin{drcode}[JSON]
|
||||
{"level":50}
|
||||
\end{drcode}
|
||||
\texttt{level} is an integer 0--100 (0 = off, 100 = maximum).
|
||||
\end{drnote}
|
||||
|
||||
Success response: \texttt{\{"status":"saved"\}}. HTTP status:
|
||||
\textbf{200 OK}; \textbf{400} for invalid JSON or level; \textbf{500}
|
||||
when safeload or NVS persistence fails.
|
||||
|
||||
\subsection{\texttt{POST /api/audio/bass-enhance}}
|
||||
\label{sec:api-audio-bass-enhance}
|
||||
|
||||
Adjusts bass emphasis via a PEQ overlay on bands 1--2 (100\,Hz /
|
||||
400\,Hz). Request and response schema match
|
||||
\texttt{POST /api/audio/stereo-enhance} (Section~\ref{sec:api-audio-stereo-enhance}).
|
||||
|
||||
\section{Boot and network state machine}
|
||||
\label{sec:api-boot-flow}
|
||||
|
||||
|
||||
@@ -201,7 +201,13 @@ Constructed once in \texttt{HardwareBootstrap} alongside the driver.
|
||||
Application service for ADAU1701 mixer, EQ, and master volume. Holds a
|
||||
reference to \texttt{core::IDsp}, tracks the in-memory \texttt{AudioProfile},
|
||||
loads from \texttt{IAudioProfileStore} after boot, and applies changes via
|
||||
safeload. Exposed on \texttt{/api/audio/*} and the web UI Audio section.
|
||||
safeload. Stereo depth and bass enhance levels are merged into the effective
|
||||
EQ via \texttt{core::applyEnhancementsToEq()}. Exposed on
|
||||
\texttt{/api/audio/*} and the web UI Audio section.
|
||||
|
||||
\section{EnhanceLevel}\label{cls:EnhanceLevel}
|
||||
Strong type for 0--100 enhancement intensity (stereo depth and bass boost).
|
||||
Validated at the HTTP boundary by \texttt{core::parseEnhanceLevelJson()}.
|
||||
|
||||
\section{NvsAudioProfileStore}\label{cls:NvsAudioProfileStore}
|
||||
\texttt{IAudioProfileStore} implementation storing serialised
|
||||
|
||||
@@ -213,6 +213,26 @@ SigmaStudio export (Section~\ref{sec:ss-export}).
|
||||
\label{tab:ss-runtime}
|
||||
\end{table}
|
||||
|
||||
\section{Virtual enhancements (stereo depth and bass boost)}
|
||||
\label{sec:ss-enhancements}
|
||||
|
||||
The SigmaStudio export does not include dedicated stereo widener or bass
|
||||
boost blocks. Firmware~0.5.0 maps enhancement levels (0--100) onto the
|
||||
existing Param EQ1 bands at runtime:
|
||||
|
||||
\begin{itemize}
|
||||
\item \textbf{Bass enhance} --- peaking boost at 100\,Hz (+9\,dB max)
|
||||
and 400\,Hz (+3\,dB max).
|
||||
\item \textbf{Stereo enhance} --- slight 1\,kHz cut, plus 3\,kHz and
|
||||
8\,kHz lift for a wider, more present image. This is a
|
||||
psychoacoustic curve, not mid/side processing.
|
||||
\end{itemize}
|
||||
|
||||
Enhancement levels are stored in \texttt{AudioProfile::enhancements} and
|
||||
applied by \texttt{core::applyEnhancementsToEq()} before safeload. Base EQ
|
||||
band settings in NVS are preserved; overlays replace affected bands only
|
||||
while the corresponding level is greater than zero.
|
||||
|
||||
\begin{drcaution}[Use safeload for live changes]
|
||||
All runtime updates to the volume, source levels, and EQ bands must go
|
||||
through the ADAU1701 safeload mechanism. Writing parameter cells directly
|
||||
|
||||
Reference in New Issue
Block a user