I'm making a program that creates music. How it does this is by taking a lot of different classical piano pieces to try to learn the general structure of a piece. I have made the program, but there is only one problem - I need the songs. Now, there is plenty of sheet music for classical piano pieces out there, but my program needs the notes in plaintext. Is there an online repository of these or an easy way through software to get them? The format of the text doesn't matter as long as the format is consistent throughout all of the songs.


there's the .abc format and lilypond format. Those are about the only widely used text only score formats. But geared for making graphical notation, not analyzing scores. There's musicxml, too. But it's not very standardized and is also more geared for notation than analysis.

I kinda suspect you don't know what you're getting into :)

music is not expressed best in text. it's best expressed graphically. the time dimension (rhythm) and the frequency of note dimension almost require 2d graphics at the minimum. (pianoroll format is easiest for a computer - but not human).

so figure out how to load a .midi file. That's the standard way all scores are stored. and there are loads of them everywhere. http://imslp.org is a good spot. I'm not exactly sure how you plan to analyze the "general structure".

That sounds like a "wishful spec" that has not even started to be broken down into an actual spec. You're going to have to start with figuring out what music actually is and go from there. Can you create music by looking at lots of scores' structures manually? Because if you can't do that manually, you have no hope of programming a computer to do so.

I'm not specifically trying to sound negative, just letting you know that you are in for a pretty big learning curve :) But I've been through it. It's a great learning curve to go through. I highly recommend it. You will learn a LOT and enjoy music during the process. It's also a good idea to pick up an instrument, say piano. Best of luck to ya!

  • 1
    Just joined the community, this is the OP. The way I'm doing it is through a Markov chain, basically taking taking a bunch of classical music and creating random music based off of all of them. The only problem is the programming language I'm working on can not analyze images. Although, I'll look into analyzing midi. It seems a bit daunting but definitely doable. Thanks!
    – Nico A
    Nov 15 '15 at 12:43
  • @TreFox, MIDI has the advantage of offering a compact numerical representation of very nearly all the parameters that concern you, such as pitch, duration, sequence, dynamics, and so forth. It has a few other advantages: as Mr. Hazel has stated, it is ubiquitous, and all notation programmes are capable of exporting it. There are, however, some diadvantages as well: MIDI files cannot represent the abstraction of voices when used for polyphonic instruments such as pianos, and they are distinctly limited when representing the instrumentation of large ensembles (limited number of channels).
    – user16935
    Nov 15 '15 at 19:05
  • The limit on channels is pretty big. There's a device pseudo event so 16 channels per device, no limit on #devices, so you can really have plenty of midi channels. Unfortunately the device pseudo event isn't very portable from sequencer to sequencer. voices could be done by track, but again, no standard for all sequencers. Nov 15 '15 at 19:33
  • That's more or less what I meant. When you do something like this, you are usually wisest to limit yourself to using the most portable parts of a standard. This particular aspect of the MIDI standard isn't particularly standardised. The MIDI standard is old; it really hasn't been updated in quite a long time, so a lot of solutions are really ad hoc.
    – user16935
    Nov 15 '15 at 21:15
  • portable or not, i wouldn't limit my app to 16 midi channels. or only one device. Nov 15 '15 at 21:30

Hard-to-formulate search, but they're out there - old Nokia composer code lists.



Check out Humdrum .kern, MusicXML, Guido, or melisma for text-based score formats.

http://kernscores.stanford.edu/ is a great library of over 100,000 music pieces in .kern, which can be converted to many other formats if you prefer.

http://www.musicxml.com/music-in-musicxml/ keeps track of libraries with MusicXML formatted music files.

There's also a paper I stumbled across, "Improving optical music recognition by combining outputs from multiple sources" by Victor Padilla et al, that might help.


The Mutopia project is a repository of music, and the lilypond files, which are text, are available. The lilypond source code itself may provide a useful start in parsing these files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.