Loading ...
Sorry, an error occurred while loading the content.

SVG and MIDI

Expand Messages
  • j.ingram48
    This thread started at W3C [1], but both Helder and David have recommended that I move it here, so that s what I m doing. The thread so far is quoted below.
    Message 1 of 4 , Nov 2, 2010
    View Source
    • 0 Attachment
      This thread started at W3C [1], but both Helder and David have recommended that I move it here, so that's what I'm doing. The thread so far is quoted below.

      Helder wrote:
      > You mean "Inkscape" [1]? ;-)
      Oops, yes.

      > Yeah, I guess taking the "develop an Inkscape plug-in" approach is
      > probably wise for this case. I've seen a few software packages based
      > on this approach, mostly just to embed metadata which is used for
      > behavior during run-time.
      That sounds familiar. The extensions I have in mind are for use in an application which runs in real, performed time (a real player using Assistant Performer software).

      I was thinking of defining the following types:
      mus:type="system"
      mus:type="staff"
      mus:type="chord"
      mus:type="rest"
      mus:type="barline"
      etc.
      And
      mus:msPos (int)
      mus:staffName (string)
      mus:midiChannel (int)
      mus:midiPitches (list of ints)

      The system mus:msPos would be the default number of milliseconds from the beginning of the performance.
      The chord and rest mus:msPos would be the default number of milliseconds from the beginning of the system.

      I dont need a default duration (mus:msDuration) anywhere, because that value can easily be deduced from the sequences of mus:msPos if needed. Chord durations are, however, very often shorter in real time than their defaults would be (think Mozart staccato), so I think they would be unnecessary ballast and a potential source of errors...

      For example:

      <svg ... xmlns:mus="http://www.james-ingram-act-two/Moritz/scoreTypes" ... >
      <!-- there will be a sequence of systems in the page -->
      <g mus:type="system" mus:msPos="0">
      <!-- a sequence of staffs in the system -->
      <g mus:type="staff" mus:staffName="Flute" mus:midiChannel="0" >

      <!-- a sequence of clefs, barlines, rests, chords etc -->

      <g mus:type="rest" mus:msPos="0" >
      <!-- the rest text character -->
      <g mus:type="drawObjects">
      <!-- objects associated with the rest -->
      </g>
      </g> <!-- end of rest -->

      <g mus:type="barline">
      <!-- the barline line -->
      <g mus:type="drawObjects">
      <!-- objects associated with the barline -->
      </g>
      </g> <!-- end of barline -->

      <g mus:type="chord" mus:msPos="1348" mus:midiPitches="64 67 83 90">
      <!-- graphics for the chord symbol -->
      <g mus:type="drawObjects">
      <!-- control texts and other objects associated with the chord -->
      <!-- The control texts can be parsed for things like dynamics
      or patch changes ->
      </g>
      </g> <!-- end of chord -->

      <!-- etc. more chords, rests, barlines etc. -->

      </g> <!-- end of staff -->
      <!-- more staves -->
      </g> <!-- end of system -->
      <!-- more systems -->
      </svg>

      This has the interesting side effect that there does not have to be a rest or chord at the start of every staff. That's very useful, because notations should not have to insist on having tied notes where durations cross systems. We are not restricted to standard notation. :-) There probably has to be a special type mus:tiedChord for chord symbols which are continuations...

      David has now mentioned SMIL, so I've been reading a bit about that (for the first time). Maybe because I'm new to it, it seems less intuitive than the above scheme, and more verbose. It would be nice to reuse an existing standard if possible, but only if it is the right standard! :-) Does it have any advantages over the above scheme?

      Helder said:
      > I guess you might also find interesting (to mix/analyze/reuse) to know
      > about Audacity [2], which has some (apparently quite limited) support
      > for MIDI and whose license seems to be compatible with Inkscape's.
      Again, I'm not interested in the sounds themselves. My Assistant Performer outputs MIDI signals. What happens to the output after that is outside its control. There are lots of programs/synthesizers out there which are concerned with timbre-creation, and can provide interpretations of incoming MIDI data. For me, perhaps the most interesting is Max/MSP [1].

      David said:
      > It would be sort of like having SVG but for sound and it would allow the construction of complex
      > sounds.
      Constructing complex sounds is done at a level lower than chord symbols. I'm talking about written music, which is all about things like musical form. Levels higher than the chord level. SVG is of course the right language for describing scores.
      > Maybe there already is something like that but I doubt that it has
      > browser support to let me make music yet.
      Coming soon! :-) Browsers can display SVG scores and react to user input... I'm interested in live music making...

      > And I somehow doubt that if there
      > is, that they're integrating that closely with SMIL and SVG.
      ? I doubt it too. SMIL looks to me too complicated for my purposes, but I may be wrong...
      > Here's some fiddling I did with random music composition using audio clips
      > several years ago:
      > http://srufaculty.sru.edu/david.dailey/javascript/sound/sound3.html (working
      > in at least IE, FF, .
      Unfortunately your examples use Quicktime, which does not run on my system (Windows Vista 64bit Ultimate).

      all the best,
      James

      [1] http://lists.w3.org/Archives/Public/www-svg/2010Oct/0160.html
      [2] http://en.wikipedia.org/wiki/Max/MSP

      ==========================================================================

      This thread started as follows (in chronological order)

      > From: James Ingram <j.ingram@...>
      > Date: Wed, 27 Oct 2010 00:21:04 +0200
      > Message-ID: <4CC75450.2050305@...>
      > To: www-svg@...
      > Hi,
      >
      > 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?
      > Is there a standard string format?
      > Should I be doing this some other way?
      >
      > 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
      > --
      > www.james-ingram-act-two.de

      > From: Alex Danilo <alex@...>
      > Date: Fri, 29 Oct 2010 07:56:08 +1100
      > Message-Id: <K5Q0BL.30ONAN7WDXQ8@...>
      > To: James Ingram <j.ingram@...>
      > Cc: www-svg@...
      > Hi James,
      >
      > --Original Message--:
      > >Hi,
      > >
      > >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?
      >
      > Yes.
      >
      > 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"
      > xmlns:xlink="http://www.w3.org/1999/xlink"
      > xmlns:mymusic="http://james.music.notation">
      > <defs>
      > <g id="middle-c" mymusic:note="middle-c" mymusic:frequency="440">
      > ... graphics in here, etc.
      > <g>
      > <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>
      > ...
      > </defs>
      > <g id="song" mymusic:duration="20">
      > <use xlink:href="major-c" ...
      > </g>
      >
      > 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.
      >
      > Alex
      >
      > >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
      > >--
      > >www.james-ingram-act-two.de
      --------------------------------------------------------------------------
      > From: James Ingram <j.ingram@...>
      > Date: Fri, 29 Oct 2010 10:20:39 +0200
      > Message-ID: <4CCA83D7.7000606@...>
      > To: www-svg@...
      > Hi Alex,
      >
      > That was very helpful, thanks!
      >
      > I'm now reading all about defining namespaces. :-)
      >
      > James
      > --
      > www.james-ingram-act-two.de
      --------------------------------------------------------------------------
      > From: Helder Magalhães <helder.magalhaes@...>
      > Date: Sat, 30 Oct 2010 09:09:46 +0100
      > Message-ID: <AANLkTinYdyeNS+nTctPef194fvwt-aYFHJ3uqT8gO+Eq@...>
      > To: James Ingram <j.ingram@...>
      > Cc: www-svg@...
      > Hi James,
      >
      >
      > > 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.
      > >
      > > My questions are:
      > > Is there already a recommended way to include such logical (temporal/MIDI)
      > > information?
      >
      > I guess Alex already pointed out a good possible solution. I'd only
      > add to this the declarative animation support [1] already in SVG
      > (using SMIL), which adds the "temporal" information you might be
      > seeking about. :-)
      >
      >
      > > Should I be doing this some other way?
      >
      > (Apart from the above,) You could also try using scripting (for
      > example using ECMAScript - a.k.a. JavaScript - or other languages).
      > You'll *definitely* want to take a look at a tightly related SVG Wow!
      > demo [2]! ;-)
      >
      >
      > > 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. :-)
      >
      > I'm assuming that "this area" relates to graphics and stuff and I'm
      > always glad to hear when someone with expertize joins the community.
      > Welcome and good luck! ;-)
      >
      >
      > > best wishes,
      > > James Ingram
      >
      > Hope this helps,
      > Helder
      >
      >
      > [1] http://www.w3.org/TR/SVG11/animate.html
      > [2] http://svg-wow.org/blog/2009/10/04/animated-lyrics/
      --------------------------------------------------------------------------
      > From: James Ingram <j.ingram@...>
      > Date: Sat, 30 Oct 2010 13:20:01 +0200
      > Message-ID: <4CCBFF61.4000102@...>
      > To: www-svg@...
      > CC: helder.magalhaes@...
      > Hi Helder,
      > Thanks for keeping this thread alive.
      >
      > I'm an expert in music notation with a background in writing music scores.
      > Briefly: I was Karlheinz Stockhausen's copyist 1974-2000. Wrote his
      > published scores in pen and ink until 1992, thereafter using a
      > combination of Finale and Freehand. In the 1990s I wrote a group of
      > plug-ins [1] for Freehand to help me create the complex scores I was
      > being asked to create. I will be referring to their code when creating
      > my SVG graphics.
      >
      > Thanks for pointing me at the animation examples, but I'm not currently
      > interested in animating the graphics. What interests me is real-time
      > user interaction with fixed, printable scores.
      >
      > In my first post, I said
      > > 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.
      >
      > I should have said _default_ duration not 'temporal duration'. The
      > default duration can be overridden/ignored by any person or program
      > playing the score. The default duration is related to the logical width
      > of the symbol, and that's a value which is used to calculate the actual
      > horizontal position of the symbols on the staff. The logical width can't
      > be calculated from the graphics, because its only one of the inputs to
      > the algorithm which justifies the symbols across the staff. But its a
      > value which is known to the author of the graphics. :-)
      >
      > I've already written an Assistant Performer [2] application which does
      > the kind of user-interaction I have in mind. This currently reads scores
      > in CapXML format [3], but when I've created some (extended) SVG it will
      > be easy to make it read that too.
      >
      > Currently I'm developing an Assistant Composer application which will
      > _write_ (extended) SVG. (I'm also working on a long-overdue update of my
      > website.) The Assistant Composer uses rather personal algorithms [4],
      > but I could well imagine that _any_ music authoring program could write
      > the extended SVG I have in mind. My Assistant Performer could play
      > scores written by _any_ music authoring program if they exported my
      > (extended) SVG.
      >
      > If there's anyone out there working in this area, I'd be very interested
      > in cooperating.
      >
      > My mind has been exploding since Alex's post yesterday. Discovered that
      > Inkpen preserves custom markup when reading and saving files... :-))
      >
      > All the best,
      > James
      >
      > [1]
      > http://james-ingram-act-two.de/stockhausen/stockhausenSoftware.freeHandXtras.html
      > [2] http://james-ingram-act-two.de/moritz/moritzAssistantPerformer.html
      > [3] http://www.music-notation.info/de/formats/CapXML.html
      > [4] http://james-ingram-act-two.de/compositions/study2/aboutStudy2.html
      --------------------------------------------------------------------------
      > From: "Helder Magalhães" <helder.magalhaes@...>
      > To: "James Ingram" <j.ingram@...>
      > Cc: <www-svg@...>
      > Sent: Monday, November 01, 2010 7:19 PM
      > Subject: Re: SVG and MIDI
      >
      > > Hi James,
      > >
      > >
      > >> My mind has been exploding since Alex's post yesterday. Discovered that
      > >> Inkpen preserves custom markup when reading and saving files... :-))
      > >
      > > You mean "Inkscape" [1]? ;-)
      > >
      > > Yeah, I guess taking the "develop an Inkscape plug-in" approach is
      > > probably wise for this case. I've seen a few software packages based
      > > on this approach, mostly just to embed metadata which is used for
      > > behavior during run-time.
      > >
      > > I guess you might also find interesting (to mix/analyze/reuse) to know
      > > about Audacity [2], which has some (apparently quite limited) support
      > > for MIDI and whose license seems to be compatible with Inkscape's.
      > >
      > > Probably this is not the most appropriate mailing list for this sort
      > > of details: I'd hint you to place this sort of threads in the SVG
      > > Developers group [3] in the future. ;-)
      > >
      > >
      > >> All the best,
      > >> James
      > >
      > > Hope this helps,
      > > Helder
      > >
      > >
      > > [1] http://inkscape.org/
      > > [2] http://audacity.sourceforge.net/
      > > [3] http://tech.groups.yahoo.com/group/svg-developers
      --------------------------------------------------------------------------
      > From: ddailey <ddailey@...>
      > Date: Mon, 1 Nov 2010 20:34:42 -0400
      > Message-ID: <357BA9C4F35F494D83B8908F364226E5@disxgdg31szkx7>
      > To: Helder Magalhães <helder.magalhaes@...>, "James Ingram" <j.ingram@...>
      > Cc: <www-svg@...>
      > I would echo two of Helder's recommendations: SMIL for synchrony and
      > svg-developers (on yahoo groups) as a forum to exchange such ideas. I've
      > only half tuned into this thread, but for a long time I have wanted some
      > sort of musical markup notation not to annotate music but to compose and
      > play it (and of course interleave with graphical presentations).
      >
      > So something like <chord timber="flute" id="C"><note value="A,0"/><note
      > value="F,0"/><note timber="trombone" value="C,1" hold="C.end+1"/><voice
      > amplitude="7db" modulation="20hx"><animate animateValue="amplitude"
      > from="7db" to="4db" begin="2s" dur="1s" /></chord> could be "played" while
      > I'm doing a variety of other things with HTML and SVG. It would be sort of
      > like having SVG but for sound and it would allow the construction of complex
      > sounds. Maybe there already is something like that but I doubt that it has
      > browser support to let me make music yet. And I somehow doubt that if there
      > is, that they're integrating that closely with SMIL and SVG.
      >
      > (Musical markup : SVG) = (system sounds + audio files : installed fonts
      > +<img> + HTML)
      >
      > Here's some fiddling I did with random music composition using audio clips
      > several years ago:
      > http://srufaculty.sru.edu/david.dailey/javascript/sound/sound3.html (working
      > in at least IE, FF, . I'd like ot do something like that but to have direct
      > access to high level sound creation resources instead of the little
      > percussive voices, nice though they are)
      >
      > cheers
      > David
      --------------------------------------------------------------------------
    • Dailey, David P.
      scripted SVG inside (embed or object) inside HTML inside iframe inside HTML inside Moodle Perhaps you will believe that I had a reason to try the above thing;
      Message 2 of 4 , Nov 3, 2010
      View Source
      • 0 Attachment
        scripted SVG inside (embed or object) inside HTML inside iframe inside HTML inside Moodle

        Perhaps you will believe that I had a reason to try the above thing; perhaps not:
        I was explaining about the use of embed and object as a vehicle for HTML <-> SVG scripting for a course given in Moodle. I wanted to display a working example inline in the other HTML, so I used an iframe (which is what I just naturally tend to use for such things).

        http://srufaculty.sru.edu/david.dailey/W3CCourse/week4/SVGinHTML.html

        All went well until I put it into Moodle. Has anyone else had experiences with SVG in Moodle? Asking the Moodle folks If they had ways of making SVG work was received like speaking Uighur in an Aztec village.

        Anyhow, the curious and interesting thing, is that for IE+ASV, the <object> example worked but the <embed> example didn't! A reversal of the conventional finding on this subject! So, now after umpty-seven years of having to use <embed> to do complete round-trip scripting of HTML and SVG I have discovered a (nother)* way of getting object to work. Just as IE+ASV is preparing to disappear from the landscape, another solution to a perplexing problem arises!

        Cheers
        David


        *There is also
        <object id="E" type="image/svg+xml" data="ovals.svg" width="320" height="240">
        <param name="src" value="ovals.svg">
        </object>

        See http://www.w3.org/Graphics/SVG/IG/resources/svgprimer.html#object


        [Non-text portions of this message have been removed]
      • j.ingram48
        Hi, As I said before somewhere, I am currently working on an Assistant *Composer* project, which needs to *write* SVG files containing MIDI information. I m
        Message 3 of 4 , Nov 4, 2010
        View Source
        • 0 Attachment
          Hi,

          As I said before somewhere, I am currently working on an Assistant
          *Composer* project, which needs to *write* SVG files containing MIDI
          information. I'm going to start with the scheme described below,
          though it will probably change as I go along.

          Doing it like this means that clients don't need to look at the
          graphics *at all* in order to play the score.

          I could well imagine that this way of doing things may eventually
          become the basis for an official standard, but such things take
          time, and some proofs of concept...

          Okay, so here's how I'm going to start:

          First, a new namespace:
          xmlns:midi="http://www.james-ingram-act-two/svgMidi.html"

          This namespace is going to contain:
          midi:channel // for use in midi:svgType "Staff" (see below)
          midi:noteNumbers // for use in midi:svgType "Chord" (see below)
          midi:velocity // for use in midi:svgType "Chord" (see below)

          The names of all the MIDI switches, controllers and commands:
          midi:patch
          midi:expression
          midi:volume
          midi:modulationWheel
          midi:breathControl
          midi:celeste
          midi:pan
          etc.

          It will also contain names for sliders - controllers
          which change continuously until their next instance (or some
          default value):
          midi:expressionSlider
          midi:panSlider
          midi:portamentoSlider
          etc.
          Sliders will probably be defined analogously to SVG's multisegment
          lines, containing<startValue>,<endValue> and<msDuration> values.

          The following types need to be defined too:
          midi:svgType="System" // a container for a sequence of "Staff"s
          midi:svgType="Staff"
          midi:svgType="Chord"
          midi:svgType="Rest"

          midi:msPos (int)
          midi:msDuration (int)

          midi:staffName (string) // My client (the Assistant Performer)
          // needs this when setting performance
          // options.

          "System" midi:msPos is the (default) number of milliseconds from
          the beginning of a performance.
          "Chord" and "Rest" midi:msPos are the (default) number of
          milliseconds from the beginning of the "System".
          If defined, the "Chord"'s midi:msDuration defines when its noteOffs
          are sent. By default, the noteOffs are sent at the time of the
          following "Chord" or "Rest".

          Here's an example of how I imagine using these names:

          <svg xmlns="http://www.w3.org/2000/svg"
          xmlns:midi="http://www.james-ingram-act-two/svgMidi.html" ...>

          <!-- draw page objects here (title, page numbers etc.) -->

          <!-- there will be a sequence of Systems in the page -->
          <g midi:svgType="System" midi:msPos="0">
          <!-- draw any System specific graphics here -->

          <!-- there will be a sequence of Staffs in the System -->
          <g midi:svgType="Staff" midi:staffName="Flute" midi:channel="0">
          <!-- a sequence of Chords, Rests and other objects -->
          <!-- possibly draw a clef here -->
          <!-- possibly draw a key signature here -->
          <!-- possibly draw a time signature here -->
          <g midi:svgType="chord"
          midi:msPos="0"
          midi:msDuration="3500"
          midi:midiPitches="64 67 83 90"
          midi:velocity="101"
          midi:patch="75"
          midi:expressionSlider="20 110 3500"
          <!-- etc. -->
          >
          <!-- draw the chord symbol (and any grouped objects) -->
          </g> <!-- end of chord -->

          <g midi:svgType="Rest"
          midi:msPos="4000"
          >
          <!-- draw the rest (and any grouped objects) -->
          </g> <!-- end of rest -->

          <!-- etc. more chords, rests, barlines etc. -->

          </g> <!-- end of staff -->
          <!-- more Staffs -->
          </g> <!-- end of system -->
          <!-- more Systems -->
          </svg>

          Does that make sense?

          Is there any way to set up a special interest group for working on
          this subject? Neither this forum, nor www-svg@... seem specialized enough. It would also be nice if I could find some sponsorship of some kind...

          All the best,
          James

          p.s. I have also sent this mail to www-svg@....
        • j.ingram48
          Hi, Continuing the thread I started here last November, I d just like to say that I ve now completed two experimental scores (Studies 2b2 and 2b3) and
          Message 4 of 4 , Feb 27, 2011
          View Source
          • 0 Attachment
            Hi,

            Continuing the thread I started here last November, I'd just like to say that I've now completed two experimental scores (Studies 2b2 and 2b3) and uploaded them to [1] and [2]. These scores are written in SVG, and include identical timing and MIDI information in a special namespace (summarized in [3]).

            I've also written to the W3C forum again, because I think some aspects of this could/should be worked into the SVG standard.

            My speciality is music notation, not SVG or MIDI, so there's likely to be room for improvement in the way I've done some of this...

            As an SVG beginner, I'd especially like to thank David Dailey for the indispensable, and beautifully illustrated, "An SVG Primer for today's Browsers". Thus far, I've only used a small subset of SVG, but that may well change in future. Anyway, Thanks!

            All the best,
            James

            [1] http://james-ingram-act-two.de/compositions/study2/study2b/study2b2.html
            [2] http://james-ingram-act-two.de/compositions/study2/study2b/study2b3.html
            [3] http://james-ingram-act-two.de/svgScoreExtensions.html
          Your message has been successfully submitted and would be delivered to recipients shortly.