Song Lyrics to ePub format

Thursday 09 October 2014 at 6:40 pm

As lead singer in my band Hot Cold Ground I'm hopeless at learning lyrics, so I always have a music stand with a big book of printed lyrics (and sometimes chords, but this IS a blues band, so not often!), which is just another bit of gear to carry around and set up.

I'm a long-time ebook reader, starting off reading on old Palm Pilot and Clié devices, before moving to cheap Chinese Android tablets, and recenly ending up with a Barnes & Noble Nook Simple Touch with Glowlight.  This last device is perfect, with an endless battery life and backlight for night-time use.

So with a second Nook purchased the next stage is to see if I can convert my lyrics document to use on the reader.  It does support .pdf but doesn't quite have the functionality I needed, like a contents list and one page-per-song.  Here's how I did it.

The ideal source format to convert is HTML, and I use the excellent and free Calibre to do the conversion (more on that later).  To create the source I used Dreamweaver, but there are loads of free HTML editors available.  I did try using Word's 'Save As HTML-Filtered' but it adds a truckload of extra crap.

The key here is to avoid most of the tags that normally get generated.  I'm not going to go into detail on HTML coding, again there are plenty of tutorials out there.  All you really need is the <h1> tag and the <br/> line break tag.  Avoid the <p> paragraph tag - it just causes confusion.  If you're typing in your content then use Shift+Enter for line breaks rather than Enter on its own. You'll probably need to manually edit your code to add the tags to titles.  I haven't explained this very well so here's an example:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Hot Cold Ground setlist Oct 14</title>
</head>

<body>
<h1>Song One Title</h1>
La la la verse 1 line 1<br />
La la la lyrics line 2<br /><br />
La la la verse 2 line 1<br />
La la la lyrics line 2<br/>
<h1>Song Two Title</h1>
etc etc
</body>
</html> 

The top bit (up to </head>) is auto-generated by Dreamweaver, then the important bit is enclosed between <body> and </body> tags.  Song titles (which the ePub will treat as chapters) need to have <h1> and </h1> either side of them, and each line of the song has <br/> (a self-escaping line break) at the end.  Add a second one if you want a gap between verses.

Depending on how you've put the lines in (I did it by copy & paste from Publisher, which initially didn't work - I had to paste into Notepad first then copy again) you may end up with those silly paragraph <p> tags.  You can leave them in if you want but it will indent first lines and waste space, so best to strip them out. 

Still with me?  Good.  Now save that document and get Calibre installed.  I'm not going to go through how to use the program, you can pick that up for yourself.  But basically, you import the .htm file you've just made into Calibre, then run its conversion routine to convert it to ePub.  The key part here is the Structure Detection, the first box dictates what Calibre will look for to make chapters, and it'll be your <h1> tags.  You can use the wizard here, but basically it needs to say //h:h1.  In the Table Of Contents section check the first box to force use of auto-generated Table Of Contents.  Apart from adding a picture if you want, you're good to go.  Stick the resulting converted file onto your eReader and that's it.  It works nicely for me, with most songs on a single page (text size dependent, of course), and when you swipe or press each song starts on a fresh page.

Next is attaching the Nook to my mic stand.  I've bodged something but it's not a permanent solution, so will probably end up buying a proper tablet holder.