Dynamic Generation of Musical Notation from Musicxml Input on an Android Tablet
Total Page:16
File Type:pdf, Size:1020Kb
Dynamic Generation of Musical Notation from MusicXML Input on an Android Tablet THESIS Presented in Partial Fulfillment of the Requirements for the Degree Master of Science in the Graduate School of The Ohio State University By Laura Lynn Housley Graduate Program in Computer Science and Engineering The Ohio State University 2012 Master's Examination Committee: Rajiv Ramnath, Advisor Jayashree Ramanathan Copyright by Laura Lynn Housley 2012 Abstract For the purpose of increasing accessibility and customizability of sheet music, an application on an Android tablet was designed that generates and displays sheet music from a MusicXML input file. Generating sheet music on a tablet device from a MusicXML file poses many interesting challenges. When a user is allowed to set the size and colors of an image, the image must be redrawn with every change. Instead of zooming in and out on an already existing image, the positions of the various musical symbols must be recalculated to fit the new dimensions. These changes must preserve the relationships between the various musical symbols. Other topics include the laying out and measuring of notes, accidentals, beams, slurs, and staffs. In addition to drawing a large bitmap, an application that effectively presents sheet music must provide a way to scroll this music across a small tablet screen at a specified tempo. A method for using animation on Android is discussed that accomplishes this scrolling requirement. Also a generalized method for writing text-based documents to describe notations similar to musical notation is discussed. This method is based off of the knowledge gained from using MusicXML. 3 Dedication This document is dedicated to my family. 4 Acknowledgments I thank my advisor, Rajiv Ramnath, for all his help and guidance in the completion of this project and thesis. I also thank Peter Rogers and Tony Wells for their vision and support. I additionally thank Michael Jewitt for his role as my teammate for the initial part of my project. 5 Vita May 2007 .......................................................Avon Lake High School June 2011 ......................................................B.S. Computer and Information Science, The Ohio State University September 2011 - present ..............................Graduate Student, Department of Computer Science and Engineering, The Ohio State University Fields of Study Major Field: Computer Science and Engineering 6 Table of Contents Abstract ............................................................................................................................... 3 Dedication ........................................................................................................................... 4 Acknowledgments............................................................................................................... 5 Vita ...................................................................................................................................... 6 Fields of Study .................................................................................................................... 6 Table of Contents ................................................................................................................ 7 List of Tables and Figures................................................................................................... 9 Chapter 1: Introduction ..................................................................................................... 10 1.1: Organization of this Document .............................................................................. 12 Chapter 2: Background Information ................................................................................. 13 2.1: Basic Sheet Music Description .............................................................................. 13 2.2: Android ViewGroups and Layouts ........................................................................ 16 2.3: Visual Impairments and Music .............................................................................. 17 Chapter 3: Related Research ............................................................................................. 19 Chapter 4: Implementation ............................................................................................... 23 4.1: Music Data Structure.............................................................................................. 24 7 4.2: Layout/ViewGroup Hierarchy ............................................................................... 25 4.3: Measure Width ....................................................................................................... 26 4.4: Note Placement ...................................................................................................... 26 4.5: Laying Out and Measuring Accidentals ................................................................. 28 4.6: Laying Out Beams.................................................................................................. 29 4.7: Laying Out Slurs and Ties...................................................................................... 30 4.8: Multiple-Staff Layout and Overlap ........................................................................ 32 4.9: Maximizing Tablet Screen Space........................................................................... 33 4.10: Method for Nesting Inside Android Relative Layouts ......................................... 35 4.11: Drawing Musical Symbols ................................................................................... 37 4.12: Color Changes ...................................................................................................... 38 4.13: Smooth Scrolling .................................................................................................. 38 Chapter 5: Insights in Text to Image Generation .............................................................. 40 Chapter 6: Conclusions ..................................................................................................... 44 6.1: Contributions .......................................................................................................... 44 6.2: Future Work ........................................................................................................... 44 Works Cited ...................................................................................................................... 46 8 List of Tables and Figures Figure 1: Simple Note and Rest Durations ....................................................................... 14 Figure 2: Beamed Eighth Notes ........................................................................................ 15 Figure 3: Labeled Music ................................................................................................... 16 Figure 4: Music Data Structure ......................................................................................... 24 Figure 5: Layout Hierarchy ............................................................................................... 25 Figure 6: Distance Between Lines is 1/14th of the Height ............................................... 27 Figure 7: Accidentalview .................................................................................................. 28 Figure 8: Beamviews ........................................................................................................ 29 Figure 9: Overlapping whitespace .................................................................................... 32 Figure 10: Two Parts Versus One Part ............................................................................. 34 Figure 11: Dotted Half Note, Rest, Petal, Fermata, Treble clef........................................ 37 Figure 12: MusicXML Excerpt ......................................................................................... 41 9 Chapter 1: Introduction It is currently standard for sheet music to be created in a one-size-fits-all paper format. This music is printed and distributed in music stores and available online for musicians to print out. It contains black print on white paper, and is generally printed on 9x12 inch paper with staff lines 1/16th of an inch apart. While this may be an acceptable format for the average music reader, it is not adequate for readers with low vision. Also some people prefer music in a different color scheme than black on white. Some people with visual impairments prefer white on black or yellow on black. People with cataracts read faster with white text on a black background (Elliott). These issues motivate a solution of dynamically generating sheet music in a desired size and color set by the user. To make this process easier for the user, an application that runs on a tablet device can be used to allow the user to set these parameters and immediately see the regenerated music. This thesis focuses on the process of generating musical notation on an Android tablet from a text-based input and displaying it to the user. This thesis describes the algorithms and data structures used to create an application that inputs a MusicXML file and displays the corresponding musical notation on an Android 3.0 tablet in a size and color scheme specified at run time. This thesis has several goals. The first is to create an application that is capable of reading in the MusicXML format on an Android tablet and displaying the notes and symbols in musical notation.