How to format guitar tabs for kindle / e-reader

During the summer of 2013, as I was preparing to leave to lead students in the wind rivers, I was peer-pressured into buying a ukulele to bring along on our 30-day course. It worked out really well, although I felt severely limited by the handful of songs I had memorized at the time. When I got out, I spent some time digging into how to get guitar tabs into an e-reader format that I could use on my Kindle. It seemed like the perfect solution to bring along as many songs as I could think of without continually adding paper weight and bulk.

Well, it turns out getting tabs into an e-reader format is easy, but getting them to stay formatted on the e-reader is HARD. If you just throw the tabs into a word document and try to upload them to your device they lose all the formatting, chords disassociate from the lyrics, and are hard to read. If you put them into a PDF and upload them they don’t scale to size well and are hard to read.

Well formatted, aligned, readable, scaleable guitar tabs on the Kindle!

Well formatted, aligned, readable, scaleable guitar tabs on the Kindle!

In the following I’ve laid out a a step-by-step tutorial to create a system you need to build your own kindle/e-book full of guitar tabs that will stay in the formatting they need to be usable! This relates specifically to putting them on a Kindle, but (I think) should be pretty well adaptable to any e-reader. Your end result will be a .mobi file and you can convert that to plenty of other formats with Calibre.

The basic steps we’re going to go through are the following. First, if you don’t already have it you’ll need to download a couple pieces of software to help in the process. Next you can download a package of files that will make up the e-book. I’ve put together the files with a couple tabs already included so you can see how they work together. Finally you’ll go through the process of finding a new tab online, formatting it for use in the e-book, adding it to the e-book, and then compiling (building) the e-book so it’s ready to be used on your Kindle.

There are quite a few steps but I’ve tried to include pictures and be as detailed as possible in each. If you’re trying to follow this and run into trouble please let me know.

Step 1)

To begin, the software you need is the following. Download and install these on your computer:

  1. Kindle Previewer will allow you to preview your e-book, but more importantly it is the took that assembles all of the pieces into a finished product.
  2. Notepad++ is a powerful text-editor that contains, in particular, the ability to record macro commands you can used to repeat actions. It is what we will use to format tabs before adding them to the e-book, and also what we can use to edit the e-book files themselves. This will only work on a Windows machine…for the time being, sorry Mac users Sad smile With a little extra brainpower the process should be fairly transferable, though. (NOTE: If some or all of what I just mentioned makes sense to you, feel free to use your editor of choice. If none of it makes sense don’t worry! I’ll explain it all further on.)

Step 2)

Next, or while your are waiting for those to install, download and unzip the sample tab & chord e-book:

  1. SampleChordAndTabEbook.zip
  2. Unzip it into a directory, and you should have something that looks like this:

unzipped-folder

If you’ve done any web development, some of this will look familiar. If you haven’t, don’t worry, we’ll get there! If you double-click on book.html it will open in your default browser (chrome/firefox/ie/etc…), and you’ll see three songs, formatted like tabs you might find anywhere on the internet. I’ll go through the other files a little later, for now lets find a tab and format it!

Step 3)

Get a new tab to format and put into the book. I personally like ultimate-guitar.com for tabs, so let’s start there. I’ll use Patient Love by Passenger. It’s a great song, and this version has both tabs AND chords, so we can see how both will look once we format them. On that page, I’m going to scroll down to the button that says ‘print’ and click it.

ug-print

Step 4)

This brings us to a page that is uncluttered and, more importantly, unformatted. Now, select the portion of the tab you want and copy it.

ug-select

Step 5)

Open up Notepad++. It should look like the picture below, with a file browser on the left. If it doesn’t, click the Explore… button.

np  -explorenp  -start

Step 6)

Paste the tab you just copied into this empty document.

np  -pastetab

Step 7)

Then in the explorer section navigate to the directory where you saved the template e-book and open the file called book with the extension html.

np  -files

Step 8)

Create a place in the .html file to paste the new tab. Do this by copying the “template” code shown highlighted in the picture below and pasting it below the other 3 songs. You can collapse the <p> tags to make it more readable.

np  -copycode

Step 9)

