AcousticFocusStage – Documentation (English)
Purpose: The AcousticFocusStage is a post-processing stage for rpicam-apps that provides acoustic feedback based on the libcamera Focus Figure of Merit (FoM). This allows you to find the optimal focus point of a manual lens without needing to look at or interpret the preview image.
Features
- Plays a sine tone via the Raspberry Pi’s audio output.
- The tone’s frequency is mapped to the current Focus FoM value (frequency rises or falls as FoM rises or falls).
- No visual contact with the preview is required.
- The tone is triggered once per second for a configurable duration.
- All parameters (frequency range, mapping type, duration, etc.) can be configured via JSON.
- Note: You must use an external USB sound card, HDMI audio, or another supported audio device for this stage to function.
Dependencies
Install the following packages:
sudo apt update sudo apt install sox libsox-fmt-all
Build Instructions
- Add
acoustic_focus_stage.cppto yourpost_processing_stagesdirectory. - Add the stage to your
meson.build:core_postproc_src = files([ ... 'acoustic_focus_stage.cpp', ]) postproc_assets += files([ ... assets_dir / 'acoustic_focus.json', ])
- Rebuild and install:
meson compile -C build sudo meson install -C build
Configuration
Create a config file acoustic_focus.json (example):
{
"acoustic_focus": [
{
"stage": "acoustic_focus",
"minFoM": 1,
"maxFoM": 2000,
"minFreq": 300,
"maxFreq": 5000,
"duration": 0.1,
"mapping": "log",
"description": "mapping values are log (logarithmic) or linear"
}
]
}minFoM,maxFoM: Range of Figure of Merit values to map.minFreq,maxFreq: Frequency range for the output tone (Hz).duration: Tone duration in seconds.mapping:"log"for logarithmic mapping,"linear"for linear mapping.
Usage
- Start rpicam-vid with:
rpicam-vid --post-process-config assets/acoustic_focus.json
- Adjust focus on your manual lens. The tone’s pitch will rise or fall as the focus improves or worsens.
AcousticFocusStage – Dokumentation (Deutsch)
Zweck: Die AcousticFocusStage ist eine Post-Processing-Stage für rpicam-apps, die akustisches Feedback auf Basis des libcamera Focus Figure of Merit (FoM) gibt. Damit findest du den optimalen Fokuspunkt einer manuellen Linse ohne auf die Vorschau schauen oder diese interpretieren zu müssen.
Funktionen
- Gibt einen Sinuston über den Audio-Ausgang des Raspberry Pi aus.
- Die Tonhöhe wird aus dem aktuellen Focus FoM-Wert berechnet (steigt oder fällt mit dem FoM).
- Kein Sichtkontakt zur Vorschau erforderlich.
- Der Ton wird einmal pro Sekunde für eine konfigurierbare Dauer ausgegeben.
- Alle Parameter (Frequenzbereich, Mapping-Typ, Dauer usw.) sind per JSON konfigurierbar.
- Hinweis: Es muss eine Soundausgabe-Hardware vorhanden sein.
Abhängigkeiten
Installiere folgende Pakete:
sudo apt update sudo apt install sox libsox-fmt-all
Kompilierung
- Lege
acoustic_focus_stage.cppim Verzeichnispost_processing_stagesab. - Ergänze die Stage in deiner
meson.build:core_postproc_src = files([ ... 'acoustic_focus_stage.cpp', ]) postproc_assets += files([ ... assets_dir / 'acoustic_focus.json', ])
- Baue und installiere neu:
meson compile -C build sudo meson install -C build
Konfiguration
Beispiel für acoustic_focus.json:
{
"acoustic_focus": [
{
"stage": "acoustic_focus",
"minFoM": 1,
"maxFoM": 2000,
"minFreq": 400,
"maxFreq": 2000,
"duration": 0.1,
"mapping": "log", // oder "linear"
"description": "mapping values are log (logarithmic) or linear"
}
]
}minFoM,maxFoM: Bereich der Figure of Merit-Werte.minFreq,maxFreq: Frequenzbereich für den Ton (Hz).duration: Tondauer in Sekunden.mapping:"log"für logarithmisch,"linear"für linear.
Verwendung
- Starte rpicam-vid mit:
rpicam-vid --post-process-config assets/acoustic_focus.json
- Drehe am Fokusring deiner manuellen Linse. Die Tonhöhe steigt oder fällt, je nach Fokusqualität.
Hinweis: Die Stage ist ein reines Hilfsmittel für das manuelle Fokussieren und benötigt keinen Blickkontakt zum Monitor!