W3C home > Mailing lists > Public > www-svg@w3.org > October 2010

Re: SVG and MIDI

From: Alex Danilo <alex@abbra.com>
Date: Fri, 29 Oct 2010 07:56:08 +1100
Message-Id: <K5Q0BL.30ONAN7WDXQ8@abbra.com>
To: James Ingram <j.ingram@netcologne.de>
Cc: www-svg@w3.org
Hi James,

--Original Message--:
>I have an application which currently reads/writes both music scores and 
>midi. The music notation I want to use is not quite standard, so I want 
>to start writing my scores in SVG.
>I need to include logical information about chord symbols, (such as 
>their temporal duration and midi pitches) so that these do not have to 
>be deduced from the (static 2D) graphics when I read and play the file.
>Having read a few articles on SVG, the obvious way to do this would be 
>to include the information in each chord's <desc> element using a 
>standard string format.
>My questions are:
>Is there already a recommended way to include such logical 
>(temporal/MIDI) information?

In the past people have used SVG for music authoring programs,
but I don't think there is any preferred way to do this.

>Is there a standard string format?

Not that I'm aware of.

>Should I be doing this some other way?


If you pack this all into a string, you end up with the pain
of having to parse the string out which is painful at best.

It might be a better idea to declare your own XML namespace
and declare the temporal and frequency information in your
own namespace which becomes part of the notes/chords. A lot
of authoring tools such as Inkscape, etc. use this approach
for custom markup.

For example:

<svg xmlns="http://www.w3.org/2000/svg"
   <g id="middle-c" mymusic:note="middle-c" mymusic:frequency="440">
     ... graphics in here, etc.
   <g id="major-c" mymusic:chord="root-third-fifth">
      <use xlink:href="middle-c" .../>
      <use xlink:href="middle-e" .../>
      <use xlink:href="middle-g" .../>
<g id="song" mymusic:duration="20">
   <use xlink:href="major-c" ...

This doesn't make a lot of sense musically of course, but
hopefully gives you an idea how to put this all into the
SVG file in a way that will be a lot easier for you to
reprocess and parse later.


>I have not yet written any SVG but otherwise have a lot of experience in 
>this area, so I know what I'm letting myself in for. :-)
>best wishes,
>James Ingram
Received on Thursday, 28 October 2010 20:56:53 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:29 UTC