Music Notation with HTML5 Canvas

I spent a few weekends trying to scratch an itch. While looking for online tools to create and render music notation, I was mildly disappointed. The only real options were crummy flash based sites or clumsy server-side image renderers. Neither of these were particularly appealing.

So I pulled up my sleeves, and cooked up a full-fledged JavaScript API to engrave musical notation directly in the browser with the HTML5 Canvas element.

Here's a demo: HTML5 Music Notation Demo

The library has no external dependencies, and all the glyphs, scores, beams, ties, etc. are positioned and rendered entirely in JavaScript.

One of the cool things about this is that I can now build interactive music sheets that respond to user events like score editors.

So here are all the features I have so far.

  1. Basic staff and chord support.

  1. Accidentals and beams.

  1. Support for all note values with correct rhythmic positioning.

  1. Support for rests, ties, and multiple voices. (Note the positioning of the notes.)

  1. Support for guitar tablature.

  1. Multiple voices in both staff and tab scores.

  1. Broken bars, odd-timings, custom glyphs, basic interactivity, and a full suite of unit tests (I love QUnit).

I have a fair bit of work to do before I can make it available. In particular, I want to build a simple language that allows users to easily create scores. Something along the lines of the following:

score {
  title: Hip Tune
  artist: Hip Person

  bar { v8 C4 D4 E4 F4 (C4 E4 G4) } 
  bar { v8 C4 D4 E4 F4 (C4 E4 G4) } repeat 3
}

The above is just an idea - I haven't really given it much thought. But the intent is to make the language easy to read and accessible to non-geeks. I'm open to suggestions related to what the language should look like.

Let me know what you think.

161 comments (imported from blogger)

