aeeb4f6b8e | ||
---|---|---|
.idea | ||
assets | ||
other | ||
.gitignore | ||
README.md | ||
p.sh | ||
pacemaker.main.kts |
README.md
Pacemaker
A kotlin script to manage and add MP3s to a Tonium Pacemaker on macOS. If you find an old Pacemaker and use Apple computers you were previously a bit stuck and forced to somehow run Windows to use the old 1st party Pacemaker Edit. With this script you can unbrick a broken device, setup a new blank solid state disk (if you're confident enough to carry out the mod), and of course transfer MP3s.
Setup
Use sdkman.io to install Kotlin on your macOS computer:
curl -s "https://get.sdkman.io/" | bash
source "~/.sdkman/bin/.sdkman/bin/sdkman-init.sh"
sdk version
sdk install kotlin
Clone this repository, then either run via kotlin with kotlin pacemaker.main.kts
or chmod +X pacemaker.main.kts
to make the script executable and run from the directory with ./pacemaker.main.kts
Commands
./pacemaker.main.kts
- shows some brief usage instructions./pacemaker.main.kts install
- initialises a Pacemaker with the last official firmware from Tonium./pacemaker.main.kts install someFirmware.pfw
- initialises firmware supplied as argument./pacemaker.main.kts version
- fetches and parses the installed firmware version./pacemaker.main.kts audio.mp3
- will extract information from an MP3 file, write the data to the Pacemaker database and copy the file to your device./pacemaker.main.kts audio.mp3 -bpm
- as above, but will calculate the track BPM using Aubio if installed (bypassed if BPM already exists as a tag)./pacemake.main.kts folderpath
- iterates all files in a directory and processes any MP3s as above./pacemake.main.kts folderpath -bpm
- as above but calculates BPM using Aubio./pacemaker.main.kts restore
- if something goes wrong you can undo the database changes./pacemaker.main.kts copydb
- copy the database from the Pacemaker to your local directory. Useful for development only./pacemaker.main.kts pushdb
- copy music.db from the local directory to the Pacemaker./pacemaker.main.kts unmount
- unmount the Pacemaker from macOS so it can be used
Current/todo
When installing firmware if downgrading the firmware versions in system.xml need setting to a lower value to allow the upgrade:
SWVERSION="0"
FWVERSION="0"
Troubleshooting
If you ever brick your Pacemaker turn it off then hold down the rewind, fast-forward, and channel 2 buttons - then press power keeping the 3 buttons held down. A recovery menu will appear where you can wipe the hard disk and start again with ./pacemaker.main.kts install
BPM Analysis
I recommend using either an existing DJ tool if you use one already to write the TBPM
field to your MP3s (VirtuaDJ, Serato, RecordBox), or better yet try BPM Analyzer by Viktor Gordienko (App Store link) which does the same but is a tiny lightweight utility. This project can also use Aubio if installed (see below) but I found more accurate analysis using Viktor's implementation (in fact Aubio seems consistently slow by 2 to 3 BPM).
Aubio
Note. I'm not confident Aubio is accurate, there's a rounding error somewhere. Tracks that other software report with sensible values (130bmp, 133bpm) are always reported by Aubio as some non-sensical value, eg: 131.33345 bpm. If I can find a more reliable command-line alternative I'll switch to that soon.
Aubio is used to calculate the BPM of tracks. It's easy to install using brew: brew install aubio
(note. it uses a lot of dependencies and will take ~20 minutes to install depending on your internet connection speed).
If brew fails with the message:
Error: gcc: the bottle needs the Apple Command Line Tools to be installed.
You can install them, if desired, with:
xcode-select --install
enter xcode-select --install
- it'll appear to do nothing but your macOS desktop will have a dialog where you can carry on installation (do the 3 finger swipe-up gesture on the magic track pad to see the dialog).
Next
This project doesn't extract beat information (is in bveat timestamps), it will handle BPM itself as a single value, but for the automated beat matching feature Pacemaker Edit (the old 1st party desktop software) analyses the entire track and creates an additional metadata file alongside the MP3 on the filesystem with (I think) timecode information for each beat. This is encoded somehow, reverse-engineering that metadata will be an interesting project, if we're lucky it's just Base64 or something.