Silvasonic¶
Autonomous Bioacoustic Recording Station for Raspberry Pi 5
Status: v0.8.0 — BirdNET ✅
What is Silvasonic?¶
AS-IS: Silvasonic is a professional-grade, containerized recording system designed for long-term bioacoustic monitoring in the field.
TO-BE: The goal for v1.0.0 is to transform a Raspberry Pi 5 into a resilient recording station capable of capturing the entire soundscape — from avian vocalizations to ultrasonic bat calls.
AS-IS: Target Audience: Researchers, conservationists, and bioacoustic enthusiasts requiring robust, unsupervised data collection.
For the long-term vision and design philosophy see VISION.md. For the milestone roadmap see ROADMAP.md.
Quick Start¶
Prerequisites¶
- Linux (e.g., Debian or Fedora)
- Python 3.13 (required,
>=3.13, <3.14) - uv installed — Python package manager (Installation)
- just installed — command runner (Installation)
- Podman & podman-compose installed
Setup¶
git clone https://github.com/kyellsen/silvasonic.git
cd silvasonic
cp .env.example .env # adjust settings as needed
just init # uv sync, pre-commit hooks, workspace directories
just build # build all container images
just start # start all services
Configuration¶
Silvasonic employs a strictly tiered configuration architecture:
- Infrastructure (
.env) Created from.env.example. This handles container-level infrastructure only: database credentials, Podman socket paths, and network configurations. It never contains application business logic or tuning parameters. - Application Defaults (
config/defaults.yml) Version-controlled factory defaults for internal application logic (e.g., BirdNET confidence thresholds, janitor cleanup limits, UI toggles). Seeded into the database by the Controller on first startup. - Local Overrides (
config/defaults.override.yml) For local development or volatile databases (e.g. afterjust nuke), create this file (it is ignored by Git). The Controller will deep-merge any keys defined here over the factory defaults on startup. Example: Setting your locallatitude/longitudehere temporarily to test BirdNET location filtering. - Container Overrides (
compose.override.yml) Only use this (via standard Podman Compose mechanism) if you need to radically alter Tier-1 infrastructure for debugging, such as mounting temporary host directories or exposing internal database ports directly to your host machine.
Project Structure¶
silvasonic/
├── AGENTS.md # AI agent rules (binding for all AI tools)
├── VISION.md # Long-term vision & architecture
├── ROADMAP.md # Milestone roadmap (version targets & status)
├── pyproject.toml # Workspace root, tooling config (Ruff, Mypy, Pytest)
├── compose.yml # Container orchestration (Podman Compose)
├── justfile # Developer commands (init, build, start, stop, check, test, …)
├── mkdocs.yml # Documentation site configuration (MkDocs Material)
├── conftest.py # Pytest root configuration
├── .env.example # Environment template (copy to .env)
├── docs/ # Single Source of Truth — architecture, ADRs, specs
│ └── index.md # Documentation entry point
├── packages/ # Shared Python packages (namespace: silvasonic.*)
│ ├── core/ # silvasonic-core: service base class, DB, Redis, heartbeat
│ └── test-utils/ # silvasonic-test-utils: shared testcontainer fixtures
├── services/ # Container service definitions & Containerfiles
│ ├── database/ # TimescaleDB / PostgreSQL
│ ├── controller/ # Hardware/Container manager
│ ├── gateway/ # Caddy reverse proxy, HTTPS termination & routing
│ ├── processor/ # Data ingestion, indexing & retention (Janitor)
│ ├── recorder/ # Audio capture (FFmpeg, Dual Stream)
│ └── web-mock/ # Dev UI shell (FastAPI + Jinja2 + HTMX)
├── scripts/ # Build & lifecycle scripts (Python)
└── tests/ # Cross-cutting tests (integration, system, smoke, e2e)
Current Services¶
AS-IS: The architecture is organized into Tier 1 (Infrastructure, managed by Podman Compose) and Tier 2 (Application, managed by Controller, immutable). Currently implemented:
| Service | Tier | Role | Status |
|---|---|---|---|
| database | 1 | TimescaleDB / PostgreSQL — central state management | ✅ Running |
| redis | 1 | Status bus — Pub/Sub heartbeats, Key-Value status cache (ephemeral) | ✅ Running |
| controller | 1 | Hardware/Container manager — health monitoring, placeholder orchestration | ✅ Running |
| gateway | 1 | Caddy reverse proxy — HTTPS termination and internal routing | ✅ Running |
| processor | 1 | Data ingestion, metadata indexing, and retention management (Janitor) | ✅ Running |
| web-mock | 1 | Dev UI shell — FastAPI + Jinja2, hardcoded mock data (precursor to Web-Interface) | ✅ Running |
| db-viewer | 1 | Dev Data UI — Database inspector, custom SQL execution & analytical data export tool (toggle via COMPOSE_PROFILES=db-viewer) |
✅ Running |
| recorder | 2 | Audio Capture — FFmpeg engine, dual-stream WAV output (ADR-0024) | ✅ Running |
For the full target architecture (13 services across two tiers) see VISION.md. For version milestones see ROADMAP.md.
Developer Commands¶
All commands are run via just. Use just --list for a full overview.
Here are the most common daily commands:
| Command | Description |
|---|---|
just init (i) |
Initialize project (uv sync, pre-commit hooks, workspace) |
just build (b) |
Build all container images |
just start |
Start all services |
just stop |
Stop all services |
just logs |
Show aggregated service logs |
just status |
Show service status |
just check (c) |
Static analysis & unit tests (fast check) |
just verify (v) |
Code quality & integration tests |
just ci |
Full CI pipeline (Lint → Type → Unit → Int → System → E2E) |
just docs |
Start MkDocs live server (localhost:8085) |
just nuke |
Full reset (delete containers, volumes, .venv, and images) |
🧪 Testing: For the full list of specific test commands (e.g.,
just test-unit,just test-e2e), see the Testing section below.
Testing¶
AS-IS: Silvasonic uses a structured test pyramid with explicit markers. Every test must carry one of:
| Marker | Scope | Command |
|---|---|---|
unit |
Fast, isolated, mocked | just test-unit |
integration |
External services (Testcontainers) | just test-int |
system |
Full Podman lifecycle | just test-system |
system_hw_auto |
Real USB hardware required | just test-hw |
system_hw_manual |
Interactive USB hardware required | just test-hw-manual |
smoke |
Quick health checks on images | just test-smoke |
e2e |
Browser tests (Playwright) | just test-e2e |
Service-specific tests live inside services/<svc>/tests/. Cross-cutting tests in tests/.
Key Documentation¶
| Document | Audience | Purpose |
|---|---|---|
| README.md | 👤 Humans | Project overview, quick start, structure |
| VISION.md | 👤 + 🤖 | Vision, services architecture, design philosophy |
| ROADMAP.md | 👤 + 🤖 | Milestone roadmap (version targets & status) |
| AGENTS.md | 🤖 AI Agents | Binding rules, constraints & conventions for AI coding assistants |
| docs/index.md | 👤 + 🤖 | Full technical documentation (architecture, 24 ADRs, specs) |
📚 Local Docs: Run
just docsto start the MkDocs live server athttp://localhost:8085.🤖 AI Agents: Your instructions are in AGENTS.md. Read it first before doing any work on this repository.
Contact¶
- 🌐 Website: silvasonic.de
- 📧 E-Mail: io@silvasonic.de
Licence¶
Available under the Apache 2.0 License.
Documentation Index¶
Project Overview¶
Architecture¶
- Architecture Overview
- Filesystem Governance
- Messaging Patterns & Protocols
- Port Allocation
- Microphone Profiles
- Lifecycle Configuration
- Frontend Feature Specs · Frontend Design System
Services¶
Implemented¶
Planned¶
Deployment¶
ADRs¶
- ADR-0001: Use uv as Python Package and Project Manager
- ADR-0002: Use pyproject.toml for Configuration and Dependencies
- ADR-0003: Frontend Architecture ("The Modern Monolith")
- ADR-0004: Use Podman instead of Docker
- ADR-0005: Separation of Immutable Code & Mutable State ("Two-Worlds")
- ADR-0006: Host Bind Mounts as Default Persistence Strategy
- ADR-0007: Rootless Podman & OS Compliance
- ADR-0008: Domain-Driven Workspace Isolation
- ADR-0009: Zero-Trust Data Sharing Policy
- ADR-0010: Naming Conventions
- ADR-0011: Audio Recording Strategy (Raw vs Processed)
- ADR-0012: Use Pydantic for Data Validation
- ADR-0013: Tier 2 Container Management — Podman-Only with podman-py
- ADR-0014: Dual Deployment Strategy — Compose (Dev) / Quadlets (Prod)
- ADR-0015: NVMe-Only Storage Policy
- ADR-0016: Hybrid YAML/DB Profile Management
- ADR-0017: Service State Management — Desired vs. Actual State
- ADR-0018: Worker Pull Orchestration — Self-Service Analysis via DB Polling
- ADR-0019: Unified Service Infrastructure — SilvaService Pattern
- ADR-0020: Resource Limits & QoS — Protecting Data Capture Integrity
- ADR-0021: Frontend Design System — Tailwind CSS + DaisyUI + ECharts + Wavesurfer.js
- ADR-0022: Live Log Streaming — Podman Logs via Redis SSE
- ADR-0023: Configuration Management — YAML Seed, DB Settings, Users Table
- ADR-0024: FFmpeg Audio Engine — Externalizing the Real-Time Audio Path
- ADR-0025: Recordings Table — Standard PostgreSQL Table (No Hypertable)
- ADR-0026: Database Engine Selection for Edge Analytics
- ADR-0027: BirdNET Inference Engine
- ADR-0029: System Worker Orchestration
- ADR-0030: Database Runtime Resilience (Soft-Fail Loops)
- ADR-0030: Logging Cadence & Stats Extensibility
- ADR-0031: Runtime Tuning via DB Snapshot Refresh
Development¶
- Commit Message Guidelines — Standardized commit message format
- Milestone v0.1.0 — Concrete implementation plan for Base Setup
- Milestone v0.2.0 — Concrete implementation plan for Service Infrastructure
- Milestone v0.3.0 — Concrete implementation plan for Tier 2 Container Management
- Milestone v0.4.0 — Audio Recording: Dual Stream, Profile Injection, Generic USB Fallback, Watchdog
- Milestone v0.5.0 — Analysis & Backend Orchestration: Processor Service (Indexer + Janitor)
- Milestone v0.6.0 — Processor Cloud Sync (Single-Target Upload Worker)
- Milestone v0.7.0 — Gateway (Reverse Proxy)
- Milestone v0.7.1 — DB-Viewer
- Milestone v0.8.0 — BirdNET (On-device Avian Inference)
- Milestone v0.9.0 — Web-Interface & Field Deployment
- Milestone v0.10.0 — Marketing Landing Page (Astro)
- Milestone v1.0.0 — Production Release & ML Integration
- Milestone Template — Template for new milestone documents
- Service Blueprint — Mandatory patterns for new Python services
- Testing Guide
- Release Checklist — Step-by-step guide for tagging a release
User Stories¶
Hardware¶
Reference¶
- Glossary — Canonical domain language definitions