Discobox

by JestingDart4369

Novaroma ↗

SD card structure

The DFPlayer Mini plays MP3 files from a microSD card. This document describes how the card is organised.

Card requirements

Folder layout

Folder Used for Status
01 Miscellaneous: jingles, announcements, sound effects, anything not tied to a mode reserved
02 Mode 1 – Party: music playlist (PARTY_FOLDER = 2 in Modes.h) in use
03 Mode 2 – LinkClick reserved
04 Mode 3 reserved
05.. Further modes, in the order of MODE_LIST in Modes.h reserved

Rule: mode number N uses folder N+1, folder 01 is always the misc folder.

SD card (FAT32)
├── 01/                 misc (jingles, effects)
│   ├── 001.mp3
│   └── 002.mp3
├── 02/                 Party mode playlist
│   ├── 001.mp3
│   ├── 002.mp3
│   └── ...             (tracks play in numeric order, auto-next)
├── 03/                 LinkClick mode
├── 04/                 Mode 3
└── lists/              optional: track-name lists (see below), ignored by the DFPlayer
    └── 02.json

How the firmware uses it

Preparing the card

Download a track as MP3 (named by number so the DFPlayer can find it):

yt-dlp -x --audio-format mp3 --audio-quality 128K \
  --postprocessor-args "ffmpeg:-ar 44100 -ac 2" \
  --no-embed-thumbnail --no-embed-metadata \
  -o "~/Downloads/%(title)s.%(ext)s" "<youtube-url>"

Then number the files into the folder: rename by hand to 001.mp3, 002.mp3, ... and keep the order stable, because the number is the track ID. A helper script (mp3_prepare.py, not part of this repository) can copy a source folder into a numbered DFPlayer folder and write the track list:

python3 mp3_prepare.py ~/Downloads/Party /Volumes/SDCARD/02

After copying on macOS, remove the hidden files the Finder adds, otherwise the DFPlayer can count them as tracks or play wrong files:

dot_clean /Volumes/SDCARD
find /Volumes/SDCARD -name ".DS_Store" -delete
rm -rf /Volumes/SDCARD/.Spotlight-V100 /Volumes/SDCARD/.fseventsd /Volumes/SDCARD/.Trashes

Eject the card properly before putting it into the DFPlayer.

Notes