mp3fs on Apple Silicon

Posted on

Recently, my old Casio WMP-1 MP3 watch from the year 2000 got a little revival of sorts: a fellow Norwegian had with the use of some vibe coding ported the libusb based software written for Linux in 2005 into something that could be used in the browser via the new WebUSB API (experimental and Chromium-only)!

This essentially made the software cross-platform runnable, meaning my strugges with trying to connect to it on a Mac was over and I could try to put those 32MB to use again :D casio wmp-1

The problem is content: I no longer have troves of MP3's lying around like I did in 2000, when I bought the watch. And the ones I do have are high-quality VBR encodings, which is not supported by the watch, which only plays constant bit rate encodings up to 128 kbps ... But I had the solution already: 15 years prior I used to run mp3fs - a FUSE based virtual file system that would mirror a directory structure containing other music and transparently transcodes the files (and changes the file extension) into mp3's!

Building mp3fs

It took some effort, including a dead-end trying to manually compile LAME on my ARM based Mac, but it turned out it was OK in the end. I documented the efforts and the workarounds in this issue on Github. Essentially I did this:

  1. Install MacFUSE
  2. brew install flac libvorbis lame libid3tag clang
  3. Clone the mp3fs repo
  4. Remove all conditional defines in src/mp3fs.cc (from #ifdef __APPLE__ to #endif) (PR here)
  5. Run the below script
# from repo root
make distclean 2>/dev/null || true
git clean -xfd  # if it's a throwaway tree; removes all build artifacts

# Ensure there is no mix of GCC and Clang, leading to incompatible ABI's export CC=clang export CXX=clang++

# Make sure pkg-config finds Homebrew export PKG_CONFIG_PATH=/opt/homebrew/lib/pkgconfig

# Configure using libc++ and Homebrew include/lib paths ./configure </span> CPPFLAGS="-I/opt/homebrew/include" </span> LDFLAGS="-L/opt/homebrew/lib -stdlib=libc++" </span> CXXFLAGS="-stdlib=libc++" </span> LIBS="-lc++ -lFLAC++ -lFLAC -logg -lmp3lame"

make -j make install

Profit!

This is how I mounted my directory of FLAC files as 128 kbps CBR mp3's:

mp3fs  -b 128 /Users/carlerik//Musikk/ ~/mp3fs

I can know access them in VLC, iTunes or use the web software to transfer files to the Casio WMP-1 watch.

Tags