Rescuing your old MiniDiscs

A script to semi-automatically backup your MD collection to your computer.

What's this about?

In the late 1990ies I was a happy owner of a Sony MiniDisc recorder. It was then a big leap from the Sony Professional Walkman I used before that, both in terms of audio quality and in terms of physical size.

When my fine MD recorder finally died sometime around 2002 I replaced it with a substantially cheaper NetMD Walkman which lacked the microphone input, but featured a USB port.

From that point on, things did not work well. The software that came with my new MD player was an exceptionally horrible flash-based "manager" that worked only on Windows. And as if that was not enough, someone apparently thought it would be a good idea to disallow digital transfers (MD -> PC) of self-recorded tracks! Great. Not only did this successfully prevent me to "pirate" my own microphone recordings. It also permanently drove me away as a customer of future MD-based products. I subsequently used a flash-based pocket recorder from Zoom.

To the rescue!

Well, whatever. Below is a script that uses the reverse-engineered USB protocol to start playback on the MD recorder and start a recording on the PC, so you can at least do a halfway-automated backup of your MD collection to some future-proof format and never look back again. Track titles are preserved, but apparently noone knows how to read the recording timestampt over USB. Still, better than nothing!

Prerequisites:

  • The omd command line utility. If the tool does not recognize your MD player, it might be necessary to add your particular model and USB ID (Get it from the System Info or lsusb) to the definition of struct omd_unit_info_t in omd_unit.c and run make omd.
  • Ecasound is used to start a recording from the command line. I used the Jack input driver.
  • Sox is used to cut up the resulting whole disk recording into tracks.
  • Finally the tracks are piped to lame to create VBR encoded mp3s.

The code

#!/bin/bash
OMD="./omd"
SOX="sox"
ECA="ecasound -i jack,system"
LAME="lame -b 220"
drift=30

echo "### Reading TOC"
diskname=`$OMD list |grep -e "^Disc title: " |sed -e 's/^Disc title: //' -e 's/[( )]/_/g' `
outdir=out_`date +%y-%m-%d-%H-%M`_$diskname
mkdir $outdir
$OMD list >"$outdir/index.txt"

echo "### Recording DISK"
tracknumber=1
totallength=`egrep "^Total time: " "$outdir/index.txt"`
rectime=`echo $totallength|awk 'BEGIN {FS=":"} {print $2*3600+$3*60+$4+$drift}'`
echo "Playing from track $tracknumber"
$OMD play $tracknumber
echo "recording for $rectime seconds..."
$ECA -t:$rectime -o "$outdir/disk.wav"
printf "done\nstopping playback...\n"
$OMD stop

echo "### Splitting and transconding WAVES"
line=`egrep "^ ?$tracknumber\)" "$outdir/index.txt"`
pos=0
# for each track
while [ "x$line" != "x" ]; do
    trackname=`echo $line |sed 's/^.*:..\... -//'`
    tracklength=`echo $line |sed -e 's/.* \(.\?.:..\...\) -.*/\1/'`
    seconds=`echo $tracklength|awk 'BEGIN {FS=":"} {print $1*60+$2}'`
    echo "Processing track $tracknumber \"$trackname\""
    $SOX "$outdir/disk.wav" -t wav - trim $pos $seconds | \
    $LAME - "$outdir/$tracknumber-$trackname.mp3"
    pos=`echo $pos+$seconds |bc`
    tracknumber=$[$tracknumber+1]
    line=`egrep "^ ?$tracknumber\)" "$outdir/index.txt"`
done

What's missing?

Sadly, I found no way to preserve the date of the recordings. Apparently that part of the USB protocol was never reverse engineered.

It is also very likely that the recording and MD player drift if you are not using an optical output. You might need to perform a linear correction to the track starting times.