Tuesday, April 3, 2012

Sandisk Clip+ Fun and Games

BB has been listening to audio books on CD from the library while exercising.  Dealing with the CDs is a bit of a pain while exercising so I've been ripping them to an SD card so she can listen to them using a small player.

She had been using an old Pandigital Android tablet.  It works but is a bit over large.  BB wanted a smaller player that could be clipped to her cloths as she exercises.  After a bit of research she bought a Sandisk Clip+.

I copied a book on CDs to a micro SD card and checked to see that it would play.  Everything looked OK but when BB played it the Clip+ died after a few minutes.  I was a bit surprised since the device was only a day old, but OK, electronics do bread, bit of bad luck, etc.  I exchanged the original device for a new one.  BB tried again with identical results!  A second broken device seemed rather unlikely so I decided to look into the problem.

A bit of google search found that the device can be reset by holding the power button down for 20 seconds.  Doing so restored the Clip.  Unfortunately when I played the book, the Clip+ froze and appeared dead after 5 minutes and 30 seconds.  Another reset, another test play and another freeze!

I loaded a different book, this time a set of MP3 files (the original book was WAV files).  The MP3 book played without issue.  So it looks like WAV support on the Clip+ is a bit dodgy.

It's not much of a chore to convert WAV files to MP3s.  I used this small script that I got from the net.

#!/bin/sh
# name of this script: wav2mp3.sh
# wav to mp3
for i in *.wav; do
 if [ -e "$i" ]; then
   file=`basename "$i" .wav`
   lame -h -b 192 "$i" "$file.mp3"
 fi
done

It took a bit to convert all the files in the book.  I reloaded the book now as a set of MP3s on the Clip+ and it now plays OK.

There was a bit more cleanup to do since the Clip+ uses MP3 tags to organize the files it plays.  Enter easytag.  I used it to set the MP3 tags based on the file name (fortunately it contained the autor, title, CD, and track as part of the name).  Easytag has a facility to batch set the MP3 tags.  I set tags as follows:

  • Album to book title
  • Artist to book author
  • Title to CD##Track##
  • CD to CD
  • Track to track

With that done the book is nicely compatible with the Clip+.

To make things a bit easier going forward I modified the python ap I used to rip the CDs to use a better name convention.

# audiobookcopy.py
# copy multiple CDs in an audio book
# cd appears to automount at ls .gvfs/cdda\ mount\ on\ sr0/
#
# Output file name format that should work well with various players
# Author/Title/CD??-Track??
#
# for info on ripping see http://www.chuckegg.com/quickly-convert-audiobook-cds-to-mp3-files-audio-book-mp3/
# for info on easytag see http://easytag.sourceforge.net/EasyTAG_Documentation.html#ch_1_2_4
import sys
import os
import shutil
dir = "/home/rbell01824/.gvfs/cdda mount on sr0"
def ensure_dir(f):
    if not os.path.exists(f):
        os.makedirs(f)
def cacd( author, title, cd ):
    print "Processing CD ", cd
    files = os.listdir( dir )
    ifn = 1
    for fn in files:
        src = dir+"/"+fn
        dst = author+'/'+title+'/'+'%02d'%cd+'-%02d.wav'%ifn
        print "Copy ", fn, " to ", dst
        shutil.copy2( src, dst )
        ifn += 1
    return
def abc():
    if (len(sys.argv) < 3 ):
        print "audiobookcopy author title start_CD"
        print 'audiobookcopy RJB "life Notes" 1'
        exit(1)
    print sys.argv[1:]
    author = sys.argv[1]
    title = sys.argv[2]
    ensure_dir( author )
    ensure_dir( author+'/'+title )
    cd = int(sys.argv[3])
    print "start with disk "+str(cd)
    while cd <= 200:
        kbi = raw_input( "Mount CD "+str(cd)+" Press enter:\a" )
        cacd( author, title, cd )
        cd += 1
if __name__ == '__main__':
    try:
        __file__
    except:
        sys.argv = [sys.argv[0], 3]
    abc()

With those changes made it should be easy to load books on the Clip+.  After a bit more use I'll probably update the python ap to convert to MP3 if necessary and to set tags as part of the process so it's not necessary to use multiple tools.

No comments: