Representing, comparing and evaluating of music files Nikoleta Hrušková, Juraj Hvolka Abstract: Comparing strings is mostly used in text search and text retrieval. We used comparing of strings for music information retrieval. Melody represented as a mathematical vector is an input to an application which enables comparing and evaluating two music files, finding similarities or duplicates between two monophonic melodies whatever scale they are composed. In this paper is presented new approach in music representation, comparing and effective content-based music retrieval. Key words: Music, Information Retrieval, Melody Comparator, Melodic and Rhythmic Vector. INTRODUCTION IT - applications for musicians and students of music mostly deal with music as a sound or in form of music sheets. For both forms exists digital format, which enables the user to enjoy music in required form. These applications offer functionality like composing, playing, arranging, notating, transposing, printing musical sheets, save music files for ipod, import /export from/to other formats etc. Commercial or open source products for these type of applications are Finale, Sibelius, GuitarPro, Capella, Musescore, Encore etc. Other applications allow using mobile devices (ipad, phone ) as an interactive music stand or score library or sheet music store. Optical music recognition (OMR) is the main principle of application like Audiveris, Capella-scan or PDFtoMusic that by scanning recognize music symbols on printed music sheets and transform them to electronic music format. Web portals like Wikifonia, Musicnotes, ChoralWiki, Musipedia, Midomi offer different functionality with musical sheet: sharring with other users, downloading in various formats, buying, searching. Searching is based on metadata (author, artist, title, format). Musipedia and Midomi offer finding and identifying a tune according to a melody. Query is based on melody (pitch and rhythm), melodic contour or just rhythm. Melody can be played on a piano keyboard or whistled to the computer, rhythm is tapped on the computer keyboard or the Parsons code is used. Web is full of music files. Is melody in one file similar to melody in another one? How much? How to find it? In this paper we present application for comparing and evaluating similarity of two music files. MUSICAL NOTATION Note is a single musical tone of definite pitch and duration. Conventional musical notation is written on a five-line staff divided into bars. Notes indicate the duration and the pitch of a sound; they can be arranged in order of pitch to form scales. Clefs fix the pitch of the notes; accidentals indicate brief changes in pitch. Rests specify the duration of a silence [1]. Figure 1 gives an example of short polyphonic (up to four voices can sound in one time) music in symbolic format. Figure 1 Musical notation DIGITAL MUSICAL FORMAT Computers can represent music in two basic ways:
an audio file represents music as sound in order to play recorded music, a symbolic file represents music in graphical signs (Figure 1) relevant to performers who read the file in order to perform this music. Many digital formats have been developed for musical representation in last years. They all tried to represent music in symbols possibly the best way. There is not a standard for musical notation format. MIDI Music Instrument Digital Interface (MIDI) is an industry-standard protocol that enables electronic musical instruments to communicate, control, and synchronize with each other. MIDI does not transmit an audio signal or media it transmits "event messages" such as the pitch and intensity of musical notes to play. The most used MIDI-events are Note On and Note Off. Through these events sounds the tone in particular time. There are 128 MIDI-notes available. MIDI format does not provide the necessary musical semantic information to be used as a comprehensive format for music symbolic representation. It is unsuitable for the precise notation of musical information [2] nevertheless MIDI remains the most popular symbolic music interchange format in wide use. MusicXML MusicXML is a non binary format (in comparison to MIDI) for music representation and exchanging musical score information. It is based on the platform of extensible markup language (XML). Company Recordare LLC, first started to develop MusicXML in 2000. It was designed for musical score representation and enables saving and archiving scores in digital form. MusicXML represents common Western musical notation from the 17th century onwards. It was designed to represent complex, structured data in standardized way [3]. The content represented by the format is score oriented, e.g. the notes are represented as symbolic and graphical objects. The MusicXML is considered a sufficient interchange format for notation, analysis, retrieval and performance application [5]. MUSIC REPRESENTATION IN MATHEMATICAL VECTORS Musical sheet is a set of graphical signs. They give information to performers about the notes, their pitch, duration, rhythm, dynamic, signs that inform about repetition, tempo etc. Figure 2 gives an example of sheet music with monophonic (one voice) melody for one instrument, three measures (pickup measure plus two measures), time signature 4/4, sequence of notes in key signature C-major. Figure 2 Extract of soprano melody: song N.359 Ó, Mária primluvnica naša [7] Every note in a melody has its pitch. A symbol can stand for the pitch. A pitch interval stands for the difference between the pitch values of two consecutive notes. Every note has its duration. A symbol can stand for this duration. Melodic and rhythmic vectors We propose mathematical representation for music in form of vectors. We transform the melody into pitch intervals and assign them numbers according to the length of interval. Each type of pitch interval has the length and one of two orientations, up (+) or down (-). Pitch intervals create melodic vector. For duration of a note stands a number. The smallest duration interval is set on 1/2, as the shortest note in the example (Figure 2) covers exactly half of a beat. Duration intervals create rhythmic vector. The melodic vector of an example in Figure 2: (-3,-4,0,0,4,3,5,0,-1)
The rhythmic vector of an example in Figure 2: (1,1,2,2,1,1,1,1,2,2) [4]. Using pitch intervals instead of absolute pitch values enables finding similar or identical melodies written in different scales. It solves problem with scale transposing. According to exact pitch intervals it is possible to sort them into major and minor intervals and evaluate musical file considering human emotions as the conjunct intervals evoke happy emotions, on the contrary disjunct intervals evoke sadness. APPLICATION MELODY COMPARATOR Our application Melody comparator compares two music files and evaluates the result. Input are two music files in MusicXML format or one music file in MusicXML and melody edited by user on the interface (flash piano). Melody is extracted from the xml-file through the pitch values and transformed to sequence of symbols (C4C4C4E4G4C5). Afterwards pitch intervals between pairs of notes are computed and melodic vector can be created (0,0,4,3,5), see Figure 3. In our application are melodic vectors created by bars respectively Figure 3 Transforming melody to melodic vector Music is obviously written for more instruments than just for one. In this case music file contains several musical parts. They are in our application extracted separately in order to obtain set of monophonic melodies. Melody of each instrument is transformed to melodic vector separately. User must select melody of a given instrument on the interface to be compared (Figure 5). In the case music is written just for one instrument but polyphonic way (more then one tone sound at the same time), it means music is written in chords, note with the highest pitch from chord is taken into account. Other notes in chord are ignored. Melody comparator accepts as an input for comparison process monophonic melody as musical object in form of melodic vectors (Figure 4). Before starting comparison process different filters (highest tone in chord, ignoring sharps, ignoring rests, ignoring length of notes) could be applied by user to determine conditions, precision etc. Finally our comparing algorithm is applied in which values of melodic vectors are together compared step by step. Output of the method is a statistic with results of comparison (Figure 6). Application is designed on object oriented mode and programmed in Java programming language. Music files in MusicXML format are parsed [6].
Figure 4 Schema of the process in Melody Comparator Figure 5 Interface of Melody Comparator
Figure 6 Interface of Melody Comparator CONCLUSIONS AND FUTURE WORK Musical motifs must be represented in form of text-symbols or numbers when we want to use techniques from text retrieval for music information retrieval. In this paper we proposed representation of music by melodic and rhythmic vectors adequate musical motifs in musical piece. To find musical motif automatic way is not a simple task as it need not to be bordered by bar lines as it is in our case. In our application Melody comparator we determined musical motifs according to bar lines. Our contribution of this submission is in music representation by mathematical vectors. Melody transformed into set of intervals instead of exact pitch values enables search duplicate melodies whatever scale they are composed. It allows differentiate and monitor major and minor intervals since they evoke different human emotions. This opens new area for research in learning music and its impact on human manner electronic way. Melody comparator showed the possibility how to electronically compare two music files. It is useful for musicians or non programmers as well, as they can use flash piano for editing melody and on this way find similarity in music. REFERENCES [1] Contributors: Illustrated Oxford Dictionary, Dorling Kindersley Limited and Oxford University Press, ISBN 0-7513-110-3, (1998), pp. 558. [2] Cunningham, S.: Suitability of MusicXML as a Format for Computer Music Notation and Interchange, In: Proc. of IADIS Int. Conf. on Applied Computing. Lisbon, Portugal, (2003), pp. III-7. [3] Good, M.: MusicXML: An Internet-Friendly Format for Sheet Music. In: Proc. of XML 2001 Int. Conf., Orlando, USA, (2001).
[4] Habudová - Hrušková, N., Representation and Pattern Matching Techniques for Music Data. In: Student Research Conference 2011, Vol. 1 : 7th Student Research Conference in Informatics and Information Technologies Bratislava, 2011 Proceedings. - Bratislava : STU v Bratislave FIIT, 2011. - ISBN 978-80-227-3484-4. - S. 125-131. [5] Haus, G., Longari, M.: Music Information Description by Mark-up Language within DB-Web Applications. In: Proc. of the 1st Int. Conf. on Web Delivering of Music, 2001. IEEE Press, (2001), pp. 71-78. [6] Hvolka, J., Comparison of musical records, Bachelor theses, Slovak University of Technology in Bratislava, Faculty of Informatics and Information Technologies, FIIT-5212-47832, 2011. [7] Trnavský, M. S.: Jednotný katolícky spevník, Spolok sv. Vojtecha, ISBN 80-7162- 173-0, (1996). ABOUT THE AUTHORS Mgr. Nikoleta Hrušková, Slovak University of Technology in Bratislava, Faculty of Informatics and Information Technologies, Phone: +421 2 602 91 218, Е-mail: hruskova@fiit.stuba.sk. Bc. Juraj Hvolka, Slovak University of Technology in Bratislava, Faculty of Informatics and Information Technologies, Е-mail: xhvolka@is.stuba.sk.