Wednesday, November 11, 2009

OpenOffice.org And The OOoLilyPond Extension – Part Two



Note: this is part two of a two-part post on using OpenOffice.org with the OOoLilyPond extension for documents used in a Music Education setting. Please see part one for information on downloading and installing OpenOffice.org, LilyPond and the OOoLilyPond extension.

Throughout this installment, click on images to view them at higher resolution.


The previous post gave some background information on two common methods of mixing text with music examples in documents intended for the music education setting: using graphics exported by commercial score writing programs in a word processing document; and using the text utilities of score writing programs to place text around and between music examples. Both methods have drawbacks. They're both inordinately time consuming. Depending on which method, you can end up with music excerpts of a poor graphic quality or text that is poorly formatted. In the first case, the need to handle multiple graphic files in a single word processing document can lead to frustratingly poor system performance, resulting in hangs or crashes in the worst cases. The previous post concluded with information on how and where to obtain two open-source applications—the OpenOffice.org office suite and the LilyPond music engraving program—and an extension for OpenOffice.org called OOoLilyPond. To proceed with this tutorial, you need to have all three components installed on your system. Part one of this post can be found here. Assuming you have these three pieces of the puzzle up and running, let's get started putting them to use.

For this project, we'll be making up a short quiz – “Music Theory Quiz 3.” Let's start by opening a fresh OpenOffice.org Writer (the word processor) document. In the upper left-hand corner of your window, you should see a button called “OLy.” That's your OOoLilyPond extension and we'll be using that shortly. Right away, let's make sure any work we do is saved by saving the file and giving it a name. From the menu bar, choose 'File=>Save As...' or press Ctrl+Shift+S. In the resulting dialog, give it the name 'mt_quiz3' and save it to a convenient location such as your desktop. Let's add the quiz title and type a space for students to write their names. You can do this whichever way you're used to. Now we're ready to start making up the quiz.
Now, when I make a worksheet or lesson, I like for text and graphic elements to be aligned and laid out in a uniform way. I've found that using tables is a great way to achieve this. Using tables requires some planning, so let's plan. This quiz will have 8 multiple-choice questions, with each question referring to a short music example. I think the best arrangement for this will be to have two columns, with four questions in each column. Let's allow each music example and each question to have its own cell, so that one excerpt and question combo would require two cells. For 8 questions in two columns, this means we need to insert a 2 x 8 table into our document. Locate the 'table' button on the toolbar and click on the down-arrow to the right. Drag the mouse down and to the right until you've highlighted a selection of 2 x 8. Now we have a 2 x 8 table inserted into our document. Those grid lines are a distraction, so let's get rid of them. Select the whole table by pressing Ctrl+A. The table should now be shaded. On the floating 'Table' toolbar, click the 'Borders' button, then click the first button in the drop-down, the one that shows a square with no black lines around it. The table boundaries are still visible, but now they're not bordered with black lines and will not print. Insert the quiz instructions above the table, and now we're ready to start adding music examples and questions.

Click inside the first cell. This is where our first question's music example will go. Go ahead and number it by typing “1.” followed by a space. Now, click on the 'OLy' button we highlighted earlier. Here's where it gets cool. The OOoLilyPond extension opens the “OOoLilyPond Editor,” a simple text-editor with some options for LilyPond. All of the default options are fine for now, so let's tap out our first music example in LilyPond code. (For information on getting started with LilyPond code, see here.) Click inside the text editor and press Ctrl+A to select all of the default code, and then press the Backspace or Delete key to get rid of it. Now, type your code, and press the 'LilyPond' button in the bottom right of the window to call LilyPond and compile your music example. The OOoLilyPond extension will do its thing and after a few seconds, you'll have a partial measure of music right there in your document. Now, click inside the second cell in the first column and compose your question. To get the lettering format I used, click the 'Numbering On/Off' button on the main toolbar, and then click the 'Bullets and Numbering' button on the resulting, floating toolbar. In the 'Bullets and Numbering' dialog, click the 'Numbering type' tab and select the matching option and click 'OK.'
This is the time to admire our handiwork a little. Using the 'PDF Export' feature of Writer, we can make a high-quality PDF file for viewing and printing. The 'Export Directly as PDF' button is located on the main toolbar in Writer, so go ahead and click it. Give your file a name in the resulting dialog, choose a location and click 'Save.' Now, open the PDF in Adobe Reader and zoom way in. That's pretty good, but the graphic looks a little fuzzy (click the image for a closer look). Fortunately, we can fix this in the OOoLilyPond editor window. In Writer, click on the music example to select it, then click the 'OLy' button again to reopen the editor. Then, click the 'Config' button to open the Configuration dialog. On the right, there's a box for setting the resolution for LilyPond's graphic output. The default is 300 which is a little low. You can adjust it to suit your own sensibilities. The maximum is 2400, so I'll type that in and click 'OK' to return to the OOoLilyPond editor. In the editor, I'll click the 'LilyPond' button to recompile the music example at the new resolution. After that, export your file to PDF again. If Writer asks you whether you want to overwrite the existing file, choose 'Yes.' Go back to Adobe Reader and check the result. As you can see, the graphic is much sharper. Now that we have things the way we want, it's time to get back to work.

