102 lines
2.3 KiB
Markdown
102 lines
2.3 KiB
Markdown
# Clio Pi
|
|
|
|
Raspberry Pi recording station for the Clio audio system.
|
|
|
|
## Features
|
|
|
|
- Continuous audio recording with ffmpeg (opus codec, 2hr segments)
|
|
- Systemd service for auto-start on boot
|
|
- HTML status page showing recording coverage
|
|
- NTP time sync via chrony
|
|
- SSH key-only access (hardened)
|
|
|
|
## Quick Setup
|
|
|
|
1. Flash Raspberry Pi OS Lite to SD card using Raspberry Pi Imager
|
|
2. Configure in Imager: hostname, user/pass, WiFi, enable SSH
|
|
3. Boot and SSH into Pi
|
|
4. Copy this directory to the Pi:
|
|
```bash
|
|
rsync -avz /work/projects/clio/clio-pi/ pi@<pi-ip>:~/clio-pi/
|
|
```
|
|
5. Run setup:
|
|
```bash
|
|
ssh pi@<pi-ip>
|
|
cd ~/clio-pi
|
|
sudo ./setup.sh
|
|
```
|
|
6. Add your SSH key before rebooting:
|
|
```bash
|
|
ssh-copy-id pi@<pi-ip>
|
|
```
|
|
7. Start recording:
|
|
```bash
|
|
sudo systemctl start record.service
|
|
```
|
|
|
|
## Files
|
|
|
|
```
|
|
clio-pi/
|
|
├── setup.sh # Main setup script (run with sudo)
|
|
├── bin/
|
|
│ ├── record.sh # Recording loop (ffmpeg)
|
|
│ └── gen_recording_status.py # Status page generator
|
|
├── systemd/
|
|
│ └── record.service # Systemd service unit
|
|
└── README.md
|
|
```
|
|
|
|
## Configuration
|
|
|
|
Edit `~/bin/record.sh` environment variables:
|
|
|
|
| Variable | Default | Description |
|
|
|----------|---------|-------------|
|
|
| `AUDIO_DEVICE` | `hw:1` | ALSA device (run `arecord -l` to list) |
|
|
| `SEGMENT_SECONDS` | `7200` | Segment length (2 hours) |
|
|
| `RECORDINGS_DIR` | `~/recordings` | Output directory |
|
|
| `SOURCE_NAME` | `stationary` | Filename prefix |
|
|
|
|
## Services
|
|
|
|
| Service | Description |
|
|
|---------|-------------|
|
|
| `record.service` | Recording daemon |
|
|
| `chrony` | NTP time sync |
|
|
| `nginx` | Status page web server |
|
|
|
|
## Commands
|
|
|
|
```bash
|
|
# Recording service
|
|
sudo systemctl start record.service
|
|
sudo systemctl stop record.service
|
|
sudo systemctl status record.service
|
|
journalctl -u record.service -f
|
|
|
|
# Check time sync
|
|
chronyc tracking
|
|
timedatectl
|
|
|
|
# View status page
|
|
curl http://localhost/
|
|
```
|
|
|
|
## Syncing Recordings to Server
|
|
|
|
TODO: Add rsync/sync script to push recordings to server (10.0.0.45)
|
|
|
|
## Audio Device Setup
|
|
|
|
List available devices:
|
|
```bash
|
|
arecord -l
|
|
```
|
|
|
|
Example output:
|
|
```
|
|
card 1: Device [USB Audio Device], device 0: USB Audio [USB Audio]
|
|
```
|
|
|
|
This would be `hw:1,0` or just `hw:1`.
|