I recently got myself a 4Runner! It’s very nice, but it doesn’t have a CD player. So, to play music, you have to load it onto a USB drive (or use your phone).

In my state, you’re not allowed to touch your phone while driving. Except for navigation. So USB it is.

Tips & tricks, how to

There are a number of pitfalls

issues formatting the USB drive

Windows 10 will not make it easy to format a drive with FAT32.

Even if you drop down to the command line and run

format  E:  /FS:FAT32  /X  /Q

you might get an error

The volume is too big for FAT32.

I recommend walking over to the nearest Macintosh, opening Disk Utility, and hitting Erase. That’s it. Don’t waste your time.

Why Windows can’t format FAT32 drives is beyond me.

issues getting Toyota to read the file

You can’t play .aiff audio files, which are like .wav files for Macs.

You seemingly can play FLAC & ALAC, so I go with .m4a (ALAC).

You should be good to go if you’re using .mp3 or .m4a (AAC), the more usual stuff.

issues with your folder structure

I recommend doing this:

./USBDRIVE/
./USBDRIVE/Artist - Album/01 Track.m4a
./USBDRIVE/Artist - Album/02 Track.m4a
...

issues with playing out of order, alphabetical order not track order

Generally, you want to listen to an album like this

"Zebras Rule" (01 Zebras Rule.m4a)
"Giraffe Blues" (02 Giraffe Blues.m4a)
"Apes Stick Together" (03 Apes Stick Together.m4a)

but Toyota will, in its finite wisdom, likely decide to play alphabetically

"Apes Stick Together" (03 Apes Stick Together.m4a)
"Giraffe Blues" (02 Giraffe Blues.m4a)
"Zebras Rule" (01 Zebras Rule.m4a)

To get around this, I recommend editing all of your files to have numbered titles.

That is, the track should be titled “01 Zebras Rule” even though the true title is “Zebras Rule”. This causes the sort to go as we want.

Of course, I’m not going to do this by hand. Let the computer do the work!

converting thousands of files at once

It’s hard to get into a good place to do it, but I had success using

  1. MacBook Air, or Windows 10/Linux via WSL
  2. bash
  3. ffmpeg
  4. mediainfo & jq

Basically, I have

iTunes Library: ~80 CDs, stored .aiff

and I want

USB drive: ~80 CDs, different folder structure, stored .m4a (ALAC), re-titled

So here’s my workflow:

Original iTunes Library (C:\) ---copied---> Working Area (Z:\)

in Working Area, convert each file in one pass

in Working Area, re-structure folders

Working Area (Z:\) ---copied---> USB (E:\)

The main part is just a bash loop

for f in ./**/*.aif; do ffmpeg -i "$f"  -y  -acodec alac  -vn  -metadata title="$(basename "${f%.aif}")"  "${f%.aif}.m4a"  &&   rm "$f"; done

formatted for readability,

for f in ./**/*.aif; do
    ffmpeg -i "$f"
           -y
           -acodec alac
           -vn
           -metadata title="$(basename "${f%.aif}")"
           "${f%.aif}.m4a"
    && rm "$f"
; done

The key part about re-titling, I rely on the fact that iTunes already numbers the filenames, so I just need to get the filename, lose the extension, then blast away any existing title and use my stripped filename instead.

Make sure you have extglob, globstar, and nullglob turned on in bash.

These are bash options that are not usually set (for whatever reason), but greatly enhance the bash experience. You can make sure they’re set with

shopt -s extglob
shopt -s globstar
shopt -s nullglob

The folder part, I did more by hand, once per artist:

a="Andrew Bird"/; for d in "$a"/*; do mv "$d" ./"$(dirname "$d") - $(basename "$d")"; done; rmdir "$a"

formatted for readability,

a="Andrew Bird"/;
for d in "$a"/*; do
    mv "$d" ./"$(dirname "$d") - $(basename "$d")"
; done
; rmdir "$a"

and finally, I just hand-updated everything in Compilations/, which is a directory iTunes makes for multi-artist albums (kind of annoying, but not bad).

verifying work is done

I can make sure there are no non-.m4a files left, which to me look like input files. Remember, I’m converting .aiff -> .m4a. If you’re converting from .m4a it’s a bit more annoying to do it in-place, you might want a Working Area 2 to drop new files as you delete worked files from 1.

for f in ../../TUNES/**/*.!(m4a)$; do echo "$f"; done

This is where extglob comes in: I want to match everything that ends with anything but m4a. You could probably write this with standard globs, but I like this style.

The nullglob basically makes the command do nothing if no files come up; otherwise, it seems, the literal containing ./**/ is not expanded and is passed through, which is almost never what I would want.

To make sure there is no file with a non-numbered title, (which happened to me because I relied on Windows to copy over just the files that had changed)

for f in ./**/*.m4a; do mediainfo --Output=JSON "$f" | jq '.media.track[0].Title' | grep '^"[^[:digit:][:digit:][:space:]]' ; done

formatted for readability:

for f in ./**/*.m4a; do
    mediainfo --Output=JSON "$f"
      | jq '.media.track[0].Title'
      | grep '^"[^[:digit:][:digit:][:space:]]'
; done

I recommend just getting everything right in your Working Area, then blowing away everything on the USB and copying over fresh.

You shouldn’t need to run fatsort or anything like that to actually sort the files in the filesystem itself. Maybe your head unit is different, but mine doesn’t need that as it sorts filenames itself. Apart from the numbered-title thing, which I have handled above, it works great out of the box.

final result

You can Browse through the head unit via

  • Folders (the best, as it shows Artist - Album)
  • Artists (which works well, but separates Compilation artists, good and bad)
  • Albums (works well, but not ordered/grouped by Artist)

I’ve never had an album play out of order this way, yet.

which USB stick

I tried a 32 GB Samsung first, everything worked.

I’m now using a 128 GB Samsung (labeled USB 3.1). Read/write speed seems much faster. I do think the head unit can read it faster (less lag loading). I’ve no complaints with lag, really. It seems to continue playing as soon as the car comes on.

Specifically, I’m using a Samsung 128GB FIT Plus USB 3.1 Flash Drive, Speed Up to 300MB/s (MUF-128AB/AM).

Samsung 128 GB usb drive @ Newegg

Write-wise, it can put down about 50 MB/s. Not bad, I’d say. With ALAC compression, that transfers a CD about every 5-8 seconds.

Enjoy !

Once it’s all straightened out, this is basically the best head unit I’ve ever had in a car/truck. Easily hundreds of CDs of music without ever juggling discs or scratching them. A touchscreen, with search!

I hope this helps you enjoy your 4Runner, too, or whatever you drive.