Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you represent music in a data structure?

How would you model a simple musical score for a single instrument written in regular standard notation? Certainly there are plenty of libraries out there that do exactly this. I'm mostly curious about different ways to represent music in a data structure. What works well and what doesn't?

Ignoring some of the trickier aspects like dynamics, the obvious way would be a literal translation of everything into Objects - a Scores is made of Measures is made of Notes. Synthesis, I suppose, would mean figuring out the start/end time of each note and blending sine waves.

Is the obvious way a good way? What are other ways to do this?

like image 789
allclaws Avatar asked Jan 22 '09 03:01

allclaws


People also ask

Which data structure would be used in music?

Data structures used include a doubly linked list, stacks and queues. File handling to read and write songs has also been used.

Can a music be a data?

While we have seen audio being turned into data, can we also write music as datasets? The answer is simple: Yes! But things can get more interesting when other properties of music are brought into consideration.

Where is music notation placed?

Music notes are drawn on the lines and spaces of the staff. The location of the notehead (the dot part of the note) indicates which note to play. If the notehead is on a line for F, the note to be played is F; a notehead on a space for A means to play the note A.

How do you describe music notation?

musical notation, visual record of heard or imagined musical sound, or a set of visual instructions for performance of music. It usually takes written or printed form and is a conscious, comparatively laborious process. Its use is occasioned by one of two motives: as an aid to memory or as communication.


1 Answers

Many people doing new common Western music notation projects use MusicXML as a starting point. It provides a complete representation of music notation that you can subset to meet your needs. There is now an XSD schema definition that projects like ProxyMusic use to create MusicXML object models. ProxyMusic creates these in Java, but you should be able to do something similar with other XML data binding tools in other languages.

As one MusicXML customer put it:

"A very important benefit of all of your hard work on MusicXML as far as I am concerned is that I use it as a clear, structured and very ‘real-world practical’ specification of what music ‘is’ in order to design and implement my application’s internal data structures."

There's much more information available - XSDs and DTDs, sample files, a tutorial, a list of supported applications, a list of publications, and more - at

http://www.makemusic.com/musicxml

MIDI is not a very good model for a simple musical score in standard notation. MIDI lacks many of the basic concepts of music notation. It was designed to be a performance format, not a notation format.

It is true that music notation is not hierarchical. Since XML is hierarchical, MusicXML uses paired start-stop elements for representing non-hierarchical information. A native data structure can represent things more directly, which is one reason that MusicXML is just a starting point for the data structure.

For a more direct way of representing music notation that captures its simultaneous horizontal and vertical structure, look at the Humdrum format, which uses more of a spreadsheet/lattice model. Humdrum is especially used in musicology and music analysis applications where its data structure works particularly well.

like image 181
Michael Avatar answered Oct 29 '22 17:10

Michael