Now switch back to the song you pasted into your empty document and edit out any pieces of the text you don’t want. We’ll put in a tittle later, so you don’t need it included here. I like to remove extra line breaks and add in the fingerings for any chords used in the song that I have a hard time remembering.

np  -tabedited

Step 9.1)

Ok, now for one of the trickier parts, so stay with me. We’re going to create a Macro in Notepad++ that will take every empty space in this tab and, essentially, cement it in place. That will keep the chords evenly spaced above the lyrics. Without this, when we put the tab onto an e-reader, multiple spaces in a row would be collapsed down to a single space.

The first part is to start recording a macro

np-macrostart

Step 9.2)

Then we’re going to open up the Find (search/replace) window

np-searchfind

Step 9.3)

Now in the Replace tab, make sure it looks just like this picture. We’re going for Find \r\n and we’re going to Replace with <br/>\r\n. This keeps all of the lines exactly how we want them, preventing and automatic paragraph wrapping like you would see in a normal book. Hit the Replace All button to make the changes.

np-frbreaks

Step 9.4)

Next we Find all of the spaces ‘ ‘ (like just a blank space) and Replace with the HTML name for spaces, &nbsp; This is how we preserve all of the formatting we want in our tab. One you’ve got that entered hit the Replace All button again.

np-frspaces

Step 9.5)

We’ve successfully recorded the macro. Your tab also got formatted in the process! The reason we made a macro is so that you can now easily format any FUTURE tabs. Once you get the hang of this process, adding to your e-book is not problem.

Stop the recording, then save the macro.

np-stopsave

Step 9.6)

Give it a name and, if you want, a keyboard shortcut.

np-save

Step 9.7)

That’s all there is too the macro part. For your next tab you can access this macro from the Macro menu. You’ll see the name you gave it, and the shortcut keys if you added any.

np-runmacro

Step 10)

Whew, got that over with. Now select this entire tab we just formatted, and copy it. Switch back to the Book.html tab and paste it between the <p class=”noindent”> tag and the </p> tag. You’ll have something that looks about like this:

np-pastedtopnp-pastedbot

Step 11)

The final touch in this book.html file is to give our tab a title and link it to the table of contents. Add an entry on top like shown, <a href=”#pl_p”>Passenger – Patient Love</a><br/> then fill in the items below with the name=”pl_p” and the title and artist for the tab. The href/name code can be whatever you want, but they have to match and they have to be unique (from other code used by other songs). The one on top should always be preceded by a ‘#’ as shown. Remember the code you used here, we’ll need it once more.

np-toctitle

Step 12)

Before you save and close the book, you can preview what you’ve just done. On the file menu select Run –> Launch in (whatever browser you like). You can make sure that your table of content link works and that the tab you’ve just pasted in is formatted like you expect.

After that you can save and close book.html and the tab you formatted. I like to save my formatted tabs as their own file just because, but if the preview looks good it doesn’t really matter…up to you.

np-run

Step 13)

Close to done, one more file to edit before we can build our e-book. Open up the file toc with the extension ncx. The table of contents in the book.html file is used when browsing the book itself. This toc file is used by the kindle menu. Copy and paste one of the items in there at the bottom and update it with our new tab’s information! Note that you need to use the same code (pl_p in this case) for the link to work!

np-toc

Step 14)

Now open up the Kindle Previewer program we downloaded in the beginning. Click the Open Book link, navigate to your folder with the e-book files, and open the file book.opf.

kp-open

Step 15)

Once you hit open the book will compile. If all the steps were done correctly, you should get a success message. When you hit OK Kindle Previewer will open your new e-book for you to browse and ensure everything looks complete.

kp-success

kp-options

Step 16)

And that’s about it. Now in your Tabs Ebook directory you have a new folder called converted-book.opf with a .mobi file inside. This is your new e-book, and you can upload it to your kindle however you might normally. Personally I like Calibre to manage e-books!

image

I hope this works for you, I really love having a larger collection of songs to pull from without having to carry around a big book or binder, especially when I’m out in the backcountry for 30 days. Please leave a comment or e-mail me with any questions or trouble!

Leave a Reply

Your email address will not be published. Required fields are marked *