Recording
The speaker can record what phones and Spotify play: every song becomes an MP3, tagged with its title, artist and album, linked from the History and kept on the Recordings page. It is off until the owner turns it on.
Only phones and Spotify (the speaker as a Spotify Connect device) are recorded. Playlists, radio stations, the speaker's own sounds, spoken prompts and whatever Home Assistant plays are not. Recordings are for your own listening.
Turning it on
- Open Settings → Recording and choose the Storage and Folder the MP3s go to:
fileadminand/recordings/unless you pick another: an SD card or a USB stick included under Settings → Storage, or a server added in the backend (see Storage), works as well. The folder is created if it is missing. On the speaker's own card it has to be below/recordings/or/music/: only there the web server keeps the files from anyone who is not logged in. - Choose the Quality (192 kbit/s by default; Bluetooth itself sounds like about 256 kbit/s) and how much the recordings may keep at most. Above it, the oldest recordings are deleted - only the speaker's own, never other MP3s you keep in the same folder. Save.
- Turn on Record what phones and Spotify play. From the next song on, each play is recorded. While one is, the part shows Recording with the song.
Speakers set up before recording existed need sudo install.sh --system once more: it installs lame, the spool directory and the import units. So do speakers set up before Spotify was recorded: it points Spotify's PulseAudio at the tapped device.
What is recorded
- One MP3 per play in the history: a new song starts a new file.
- A song skipped before ten seconds is not kept.
- A song that was already playing when recording started, or was skipped before its end, is kept but marked not from start to end in its description.
- A pause is no gap: the file continues when the phone plays on. Ten minutes without sound end the recording.
- No duplicates. A song recorded before - the same title, artist and album, from whichever phone - is not stored again; its play in the history links to the recording there is. A recording that missed part of the song gives way to a whole one, or to a longer part. A recording you delete is recorded again the next time the song plays. A song without a title is always stored.
Listening
- History: a song with a recording has Listen, which turns into Stop while it plays in the browser.
- Recordings page: every recording, newest first, searchable by title, artist, album or phone, with Listen, Add to playlist…, Download and Delete….
Recordings are served through the speaker's API to the owner only, never by a public URL, whatever the storage. The TV may listen at every access level; it may delete only with full access, and never changes the settings.
How it works
The music goes from the phone to the speakers as always; inside the speaker's ALSA device a tap copies it to the agent, which never holds the music up. The web app takes finished recordings into the owner's folder.
flowchart TB
phone["📱 Phone"] -- "A2DP" --> aplay["bluealsa → bluealsa-aplay<br/>(Spotify: its PulseAudio)"]
aplay --> pcm["ALSA pcm.boombox<br/>plug → file "|tap" → boombox_direct"]
pcm --> card["softvol → dmix → sound card"]
pcm -. "a copy, only while recording is on;<br/>never holds the music up" .-> tap["bin/boombox-record-tap"]
tap -- "/run/boombox/record.sock" --> agent["boombox-agent<br/>one MP3 per play (lame)"]
agent --> spool[("/var/spool/boombox")]
spool -- "import unit · timer · pages" --> importer["web app (www-data)<br/>speaker:recordings:import"]
importer -- "FAL" --> folder[("owner's folder")]
| Part | Where |
|---|---|
| The tap in the ALSA config, only while recording is on | boombox-agent/src/Backend/Linux/AsoundConfig.php |
| The tap: forwards to the agent, never waits | boombox-agent/bin/boombox-record-tap |
| The agent's end of it | Backend/Linux/RecordTapServer.php |
| One MP3 per play, the spool | Service/RecordingService.php |
| Into the folder through FAL, pruning | boombox-speaker/Classes/Recording/RecordingImporter.php |
| Listing, serving and deleting | Classes/Recording/RecordingLibrary.php, Middleware/SpeakerApiMiddleware.php |
- The music never waits for the recording. ALSA's
fileplugin writes into the tap synchronously, so the tap reads at once and hands on without blocking: what the agent does not take right away is dropped in whole frames. Without the agent it reads on and discards. A slow encoder loses audio the same way inside the agent, which logs how much. - BlueALSA 4.3.1 on the speaker has no multi-client mode, so a second reader of the phone's stream is not possible; a loopback card would drift against the I2S clock.
- The tap runs inside
bluealsa-aplayas its user. The socket belongs to its group (audio), mode 0660, so no one else can slip audio into a recording. - The agent writes finished recordings to
/var/spool/boombox(root, group boombox, 0750) and startsboombox-recordings-import.service, a oneshot unit as www-data; a timer retries every ten minutes. TYPO3 never runs inside the agent's sandbox. The pages import too, before they show the history or the recordings. - One import runs at a time (a TYPO3 lock): the unit and a page asking for the history never store the same recording twice.
- A storage that fails keeps the recording in the spool; the Recording part shows why. While the spool is larger than the maximum size, new songs are not recorded.
In DDEV the simulated phone plays a quiet tone into the recording, and lame is in the web image. The spool is var/boombox-sim/recordings; recordings are stored when a page asks, in that request's database.
Troubleshooting
| Symptom | Cause and fix |
|---|---|
| Record what phones and Spotify play is greyed out | The speaker was set up before recording existed: sudo install.sh --system. |
| On, but Waiting for a phone to play while one plays | The tap does not reach the agent. journalctl -u boombox-aplay shows ALSA's errors; ls -l /run/boombox/record.sock must be group audio. |
| "The recordings waiting to be stored are larger than the maximum size" | The folder cannot be reached (storage offline, NAS down). Fix the storage; systemctl start boombox-recordings-import stores what waits. |
| "The encoder failed" | lame is missing or the spool is full: sudo install.sh --system, df -h /var/spool. |
| Gaps in a recording | The encoder fell behind, the agent logs "s lost". Choose a lower quality. |