At this point, it's a good idea to copy and paste what you've already done into the remaining table cells and then edit each individual example and quiz item from the clones of the first one. That will save you time in formatting additional cells, since the formatting is copied along with the text. All you'll have left to do then is to modify the existing LilyPond code and text. Once you're finished, keep a copy of the document as a template for future quizzes. Once you get proficient with the small amount of LilyPond code you'll need, you can whip up a quiz or worksheet of this length in about 20 minutes.

As you can see, high-quality, professionally crafted lesson materials are well within reach with the right tools. When linked together by the OOoLilyPond extension, OpenOffice.org and LilyPond provide the perfect one-two combination for quickly and easily forging top-rate worksheets and quizzes. By having access to the powerful and flexible LilyPond engraving program right inside OpenOffice.org Writer, we can eliminate the need to deal with two programs separately. Because we're using two distinct, specialized tools for the purposes they're intended for, we don't need to force any application to do a task it's not well suited to. We can have the best of both, with the drawbacks of neither.
You can download a copy of the full quiz made for this post by clicking these links: *.odt (OpenOffice.org) *.pdf (Adobe PDF)


Text and images Copyright © 2009 David B. Stocker

Monday, November 9, 2009

OpenOffice.org And The OOoLilyPond Extension – Part One


Note – this is part one of a two-part post on using OpenOffice.org with the OOoLilyPond extension for documents used in a Music Education setting.


In the past, mixing music and text in a word-processing document was complicated and time consuming. We were forced to choose between two less than optimal methods: exporting music examples one-at-a-time from a score writer into a text document, or typing text into a score writer between and around the music examples. The first choice required importing multiple graphic files, generated by the score writer, and placing them in the text document. Dealing with multiple files was inconvenient and could be a time drain. In addition, if the graphic excerpts were to be of fair quality, the file sizes could quickly become unmanageable and dealing with several of them in a single document often resulted in reduced performance of score writing and word processing programs on machines with modest specifications. This scenario usually ended in a compromise on the quality of the music examples, leading to worksheets and test papers that looked unprofessional (click images to enlarge). The second option produced better-looking output all the way 'round, but even the most expensive score writers did not handle text well. Paragraphs, bulleted or numbered lists, and text layout had to be faked by using spaces since the score writers' text utilities didn't handle common word processing tasks natively. Also, measures, staves and systems all needed heavy manual formatting in order to fit most worksheet or exam styles. With the second method, the results were definitely superior. However, it was even more time consuming than the first method. No matter which choice you made, the results were always mixed at best, forcing a tradeoff between quality and (relative) ease. But now there's a third choice: use a scoring program to make your music examples right inside your word processor by using a native plug-in.


Using two freely available software applications, music educators can print worksheets, exams, quizzes, custom lessons or any other document that uses printed music examples alongside text instructions. OpenOffice.org, the full featured, open-source office suite and LilyPond, the flagship open-source music engraver are both top-notch, free programs. In the past few years, LilyPond has matured into a real force in music engraving software. It produces beautiful music engravings that are the envy of expensive commercial programs. OpenOffice.org, with its support of open standards for document file formats has become a mainstay of Governments and Higher Learning and, more recently, schools and businesses.


OpenOffice.org is every bit as functional as Microsoft Office and has a familiar interface common to many office software suites. Since it's available for Windows, Mac OS and GNU/Linux platforms, it's an option for virtually anyone who uses a computer. What's more, with its impressive selection of available plug-ins, it's functionality is customizable for a staggering array of tasks and working environments. One of these plug-ins is the OOoLilyPond extension. With OOoLilyPond for OpenOffice.org Writer and Impress, you can use LilyPond right inside your text document or slide presentation. This method involves learning some LilyPond code (LilyPond uses a text-based markup syntax rather than a point-and-click graphic interface), but the minimal code required to use the OOoLilyPond extension is well-worth learning for the time and trouble it will save you.


For the next installment, we'll create a short, multiple choice music theory quiz using OpenOffice.org with the OOoLilyPond extension. Unless you already have all three required components for this project (OpenOffice.org, LilyPond and the OOoLilyPond extension), you'll need to do some preparation. Here's your homework:


  1. Download and install the latest OpenOffice.org suite from the OpenOffice.org website – http://www.openoffice.org/


  2. Download and install LilyPond from the LilyPond website – http://lilypond.org/web/install/ LilyPond is developing rapidly, so if you like bleeding edge software, be brave and get the latest 'development branch' (currently 2.13.7-1). The development branch is typically very stable.


  3. Grab the OOoLilyPond extension from Sourceforge - http://ooolilypond.sourceforge.net/ The download, installation instructions and other information are all on the same page.


  4. Read up on some LilyPond syntax in the online documentation – the Tutorial section of the Learning Manual is an excellent place to start.

Text and Images Copyright © 2009 David B. Stocker

Next post - Using OpenOffice.org and LilyPond to make worksheets, tests and quizzes.