Episode: 1732 Title: HPR1732: Renovating another Public-Domain Counterpoint Textbook Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr1732/hpr1732.mp3 Transcribed: 2025-10-18 08:22:15 --- This is HPR episode 1732 entitled renovating another public domain counterpoint textbook. It is hosted by John Culp and is about 34 minutes long. The summary is a follow up to ep 1512. I reflect on what I've learned digitizing to counterpoint textbooks. This episode of HPR is brought to you by an honesthost.com. Get 15% discount on all shared hosting with the offer code HPR15. That's HPR15. Better web hosting that's honest and fair at an honesthost.com. Hey everybody, John Culp and Lafayette Louisiana and I am responding to Ken Fallon's recent call for more episodes. This is something that I had been meaning to do for a while anyway and wasn't quite ready but it's really fine. I've got enough to talk about and I thought I'd go ahead and record and upload an episode. What I'm going to talk about is e-books again. This is sort of a follow up episode to episode number 1516 which was what was that entitled adopting and renovating a public domain counterpoint textbook. I believe was the title for that. In that episode I went over a recent project that I had been working on which was to take a public domain counterpoint textbook that was published in 1910 and had been scanned and dumped onto archive.org without any kind of correction or anything. To take this book and correct the OCR text and also to embed audio players for every musical example. Now the thing about music theory type textbooks is that they have what are called musical examples. They're little bits of musical scores in there with music notation and these are great. Every music textbook has one. What I've never seen in any music theory textbook is a play button under the musical example. Now of course for paper books this is not possible because it's paper but even for electronic formats I've not seen anybody do this before. So I did it. I made an e-book out of this book by Percy Gertschuss who was an American theory teacher slash composer who lived in the late 19th and I think he died in around 1943 or something like that. He published a ton of books not just about theory but also about music history and stuff like that. A very very prolific author and a good theorist and this counterpoint book looked like something I could use in my class. I teach one theory class a year mostly I teach music history but I do have a counterpoint class that I teach every spring and I decided to try to adopt this public domain counterpoint book so that my students would not have to pay for their textbooks. And at the point when I recorded the episode 1512 I believe I was nearly finished with the book or had just barely finished it and there were some issues that I still had to work out and so this is kind of following up on that and also talking about a second e-book renovation that I did of another counterpoint book by the same author. So the issues that I had were a couple with the elementary counterpoint book. One was that it was a fairly large file size. Whenever you start putting embedded media into an e-book the file gets large quickly. And this is, I mean it might or might not be a problem but I thought for best practice it's probably good to try to reduce the file size as much as possible. Nobody likes bloat. And so one of the things I did to reduce the file size significantly was to change the bit rate on all of the MIDI slash awk thing. So the way I have to make the musical examples is first I generate a MIDI file from a Lillipond source file. Lillipond is a music notation program and it can generate MIDI and so I create the Lillipond file and I run a script on that will output a MIDI file which is then converted both to awk and to MP3. Use awk and MP3 on the big web page version of the book and then for the e-pub version of the book I cut out all of the awk because the e-pub does not support that format and it would just be wasted space. Where was I going with that? Why don't you hate that when you lose the thread? Oh, I remember. So the script that I run on the Lillipond file performs this, you know, it outputs MIDI and then it also runs these conversions to MP3 and awk. And what I did was I changed one of the values in the MP3 and awk conversion part of the script that changed it from 128 kb, I don't even know what the bit rate. And 128 is like a standard fairly high quality MP3 sampling rate and I changed it to 64 so I basically I cut it in half and the quality was still acceptable. I experimented going all the way down to like 32 and I decided 64 was about the right like the sweet spot between quality and file size and when I rebuilt all of the musical examples after changing the bit rate. The file size of the counterpoint book went down from, I want to say the completed book was about 64 megabytes originally and after I changed the bit rate and ran everything again and rebuilt the book, it was all the way down to 26 megabytes and so it made a huge difference in the file size. So that's one thing I did. I changed the bit rate on all of the audio and that helped with the file size. I also wanted a way simply to view the e-book in a web browser without having to use an e-book app and this is because the web browser version actually is the most, what's the word? It's not really the most flexible one but it is mobile friendly and as much as it will reformat to fit small screens. All of the audio players are going to work every time. All of the hyperlinks that are in the text work every time. You can go to the address bar and use anchor tags to jump right to specific chapters, examples or whatever by directly typing in an address which is something that you can't do in the e-book format. So I wanted the HTML version to be there. I'm not going to get rid of it. It's actually in my source file. I edit the HTML version and use that as the source for creating all of the other ones. The problem is that the entire book makes for a very, very large web page. It takes kind of a long time to load up because of all of the images. I don't think it automatically loads up the audio files until you click the play button but there are quite a lot of images, probably 200 images or more. It took a while to load up and so I thought, well, I probably need a way to slice this great big file up into a bunch of little ones, like one file for each chapter or something like that. And I never did really find a way to do that automatically. And so I've left the single giant web page as one of the available formats for the book. What I did find though was an embedded e-book reader that I could put on my website and people can read the e-book in a browser but it behaves like an e-book where pages turn and there's a table of contents and all of that stuff. And that actually works pretty well. I'm going to put a link in the show notes to the project site. It's called Monical. Monical is the name of the e-book reader and it is a JavaScript, you know, a set of JavaScript I guess is how it would be described. If you put your content in the right place and you set up a, I don't even know what to call it, I'm not really a JavaScript person. I just took one of their templates and entered all of the table of contents information and stuff like that such that it would work and it's kind of a tedious process. But once it's set up, you don't really have to do anything to it. But it works pretty well. You can go just in a web browser and read it as if it's an e-book. It does require JavaScript and so people who are sensitive about security and don't really want to run JavaScript probably don't want to use this version of the book. But I think it's actually a pretty good way to see the book. Now I found that it works best with the Chrome browser or Chromium, whichever you happen to run. And this goes for not only the desktop but also a mobile phone, my Android phone if I use the Chrome browser, it works really well with this book. And it actually works better than many of the e-book apps that I tried on the phone and I'll talk more about compatibility with mobile devices here in a little bit. But the monocle page is, it's pretty cool I think and I'm happy with it. That's basically going to meet my solution for a web browser method of reading the book. One of the things I decided to do toward the end of elementary counterpoint, that was the first of the two projects. And then all of the way through the second project which was applied counterpoint. It's another counterpoint textbook by the same author, Percy Gurches. And it's a much more in-depth and detailed, advanced textbook, a terrific book with tons and tons of musical examples. And it's awesome, a really, really great book, a pity that it was not available. Well, actually, I shouldn't say that it is available. You can purchase copies of this applied counterpoint still in like cheap reprints that people have done because it's in public domain. They can just grab it and then reprint and sell it if they want to. And so you could still get the book, you could download the PDF. But again, PDF is not a good e-book format, it's completely inflexible and doesn't allow you to take advantage of a lot of the great things that the e-book format offers. And so I decided I would also overhaul applied counterpoint. And I decided on this one that I would do instead of creating brand new images out of lily pond files for all of the musical examples, I would instead take screenshots from the PDF. I started doing this about, I don't know, three fourths of the way through the elementary counterpoint book as well because it was just taking way too much time to create lily pond files for all of these things. And it's not, the problem was that each of these musical examples has not only the pitches and the staves and all that, that's actually pretty easy and quick to generate. But it's hard is any kind of analytical markup that the textbook author might have done, circling notes, drawing arrows, things like this, those take a lot of time and crazy amounts of code depending on the complexity of the markup. And so what I decided to do instead was to take screenshots of his original examples and then just generate audio from lily pond. This has a couple of benefits, one of the benefits of course is that it's way way faster. I'm able to get through way more examples, way more quickly and it still looks good. Now that the appearance of it I think is another benefit. You still get the look and feel of the textbook that was published in 1902 or 1910 depending on which one of the books I'm talking about. There's a different look to the music type setting back then. So although you're looking at an electronic book, you still get the kind of the feel of that old paper copy when you see these scanned slash screenshot examples. And since I was taking just screenshots, all of his analytical markup is already there in every image. So I didn't have to worry about any of that. I could just put in the notes, decide on a tempo and generate my audio files and put the code in there. So that worked really, really well. Another thing I discovered as I was nearing completion of the first book was the command line tools for caliber. Part of the problem that I was having with the first book and keeping my website updated with the latest edits was that it was extremely tedious for me to generate the ebook formats. In other words, the ePub and the AZW3 formats from the HTML file because I was having to import the HTML file into my caliber application on my desktop machine. And then right click on it to choose to convert it to this format to that format. And so I was like having to do all of this stuff manually and then copy the ebook file that was generated back over into the right folder and then push it to the website. This is not a good way to maintain a project that has many updates. And so it was quite a revelation to discover the set of command line tools that you can use with caliber. That's actually, I think it's all of the scripts that are run in the background when you click one of those buttons on the desktop application. A lot of Python scripts, I believe they are. But anyway, I discovered the command line tools for caliber. And once I figured out how to use them, I was able to script the updates of my ebook. So I have a script now called makeebooks.shuh.sh. And when I run the makeebooks script, it does several things. So it takes my source file, which is HTML. And it converts to ePub format. It converts to AZW3 format. It also unpacks the ePub file and copies all of the generated files from that into a different folder for the monical embedded ebook reader. And then it will, in a separate part of the script, push all of the appropriate files over to my server so that with one command, I create all the new versions and push all the files right into place on the server. And man, has this made life easier for always having the latest version of the book available on my website. So the command line tools for caliber are awesome. I'm going to have a link to the manual page for that. And I'm actually going to, where did I put it? Here it is. I'm going to put a sample conversion command on the show notes also. And I'll just speak it out briefly here. But the basic eBook conversion command is pretty easy. It's eBook hyphen convert space, followed by your source file. In this case, I'm putting a foobar.html. And then another space followed by the output file that you want. And caliber will determine which script to run based on the extension that you give your output file. So in this case, I have eBook convert space, foobar.html, space, foobar.epub. So that tells it to take that HTML file and output an ePub file from it. And then I have a series of command line options. Now to run it in its most basic way, you don't have to put any options. If you don't want to, it will just use all of its defaults. But if you want to change any of the defaults, then you can start adding command line options to it. And so I add the options dash, dash, output hyphen profile equals tablet in a space. Then dash, dash, disable hyphen font hyphen rescaling. And I did this one because I found that in the ePub version, actually both of the eBook versions, my sections of text that were done in a smaller font size, in my style sheet, I had said to make it something like 85 or 90% of the main font size. But in every case, caliber was changing this to 75%, no matter what I put. And I discovered that it was because it was doing something called font rescaling. And so as soon as I disabled the font rescaling, it would use the percentages that I told it to. So I use the disable font rescaling option. I use the smart and punctuation option, which is dash, dash, smart and dash punctuation. And then I use the left justification. That's dash, dash, change, dash, justification equals left. And then I tell it to preserve the cover aspect ratio. And then I give it a path to the cover image that I want to use. And the hardest part for me to get to work was the table of contents levels. What I wanted to do, especially for the second of the two books, the applied counterpoint book, was to have collapsible table of contents where on the first level you would have all of the chapters, chapter 1 through 22, in this case, there are 22 chapters. But each chapter is subdivided into different sections. And I wanted at a second level to have the sections listed. And I tried and tried and couldn't get it to work. And finally, I figured out how to do it. It's actually not that hard. But I had been trying to save those values in all of these command line options in one variable in my script. But for some reason, I don't know why the table of contents options were just not working. But as soon as I took those options out of the variable that held all of the other options, it started working. And so I use the, well, there are two different options having to do with the table of contents. There is use auto table of contents that is hyphen hyphen use hyphen auto hyphen TOC. And then hyphen hyphen level 1 hyphen TOC, this will set the level 1 table of contents. Open quote slash slash is at a back or forward slash, I don't know. I get the naming of these slash is mixed up. It's the slash that's used in web addresses, H colon H1. So it tells anything that is marked with an H1 tag, make that a level 1 table of contents. And so then I do the same thing, dash dash level 2 dash TOC is slash slash H colon H3. And that tells it anything that's marked with an H3 will be level 2 table of contents. Don't ask me why I skipped H2. I don't remember at this point, but I didn't feel like going back and changing it. So I'm going to put that whole command in the show notes so you can take a look if you want to. This script that I use to generate these ebooks is very much specifically for this book. And it's got options that I wouldn't necessarily use for other ebook conversions that I do. But I did make another generic script that I use for converting Project Gutenberg ebooks into the formats that I want and changing the appearance of the books in the way that I want to by pointing to my own style sheet instead of the original one. And then importing the books into my caliper library. All of this stuff can be scripted using their command line tools. And maybe that's something that I should talk about on another show. All of this stuff has to do with the generation and the creation of the books. Now, another big concern, of course, is how are people going to look at this book? And my preferred way for people to look at it is on an ebook app that supports audio playback and hyperlinks. The two big challenges that my ebooks offer is one embedded media. They have to be able to play the musical examples. The other is that there are probably more than 1,000 hyperlinks in the book. Every time the author mentions C Paragraph 23 for an explanation of this, there is a link that will take you right to paragraph 23 or whatever other place in the book that he talks about. And he does this constantly. He's always referring to different parts of the textbook to go see this, where I explain this thing, and then go look at this other thing, where I explain this other concept. And every time he does that, I link to it. Now, not every ebook app can handle this. Some of them don't display the links at all. Some of them have the links, but if you tap on it, it will go to the wrong place. And so I tested many, many different apps on both the iOS platform and on Android. Basically, the devices I have, I've got an iPad that was provided to me by the university. And so I tested several apps on there. I tested Blue Fire, iBooks, the Kobo app, KY Books, Marvin, NeoSore, the Nook app, Overdrive, and Google Play apps. All of those on iOS, and on Android, I tested Aldiko, Blue Fire, Cool Reader, eBook Reader, ePub Reader for Android, FB Reader, Kobo, Moon Plus Pro Reader, NeoSore, Nook, Overdrive, and Google Play. And if you listen carefully, I think you're going to hear Trumpet Guy. Now, the Trumpet Professor next door has just arrived and started a lesson, so I'm hoping I can wrap this up before it gets too annoying. So I tested all of these things, and I'm going to link to my eBook Reader compatibility table. I posted on my web server a table that shows all of the various things that you want the app to be able to do. And then color coding and text showing whether it did it or not. Boils down to on the iOS, there were three apps that did everything necessary. iBooks, which is the default eBook Reader for iOS, iBooks is terrific. It does the navigation links perfectly, the audio players work. It has an option to go back to your previous location, and it respects my styling. So iBooks, I'm very, very happy with it. It's good also that iBooks works so well with it because that way my students who use iPhones or iPads don't have to go find some other app to be able to look at the book. They can just download the book and start reading it. So I was happy with that. The Kobo app also worked pretty well. The links function as pop-ups, kind of like footnotes, but you have the option to click through and go to the location. And it's not ideal, but it's not terrible. The best app, though, was a paid app called Marvin. Marvin only reads ePub files, and it only reads non-DRM-D-Pub files. And so if you wanted to use Marvin as your only eBook app, you would have to strip DRM off of your books and use it after that. It costs $3.99, which is not terrible, but it works probably better than any of the other apps. The links work perfectly, the audio works great. And besides that, one of the things I really like about Marvin is that it comes with the open dyslexic font as one of your options for fonts. And as somebody who's concerned with accessibility, I'm happy to see this. So I highly recommend Marvin if you read ePub files a lot and if you have an iOS device. On Android things didn't work as well. The best of all of the apps was one that was simply called eBook Reader. The audio examples worked, the links mostly worked. They were sometimes unreliable. Sometimes they would go to the wrong place. It does respect styling. There's a way to go back to the previous location after you've tapped one of these things that said, go see here. I really wanted it to be able to go right back where you were. The links were unreliable and also it did this weird thing, like when you press play on the musical example, sometimes it would turn the page backwards. It would start playing the example, but it was also turned the page. And so you would have to flip back to the page you were on. So that's not ideal. The Kobo app on Android was not too bad. The paragraph links sometimes were inaccurate, though. Let me see. None of the other apps were really very good. Sadly, FB Reader does not support audio, because otherwise it worked really well. FB Reader I liked because it's very lightweight and also because it is issued under a free license. So I was really hoping that it would work, but it doesn't do the audio examples. It does everything else very well. And I also tried a couple of dedicated eBook readers. I have the Kindle Paper White, and it does everything great except no audio. The Kindle AZW3 format does not support embedded media, but otherwise, if all you want to do is read the book, it's awesome. But the best reading experience really is something like the Kindle with the E ink screen. My kids have no colors, so I tried it out on that. And the navigation was not very reliable. Navigation on the Kindle was excellent. It went everywhere it was supposed to go. Unreliable on the nook color, and it also did not support the audio players, even though it's basically a tablet, so that was pretty disappointing. Anyway, you can go look at that compatibility chart if you want to. It's kind of interesting. A couple of things I've learned from the whole process. A type-setting thing. Here's a little detail for type-setting nerds. I learned that there are three different types of dashes. One is the hyphen, which is used to connect words together or to break words into two pieces. Then there's the N-dash, the letter N, as in Nancy. N-dash is for showing a range of values. Like if you say from 1 to 10, you would not use a hyphen there. You use an N-dash. There's of course an HTML entity for N-dash, and there's a Unicode character you can use as well. Then there's the N-dash, which is for a larger break-in thought, like to break up a sentence into two parts. So that was kind of cool to learn, and I've very carefully tried to make sure I have the right kind of dash everywhere in the book. One thing that did not work, that I really wish had worked, is the embedding of fonts in the e-book formats. There, I found a great, free music font that would have allowed me to use... I bet that trumpet is really loud in this, isn't it? It's so annoying. I found a great music font that would allow me to use that font for meter symbols and for all kinds of musical things. But I just could not get it to embed properly in the e-book formats. It worked fine on my web version, but not on the others. And so I ended up using either very small images of the musical symbols when it had to occur in the text, or I just changed it to some kind of plain text and put it in editorial brackets. I should probably cut this off, but anyway, the projects are basically done. Now my students really like it. One of the students told me that she, for the first time ever, as a music student, is actually paying attention to the musical examples, because she can listen to them right there in the book. So they really like it, and of course they like the fact that it's free, and that they can read it on their phones and all that. In the future, I might create a companion workbook for elementary counterpoint. I'm actually partially begun on that. So taking the various exercise melodies that he's put in the book and formatting them as a workbook where the student can fill in the blank lines underneath the melodies that are given. All right, the trumpets really get into me. I'm going to sign off now and leave you with some trumpet playing scales. Bye, everybody. You've been listening to HECCA Public Radio at HECCA Public Radio.org. We are a community podcast network that releases shows every weekday, Monday through Friday. Today's show, like all our shows, was contributed by an HBR listener like yourself. If you ever thought of recording a podcast, then click on our contributing to find out how easy it really is. HECCA Public Radio was founded by the digital dog pound and the infonomican computer club, and it's part of the binary revolution at binref.com. If you have comments on today's show, please email the host directly. Leave a comment on the website or record a follow-up episode yourself. Unless otherwise stated, today's show is released on the creative comments, attribution, share a light, 3.0 license.