jejansse
Nice!
I had the same idea once and started to build a tab-rendering website, but yours seems to be much nicer, so I am very curious about the resulting code.
Combining this with HTML5 Audio for playing the sheet in real time, combined with a designation seems to be the next logical step. I've looked into it, but it doesn't seem so straightforward as there is no MIDI-support.
Scott Turner
You need to look at ABC notation.
Mikkel
Very nice!
In ex. 2, shouldnt the e and the f (with double sharp) on the same beat be pointing in each direction? Like here:
http://imgur.com/QozO7.png
Anonymous
This looks very nice.
Is there a way to get print resolution higher? Currently in chrome, it looks pixelated when saving as PDF.
BTreeHugger
I love the idea, and applaud your effort! I'm just wondering if there was a practical reason to use Canvas instead of SVG?
Anonymous
Wow. This looks fantastic. I can't wait to see the finished product! Also, if you haven't heard of MusicXML (see http://www.recordare.com/xml.html) it is a pretty robust music notation format with many downloadable scores already in xml format to play with :)
Great work!
Anonymous
I love you! Thank you so much!
Anonymous
check out lilypond http://lilypond.org/doc/v2.12/examples
Anonymous
Nice, could it also be made to use SVG?
Anonymous
No need to develop a new notation, just implement ABC notation as it's widely in use and well-documented. Then your library would get some SERIOUS use.
Elliot
@Mikkel -- There are multiple voices, top voice always points up
0xfe
Thanks for the comments everyone!
@Mikkel, yes that's a bug... i'll fix that.
@Anonymous(1) ... you can scale this to any size and have beautiful looking scores, since all the drawing is vector-based (lines and curves).
@BTreeHugger ... no SVG because Canvas has broader browser support... it's more about practicality... (besides, do you think I _like_ coding in Javascript? :-)
@Scott (and others who suggested it)... ABC notation looks like a nice simple language... I'll dig into it some more... (if only it supported tablature...)
0xfe
@Elliot, I think he's talking about the direction of the note heads (and not the stems).
Anonymous
http://lilypond.org/
John Haugeland
If this were in SVG, rather than Canvas, then you could use tools like PrinceXML to print the results.
Ethan
Very cool. I love music programs, and this should be great for the composers out there.
Kae Verens
@0xfe - oh wow, that is so cool! As someone who started implementing something similar (
as you've seen
), it brilliant to see someone else doing it.
I haven't dug through the code yet to see exactly how you broke down the various problems (defining lengths of bars, making sure bars on related staffs (tab and score in your example) are positioned right, etc.), but I look forward to reading the source as soon as I have a moment free.
Personally, I went the "wrong" way about, basically just drawing immediately to the screen, where I should really have just measured first, and drawn at the end.
As others have commented, the Lilypond site is a great resource.
This essay
was really interesting when I was working on it myself. You've gone well beyond what I did, though, so have probably already seen it.
roycifer
the demo has no doctype so its technically not html5. the demo is also using the "center" tag which is not supported in html5.
Anonymous
A friend just pointed me at this; a totally excellent idea, well started. Maybe your target should be MuseScore?
Also, ABC and lilypond etc exist, but that doesn't necessarily mean they provide the best language in which to write stuff. As soon as you start writing { } in javascript, why not use JSON and maybe a converter to/from the other formats as required?
Anonymous
@roycifer Way to focus on the big picture
Me Again
I'm not a musician, but the end result looks beautiful. Well done!
Anonymous
Keep up the good work!!! :-))
Anonymous
I'm curious as to how you designed the notes (they look beautiful by the way). Did you draw them in something and export them as vectors, or was it a trial-and-error sort of thing where you would write something, render it and see how much it looked like your goal?
klkl
Please don't use canvas - it's not accessible at all. Use SVG instead. Browser support is the same, it's not more difficult, and you'll be able to make result accessible, scalable and editable.
Unknown
My word, some people are missing the point! This is great stuff, count me in as a user and future contibuter!
I second the ABC notation idea also.
Any plans for lyrics/chord notation?
Also release early and often - share the code and we'll help! I actually like javascript :)
Anonymous
Language suggestion.
http://jashkenas.github.com/coffee-script/
Proctor
I've toyed around with the idea of creating a "Guitar Hero"-like tablature scroller for reading music. If the rendering of this music could be controlled so that you could turn pages in time, or scroll horizontally at a set BPM that would be amazing.
Tom Ritchford
Very, very nice!
Suggestion to you - your proposed language is so close to JSON - why not just make it JSON and then you can, e.g., just paste it into your Javascript programs?
(Oh, I see someone else has suggested it.... well, do consider it, because JSON is the natural Javascript interchange language...)
Do you have a mailing list for this project?
Anonymous
This looks fantastic!
IRT comments mentioning ABC, MusicXML, lilypond and etc: I think it's useful to keep (and expose) an intermediate representation. You already have an internal representation in Javascript land. You would gain a lot by exposing this interface as JSON.
The rendering engine is really the killer app here. Tying it down to a specific notation, framework, etc is limiting.
I think the best way to approach this would be to open source the rendering engine and the JSON notation format; provide a reference implementation using (say) jQuery and ABC; and let the open-source community develop against their preferred notation, javascript framework, etc.
I think this would provide maximal reusability and benefit to the community.
I would love to work with you on this. This is an itch I've been meaning to scratch for a LONG time. Maybe we can get some hot Github action going? Working on an ABC parser and jQuery wrapper for your rendering engine would be a lot of fun and immediately useful as well.
Cheers!
Rein Henrichs
Ugh. Previous comment was mine.
Zed
This is very good. You should check out both LilyPond and ABC for possible notational inspirations.
Ivan Savov
Hi,
You should check out what notation they use for music
in LaTeX:
http://icking-music-archive.org/software/indexmt6.html
Brian Cardarella
This is amazing work. The result is beautiful and crisp. Please follow this through until completion!
Jeremy J Starcher
We are involved in a similar project... My demo page is out of data, but an earlier demo can be found at:
http://r3jjs.com/js/hdots/
Or you can go to http://code.google.com/p/highlanddots/ and see our latest developmental code.
Anonymous
The Tab support is killer, really nice. I would only suggest that it would be really really good if the tab notes blanked out (either opaquely or transparently) the line behind them, for readability.
Unknown
Hey,
Looks really neat. We're hacking on HTML5 audio, and together could probably get this playing as well as displaying. Check out our work here http://vocamus.net/dave/?p=1074
Dave
Thomas
For notation, you might consider digging up the Commodore 128 or PCjr notation language.
http://www.commodore.ca/manuals/128_system_guide/sect-07b.htm#7.3.2.3
The PLAY statement for the Commodore 128 might help you round out the notation language some.
Ben Levy
This is a great start. I had a similar idea and knew I that HTML5 was going to have a solution.
Marcos
Thomas: the BASIC 7.0 PLAY statement was cool, but it has a number of limitations that mean it won't work for a lot of real-world music. Some note durations just can't be represented - no triplets, no 32nd notes, no sustained note longer than a dotted whole note. In practice you could use tempo-changing tricks to achieve the desired sound, but as a musical notation it's wanting.
I agree that a JSON-based API is the way to go, with maybe predefined converters for a common standard like ABC; let folks write their own converters for MusicML or whatever.
jake tburgh
Doesnt work on Firefox in mac.
EmptySet
Just throwing another idea out there… it would be nice to make this at least somewhat MIDI compatible. For example, while a human readable form for the notes is nice (e.g. C4, D5, etc…), it would also be pretty handy to be able to enter the MIDI note number instead (or in addition to the human readable form).
Great work so far!
Damian Edwards
Awesome stuff, always love to see ideas like this become reality.
I'd like to second (third?) the notion of changing your implementation to use SVG/VML instead of Canvas. As others have said, Canvas is inaccessible, is raster based (not vector) and JavaScript accessible only. You can use the Raphaël JavaScript library (http://raphaeljs.com) to render the SVG and it will auto-render it in VML for IE6/7/8 (IE9 will support SVG natively).
SVG & VML actually create nodes in the DOM, just like HTML, which you can then attach to and manipulate with libraries like jQuery for endless flexibility. Also makes them visible to screen readers & search engines (assuming you save the generated content to a static resource that can be indexed of course).
Anonymous
Bangarang! I'd totally buy that off you, publish it.
Michael
This is great!
I don't see a need to invent a new input format. Use MusicXML for greatest accessibility to the largest number of programs - more than 80 programs can write it out, including Finale, Sibelius, and MuseScore.
If you want easy-to-type input, you can use ABC, but that can be tricky to parse - due both to the nature of the language and to its multiple dialects in common use. You might want to rely on the existing ABC to MusicXML converters instead, and just write one parser.
It's an interesting suggestion above to serialize your internal format, but that doesn't seem to get you a lot of benefit for the time spent. If you read in a standard format, nobody else will have to write a new converter to use this.
Keep up the excellent work!
Anonymous
There's a JS error with Opera (10.53).
Anonymous
Oh this is AWESOME .. I love it!! Go HTML5
cromas
SO AWESOME. Keep up the good work!
Anonymous
This is really one of the coolest usages of the HTML5 canvas API. Just some remarks from me to how your idea could spread:
* You should put the code on GitHub, SourceForge or Google code. The earlier the better.
* Then, as suggested by others, look at Lilypond. That is, for three reasons: a) they have a nice input format, powerful but easy IMHO, (looking quite similar to your initial idea) and b) they feature SVG export, which is interesting, too, when making music for the web. And c) they have an awful rendering engine producing beautiful sheets.
* Talk to the Lilypond team, search for synergy effects and helpers for your code (Open Sourcing, as suggested, helps, too).
Anonymous
This sounds like very good project. Keep up the effort!
Having never properly learned notes myself, but occasionally struggling with them, I love the idea of being able to display notes as Guitar tabs. Please consider adding Ukulele-support :)
David Luebbert
Beautiful notation, Mohit!
I had a need to have a simple music notation that could be quickly typed from a printed score into a web form and then packaged and transmitted within a URL to a music editing service.
Musical objects notated using the small language I developed I call Tunetexts.
Harmony examples can be notated especially quickly using this Tunetext language because notation for chord sequences can be generated by specifying only the chord root and type of chords and duration changes within a chord progression.
A Tunetext server can generate voicings for chords if you don't care to specify them yourself.
If you are doing an example in 4/4 meter, the default duration assumed when a specification starts is assumed to be whole note, so a sequence of whole note chords need only be listed to be performed.
It took about thirty seconds to produce this harmony example, by typing the chord names, specifying the changes of duration that occur and submitting the tunetext URL to the server:
Chords in the key of C Major
The Tunetext Service that will respond to this will return the notation for the score and prepare a MIDI performance of it in a second or two, and present it in a form that provides links that will generate the HTML necessary to present this music on a website in a number of useful ways.
Here is that tunetext URL packaged into a
clickable button
.
Here is a
score animation
generated from the tunetext specification a few seconds after it was submitted to a Score Animation Service that runs on the SongTrellis site.
When it's necessary, the pitches used in a particular chord voicing can be
completely specified
.
Here's a score consisting of
a melody voice and a chord accompaniment
.
Anonymous
Very nice! The accidentals should be bigger.
Bob Foster
I don't know a damn thing about music but your stuff looks beautiful. Please forge on!
Steven Gravell
Very awesome. Like many commenting here I had previously made a start at the same thing, but now I'm not going to bother. Looking forward to being able to develop alongside this
Anonymous
Great job with this!
I second (or third, or fourth...) the votes for
ABC
compatibility; many of us have libraries of music we've created with ABC markup!
Thanks for sharing!!
John
0xfe
Thanks for all the suggestions, folks. I've answered most of your questions here:
A Question of Formats
.
Anonymous
Consider the MVC software architecture. You can support two views: canvas and SVG. You can support multiple models: JSON, ABC, whatever.
Evan
Wow, I've worked on doing almost exactly this same thing. I just haven't gotten very far on it due to lack of time. I guess it's one less thing to worry about since you're clearly much further along. :)
ABC notation is nice, although it's true that it doesn't directly support tab. You can always derive tab from standard notation, of course, but the generated fingerings might not be possible or accurate without some work. In particular, I've found the ABCPlus document detailed and easy to read.
Simon Guo
HTML 5 is powerful!!
Unknown
Very nice!
Noticed a bug: On iPad, the tab notation is being drawn in the wrong spot. Take a look at
http://imgur.com/AxmbM.png
for a screenshot. If i reload the demo page, the tab notation is drawn correctly, it's only wrong on the first load.
Anonymous
The amount of systems and websites that could arise from this library are endless.
Great job!
Derek WIlliams
Regarding printing and by possible extension svg, this may help:
http://code.google.com/p/canvas-svg/
Michael Biven
Amazing - it is like LaTeX for the web. any plans on adding support for different clefs?
Michael
Michael
Congratulations on creating this beautiful demo, this is going to be very useful to many people.
I would like to put an other vote in for the use of MusicXML — as others have stated, it's a widely supported format. There are many applications which can import MIDI, ABC Music, MusiXTeX, LilyPond, ect files and export that into MusicXML... it would be extremely useful to have this done on the server-side (I'm not sure whether there are packages that would be easy to setup already available). Canorus seems to have good libraries: http://freshmeat.net/projects/canorus
Best of luck on this project. Don't let it overwhelm you! I've worked on a JavaMIDI and JavascriptMIDI plugin, let me know whether you would like to plug one of those in (to generate music in real-time).
Anonymous
I'd suggest you use a neutral musical notation like humdrum:
http://www.musiccog.ohio-state.edu/Humdrum/
that you can easily use to convert to and from other formats.
The notation looks great. Good work!
Jonas B.
There are already a bazillion music notation formats -- please use an established one! ABC is a very good candidate of course. And if there are something lacking from the notation please help improve it instead of creating your own. Converting between notation formats is a very big headache and can be impossible to do exactly.
Rémy
Here's a similar project :
www.tabnet.fr
Onur
Very cool. I love music programs, and this should be great for the composers out there.
Anonymous
Too bad that in the oh-so-futuristic usage of this you use the center tag :)
Octafish
I like the guitar tab---except I don't think I can stretch far enough to play on the 2nd and 12th frets at the same time!
Mike
@Octafish you could use a capo on 2nd and finger bar on 12
No need for MIDI, go for OGG/MP3 samples (just a thought), which are supported by HTML5.
Fantastic idea, by the way!
Best of luck with making it fully functional!
Alex
What a fantastic idea! I like that a lot. And writing a nice API for people to hook into would be awesome, and could revolutionise the way we look at musical notation on the web!
Matt
That's really great.
Looking forward to the final version!
estemon
Very interesting, we're looking for the final version! :D
Acrylic
This is something that would help me out a lot. I'll keep checking back for updates.
Hugh Lashbrooke
Love this idea and this is definitely one of the most elegant implementations of this kind of thing that I've ever seen. Also a great use of new tech - seriously looking forward to the first shippable version.
Andi
This must be SVG. Imagine editing capabilities with drag and drop or clicking on a note. Most importantly, it's vector and not pixels.
Anonymous
It's sad, I would like to copy the music with copy and paste. :(
Anonymous
Well, not just copy but also listen it with a kind of MIDI player!
dionyziz
Would love to see an open source version of the engine. BSD, MIT, or LGPL would also allow it to be used commercially. I would imagine there are great business opportunities in the territory of web-based score editing -- with collaboration capabilities.
Anonymous
In example 2 the fifth semiquaver f needs a natural or the last semiquaver f needs its sharp suppressed or the fifth semiquaver f needs a sharp or the last semiquaver f needs its sharp in brackets (#)
This gets still more complicated when voice 2 accidentals "collide" with voice 1 accidentals.
Have you looked at basing this on lilypond scores?
Tim.
Anonymous
Very cool, good use of a new technology and very useful, I like it, keep up the good work
Anonymous
Another vote for MusicXML parsing... This is used but most (if not all) of the main scoring software.
Anonymous
My hat is off to you brother!!! Keep up the good work.
Anonymous
as previously stated, it's not working in opera :(
might of course be opera's fault though...
Unknown
Echoing what someone else said, you should look at ABC notation. It is similar to your example.
Anonymous
Check out www.jfugue.org
Matthew Dee
This is fantastic, I love seeing technology being put to uses like this :-)
Loyal V
I had been kicking around a way to do this with CSS, but damned if you didn't nail it with this method! Here's hoping this sees wide adoption.
Anonymous
Great idea, I love the human readable entry, as someone who loves to generate music internal stuff with scripts. I never did appreciate having to work around bugs by hacking .mscx files. Hope to use this!
ea
Brilliant!
This is an idea that I had when I first saw www.noteflight.com.
Interested in making this into an open source collaborative effort?
Anonymous
HTML 5 FTW!!!
This is excellent work .. keep it up.
Anonymous
While automatically generating the spacing for a bar is nice, it can result in music that is still difficult to read. It is necessary to allow everything to be shifted around the canvas, to adjust how slurs curve, etc. It can make a huge difference in readability as well as how the music itself is played.
I'm sure this will all come in time. This is a fantastic start and I am very impressed!
Several others have mentioned MIDI. Probably not possible with just JavaScript, but it should be relatively easy to toss all the data to a back end somewhere that would convert it, no?
Anonymous
This is cool, but I don't know if it's the example or the api rendering, but point 5 and 6 on the guitar tab arn't really playable.
Fret 2 to 12 or 5 to 23 isn't really feasable.
rdentato
This is really great! I would reinforce the suggestion on ABC (I'm part of the ABC community :)). I'm also working on an extension of the "musicpad notation" that is much simpler to parse than ABC I'd love to integrate it with what you've done here!
Remo.D.
- Stas ^_^
I don't see if anyone suggested this yet, but you don't really need to implement tablature: there is a typical fingering notation used for classical guitar which is more effective and is compatible with most notation software (since it just involves extra markings for general hand position based on index-finger-fret, and what fingers are used for what note).
Christopher Joel
Great work! I'd love to see a version of something like for the Nashville # system.
Anonymous
You've been recently posted on Slashdot. Expect your blog to be hammered with traffic shortly ;)
Anonymous
This is really cool! Looking forward to see a interactive html5 based music score app that allows collaboration, editing and sharing. It would be nice if we have a library of all music scores, and a search engine upon that would be greatly useful. Then people may also do things like get similar music scores etc...
Zajaro
Man!!! I'm very profficient in lilypond ( just the typing not the developing and I know some javascript,... if I can help I'd be glad ) I've been looking for something like this for years,... currently my m.o. is to compose in lilypond export the pdf and the midi and feed the midi to timidity or csound depending on the situation,... so well anyway anything I can do just let me know
Tails
+1 for MusicXML and the often release cycle!
Grant Thomas
Great! IMHO MusicXML is awfully verbose, but perhaps ABC notation is a way to go. However, JSON is very easy to consume -- maybe some server side tools that can 'compile' ABC or MusicXML to your JSON format.
Any plans as far as playback? Persisting scores on your server? more?
Anonymous
Music XML is great and SEO friendly. Being able to search (google) for music and see it is a good idea.
jmucchiello
Do you have the natural symbol? In example 6 third group of notes, the bass note should have a natural symbol in front of it based on the change in the tab. (Also the tab for the bass line should be 3, 4, 5 not 4, 5, 6 unless you always tune your guitar down a semi-tone normally.)
Dan
Wow! This is awesome!
Anonymous
Wow!
I'm totally impressed!
Keep up the great work!
L
Cranky Old Dude
Is there anyway you can proportionately make the accidentals significantly larger? If you are playing an instrument where you can't close to the page, for example double bass, percussion or tuba, it is an issue. In example four, the ties on the lower voice should curl down (above the beams, but curled down) Ties in the upper voice would curve up. In a two voice texture, slurs, as opposed to ties, will be on the outside of the stems. Also, and this is just a personal taste thing, the stems on the 32nd notes should be longer unless they interfere with other notation.
You might want to look at a book like Gardner Read's or Curt Stone's.
Jason
This looks like a great idea, looking forward to seeing progress on this project!
haupz
For designing the music notation language, you might want to take a look at OMeta: http://tinlizzie.org/ometa/
Anonymous
The demo images at http://0xfe.muthanna.com/jsnotation/demo.html are really quite stunning. Nice work!
Anonymous
Cool idea, great work. You prove that combining two well known concepts can generate something new
Ben
nice. Some years back, I wrote a Perl-based form-to-midi converter which took input in the format of note-[modifier-]-octave (i.e. "c#4 d4 e-4" for c#, d natural and e-flat, all in the fourth octave) and made a string of notes out of it. No timing included. But combined with this and maybe a drag and drop interface, I could rule the world!
Anonymous
Excellent - maybe take a look at using Lilypond (http://lilypond.org/) as the base for a musical source code (or support a Lilypond subset itself). Also, how about other stringed instruments (from a Ukulele player)?
cmholm
The demo scores rendered cleanly in my copy of FF 3.6.3 (Win server 2003), but the html code seemed to claim otherwise:
[h2]Test 1[/h2]
[canvas id="notation" width="800" height="400"
style="background: #eed; padding: 10px; border: 10px solid #ddc"]
HTML5 Canvas not supported on this browser.
[/canvas]
Adam Daughterson
This is great! I will be watching closely for a release...
Alan W Szlosek Jr
Amazing. I'm drooling! Anxious to see which license you chose for the code, and whether I'll soon be able to contribute via github.
Really want to use it to replace lilypond (currently use it with my homegrown marching percussion composition tools). Seems like I'll actually be able to understand your projects code, and thus, contribute!
Kopachris
Perhaps you might be able to combine your JS API with some PHP to create an in-browser score editor with support for exporting LilyPond files. It would be much appreciated.
Anonymous
would really like to see a connection to a way to play that score ..
Anonymous
nah
Anonymous
You might want to look at SVG web (http://code.google.com/p/svgweb/). They're quite stable, we're using them in production.
I've implemented some pretty complex charts for Canvas, but since I've learned about SVG web, I've done everything with SVG, that's the way to go!
Anonymous
this is great, keep the good work. i might utilize this on a site. it's important for it to work with the MusicXML standard.
JR in WV
Hi,
Great job! Very interesting to anyone with any music background at all.
Are you considering using a music keyboard for I/O instead of programming notation input to result in a score?
I've always wanted to be able to plug a keyboard into a computer and see the music score appear from what I improvise.
JR
Tom
I think it's fantastic.
Adrian
0xfe, where does one learn how to draw like that?! Bet that treble clef was a mission! Beautiful js code.
Damien
This is great! Hope this grows.
yuki
this is nice
Stefan
You might want to have a look on a SVG renderer tool we developed within the DIMUSED project:
http://www.dimused.uni-tuebingen.de/hildegard/?isForm=1&FILE=1&source=D&VARIANT=1&L=1
This is a rather special case of rendering medieval music with neumes, but uses the open format of the Music Encoding Initiative (MEI) as its data base and shows some of the potentials of SVG's interactivity for rendering variant readings in other sources by mouse over.
Stefan
Anonymous
Serendipity --- on another list about a cross browser SVG library (named Raphael) someone just posted about
Abcjs, which is an open source parsing and rendering tool for ABC written
entirely in javascript and allows sheet music to be rendered as both
standard notation and MIDI entirely with the browser. There is a working Demo (with sound) here...
http://drawthedots.com/
Crunchysteve
So hurry up and make it a product already :-)
Herman Fuchs
Take a look on the tracker notation used in Amiga music trackers and nowadays still found in Renoise (www.renoise.com) and MadTracker:
Cmin chord: C-4 D#-4 G-4 (where "4" is the octave)
Tempo 4/2 beat:
C-4 D#-4 G-4
. . .
D-4 F-4
. .
C-4 D#-4 G-4
. . .
D-4 F-4
(and so on)
Basically you just need to read it like a spreadsheet, playing one line after another. For faster notes, just add some "off" sign in order to know when the note needs to be stopped:
C-4 C-5
. .
. .
off off
.
D-4 F-4
. .
. .
. off
. .
off .
And so on.
Herman Fuchs
More on tracker based notation:
http://youtu.be/9gwwwRBDuYE
Vincent
+1 for MusicXML. You can use it as an intermedia language, if you prefer to write it in another style. Also somebody can easily write an editor, using your code.
You did a great job!
Guido Gonzato
Let me suggest that you have a look at ABC Plus, http://abcplus.sourceforge.net/.
It's a de facto standard extension to the ABC notation language; the abcm2ps typesetter (http://moinejf.free.fr/) also supports tablatures. I'll be glad to give you support if you decide to implement it.
Regards, Guido
Bob Smith
+another for music XML as allot of people who use any type of standard notation software like Sibelius but want to render without any plugins can export music XML straight from the app.
Looks great though keep up the GREAT WORK!
David
Great stuff!
A lot of people are mentioning ABC, MusicXML, and LilyPond. You might also want to look at the notation that JFugue uses.
JFugue is a Java-based API for creating music. Its notation was inspired by the Commodore 128's BASIC v7.0. Intended to be easy to learn and use, JFugue focuses on the creation of music as opposed to specific notational elements, but it does closely resemble what you proposed in your sample score script.
David
This comment has been removed by the author.
75th Trombone
Please for the love of God make the code look like anything EXCEPT MusicXML. MusicXML is an abomination. It's a relic of those ignorant, heady days when XML was The Future Of Everything.
Music notation could not be any less suited to XML. Whatever you do, please steer clear of it.
29a
This is awesome! I tried to do something like this for a project some time ago and lost interest. I'll have to check this out.
As for musicxml being horrible, I completely agree. But it *is* a more or less established standard. So I think supporting it would be a good idea.
29a
One more thing, would you mind putting it on github or something similar. That would make hacking a lot easier. ;)
Tails
@75th Trombone
Why do you think about MusicXML this way? In what view is it an abomination?
tardate
This is fantastic Mohit, good luck taking it forward (and I second all the suggestions you should open this up as a project on github or similar).
jTab (http://jtab.tardate.com) is a project I launched last year in a similar vein - although I was particularly focused on guitar tab (and solving the fingering problems that @Octafish mentioned).
At the time, I chose SVG rendering (with Raphael) but have been thinking about a canvas option or port (Raphael/SVG works pretty much everywhere except Google's Android webkit variant!)
Bobby Soares
That's very cool. You know, if you decide to make this library available, i could help you turn it into a Google Docs web based editor. See the following projects:
http://code.google.com/p/gdbe
http://code.google.com/p/latex-lab/
Anonymous
Keep up the good work Mohit.
thSoft
Miraculous effort! It would be even better if it would be SVG instead of Canvas. I strongly recommend considering switching to it.
Bass
The link above is a dead link. I'll get an error 404. Can you fix it? Thanks.
Steven Coco
Link's dead. Have used NoteFlight on desktop. Curious for something that will work enough on Android to notate ideas on the fly -- at least to jot down phrazes when I need to not lose an idea ...
Tails
@StrictVegan try Tabdroid, based on TuxGuitar
JoeCodeswell
Hi Mohit,
I just tried to look at your demo and got a 404 message. Are you still working on this? What about making this an open source project?
All the best,
-Joe
JoeCodeswell
Hi again, Mohit and others,
I am guessing you have replaced this effort with your open source "VexFlow" project [http://vexflow.com/]. Am I right?
If so you might want to point to that from this posting.
All the best,
Joe
Anonymous
I've played with jfugue and you can drive it from javascript through a java applet ..<60 lines of code!. You can push MusicXML into it, or its own notation.
Anonymous
I couldn't link to the demo for some reason.
Am thinking about writing conversion to (eventually from) another music notation system in a text format (supports playback & midi export), but haven't written a parsing program in over 17 years.
WBP
Anonymous
any change of choosing number of string .. as in 4 lines for mandolin?
Rusi Mody
Is it possible to play music made with vexflow?
For example here is something I made with nted
http://vimeo.com/16894001
Note nted is both the editor and the player for it.
It would be great if this could be done entirely in the browser
Read Music Tutor
A very nice implementation of Music Notes in javascript. I hope to hear more from the developers of this project!
I'd like to implement on my music blog here: http://readmusic.org
Many thanks
Anonymous
I have a converter from abc to NoteWorthy Composer in this link. Near the bottom of the page are links to a viewer and a desktop tool to first convert the page's output, then display and play it.
http://home.comcast.net/~wporter211/realsite/abcnwc.htm
Anonymous
argh, u did it. but the demo link seems broken
Jason Haury
here's another MusicXML vote. though verbose, it preserves both how the music should look on paper AND how the music should sound when computer generated (a la MIDI). If your aim is to just display notation, then maybe ABC is better, especially if the user is just dragging notes from a web interface. But it seems like there'd be a lot of value in taking music from a desktop app (Sibelius, Finale, etc) and displaying it as sheet music online without plugins. your plugin would fill this function best with MusicXML due to widescale support.
Anonymous
There is currently no governing standard for the use of JSON as a music exchange format. The only safe way is to convert from existing MusicXML (for which there IS both a "standard" and very widespread tool support) to JSON. Anything else would at the moment be a disservice to the music community.
ABC is -except as widely used by folk musicians (and in which it excels) for recalling a tune's melody line- next to useless as an exchange format.
bewest
I love the lilypond-like syntax for describing scores.
Would it be reasonable to re-work http://git.savannah.gnu.org/gitweb/?p=lilypond.git;a=blob;f=lily/lexer.ll;h=2ef59f43f5243618951de8eb6d4c0ea90b23b03f;hb=HEAD using jison or some other JS/CC or something?
Perhaps such an approach would enable a convert-ly to automatically update existing scores?
An important attribute for a such a language is "scribbability," or the ease in setting up a minimal working file. XML fails on scribbability, although it would be fantastic to see something similar to the way the semantic working group developed N3, a scribbable notation for RDF XML.
Anonymous
Just thought it's worth noting the link to the demo is broken, and it took some detective work for me to link this excellent work to the result - Vexflow. Wonder if you could update the post to point to Vexflow explicitly.
I'll probably be using this as part of a product (open source hardware) designed to teach people piano.
Cefn
http://cefn.com
Emy Watson
How can I make the other side of this html5 canvas diamond?
html canvas
Roger Pack
unfortunately applets are not supported anymore :)