Author Topic: A Suggestion for the Implementation of Music  (Read 12300 times)

Gilrond

  • Hydlaa Notable
  • *
  • Posts: 764
    • View Profile
Re: A Suggestion for the Implementation of Music
« Reply #30 on: November 28, 2011, 08:47:43 pm »
what's so strange in not supporting unneeded features of music xml?

Nothing strange, but since you use a subset, you could at least make an XSD so others can make conforming tools. And regarding two channels (solo & bass) - it doesn't seem to be an unneeded feature. IG UI is misleading, it shows two channels, but it in XML exported from PS it results in one (somehow combined I guess, and I still can't figure out how it's combined). So importing XML with two channels doesn't work at all.
« Last Edit: November 28, 2011, 08:50:28 pm by Gilrond »

Gilrond

  • Hydlaa Notable
  • *
  • Posts: 764
    • View Profile
Re: A Suggestion for the Implementation of Music
« Reply #31 on: November 28, 2011, 11:12:17 pm »
After some fiddling, I figured the basic limitations of the PS XML format and was able to use a melody exported from the Rosegarden (with some alterations). PS doesn't use a correct MusicXML to be honest, but it uses the subset of its tags (incorrectness for example is in requiring certain tags to be always present, while the official spec doesn't mandate it).

Example of a note:

Quote
      <note>

        <pitch>

          <step>B</step>         

          <octave>4</octave>

          <alter>0</alter>

        </pitch>

        <duration>4</duration>

      </note>

<alter> for example needs to be always there, otherwise PS will reject the XML (while it's redundant for 0).

Another limitation - PS understands only one channel. You can't use more. The in-game UI misleads you to believe that it uses 2, but it doesn't. So stick to one channel.

One more limitation seems to be, that divisions can be only equal to 4 (rosegarden sets divisions to 960 by default and that screws PS, up to crashing). Divisions are the number of fractions in one quarter (4th) note. Then the amount of divisions you put in the duration tag will define the length of the note. I.e if divisions=4, and duration=2, you'll get 1/8. So make sure you set divisions to 4 and have durations set accordingly.

See also: http://www.recordare.com/musicxml/tutorial/hello-world
« Last Edit: November 28, 2011, 11:23:29 pm by Gilrond »

bilbous

  • Guest
Re: A Suggestion for the Implementation of Music
« Reply #32 on: November 29, 2011, 03:36:13 am »
This sounds pretty useful, maybe you could create a section on the wiki with your findings as they firm up.

LigH

  • Forum Legend
  • *
  • Posts: 7096
    • View Profile
Re: A Suggestion for the Implementation of Music
« Reply #33 on: December 06, 2011, 03:41:49 pm »
I wrote a MusicXML filter for PlaneShift which accepts only the XML tags and attributes present in the scores I created in-game, and should possibly limit MusicXML files from other sources to the tag/attribute subset supported by PlaneShift. But I am not certain how well it works. Division values are not yet checked, the main purpose is only to remove probably unsupported tags. Use at your own risk. Keep backups.

Gag Harmond
Knight and Ambassador
The Royal House of Purrty

Gilrond

  • Hydlaa Notable
  • *
  • Posts: 764
    • View Profile
Re: A Suggestion for the Implementation of Music
« Reply #34 on: December 06, 2011, 08:59:20 pm »
Can you link the code somewhere as well please? Otherwise I have no idea what it does (probably it would be useful to make it a standalone script, instead of on-line php service). The problem is not just removing unsupported tags. There are key limitations involved, for example only one available channel. Channels can be achieved in a whole number of ways in musicXML, for example using <part>, <voice> or <staff> tags. None of those are supported in PS to make parallel sounding music (even for solo and bass), and just filtering those tags will produce a totally messed up result.
« Last Edit: December 06, 2011, 09:17:30 pm by Gilrond »

LigH

  • Forum Legend
  • *
  • Posts: 7096
    • View Profile
Re: A Suggestion for the Implementation of Music
« Reply #35 on: December 07, 2011, 07:22:52 am »
So it was obviously a bad idea from the beginning. Ignore the above then.

The most annoying part is that I was able to create XML files which look like they might be acceptable, they don't contain any XML tags the game would not save out. But still they are not loaded. Either with the error "Cannot load: illegal XML syntax!" (although the file was perfectly wellformed), or even "File not found!" (although the file existed certainly).

Gag Harmond
Knight and Ambassador
The Royal House of Purrty

Gilrond

  • Hydlaa Notable
  • *
  • Posts: 764
    • View Profile
Re: A Suggestion for the Implementation of Music
« Reply #36 on: December 07, 2011, 07:31:53 am »
I was able to load XML in the game, after manually editing the result produced with Rosegarden music editor (see details above). As I mentioned, you can't skip any <alter> tags, even if it's redundant <alter>0</alter> (for regular non sharp/flat notes). Normal editors obviously don't write that since it's not needed. That seems to be the most common problem for loading even a very simple XML. So far PS XML doesn't really conform even to the subset of MusicXML, since it sets some elements as required, while they are optional in the real schema.
« Last Edit: December 07, 2011, 07:37:48 am by Gilrond »

weltall

  • Associate Developer
  • Veteran
  • *
  • Posts: 1671
    • View Profile
    • http://weltall.heliohost.org
Re: A Suggestion for the Implementation of Music
« Reply #37 on: December 07, 2011, 05:27:31 pm »
something being optional means it has a default fall back value in other words yes it's a subset. the subset which doesn't extend the schema with optionality.

Gilrond

  • Hydlaa Notable
  • *
  • Posts: 764
    • View Profile
Re: A Suggestion for the Implementation of Music
« Reply #38 on: December 07, 2011, 07:21:31 pm »
It is a subset, but validation rules of this subset don't conform to the schema, like I said, making something optional as required. I.e. basically making something out of that subset by hand will pass validation of the standard schema, but will fail to validate in PS (missing <alter>).

Malunga

  • Wayfarer
  • *
  • Posts: 6
    • View Profile
Re: A Suggestion for the Implementation of Music
« Reply #39 on: December 12, 2011, 02:46:31 pm »
A few words about role-playing side of music.
1. Some tutorial quest is strongly required for joining "bard fellowship" smoothly. Currently all your char needs is to purchase an instrument (I have bought 3 different without searching too hard), a blank score (everyone knows where blanks are sold) and start editing this score. It looks like a Music Playing skill has appeared from nowhere. There was no history of musical instruments, nobody has invented how to record sounds, and no records about why music is so good to spend days for training. My suggestion is to start musical career from talking to NPCs and collecting some knowledge about great musicians of Yliakum and their contribution to (for example) battle glory of the Dome. Some new books in Library may help to support this role-playing line.
2. After finishing this inroducing part there can be given a quest for demonstrating how music playing helps to support fighting spirit of allies. For example let one "bard" invite some allies into group and those who will stand within audible range of music get a buff of "faster regeneration" or "strength". There can be different events happen when music is playing like "monsters attracted by melody start to attack a buffed group" or "monsters become mad and attack each other". Another way is to make good mood for blacksmiths or bakers. Playing a song "When My Hammer Falls"* or "My Baker"* will lead to higher quality items produced. The main idea is to prove that music is a different than magic but a powerful means for something. After all music in RL is a powerful social phenomena. Omitting this fact we never can make interest into it characters in IC manner.
3. Only after afore-mentioned events it will be logically to start training this skill (i.e. "level-up") in order to make researched buffs more powerful or/and more long-lasting.
What do you think?

* - any coincidence to RL song names are purely accidential.

MishkaL1138

  • Veteran
  • *
  • Posts: 1175
  • Meh.
    • View Profile
Re: A Suggestion for the Implementation of Music
« Reply #40 on: December 12, 2011, 05:04:12 pm »
As usual, Malunga, new features come before the settings developers can even write about it.

"It's all fun and games until someone stabs someone else in the eye."

Gilrond

  • Hydlaa Notable
  • *
  • Posts: 764
    • View Profile
Re: A Suggestion for the Implementation of Music
« Reply #41 on: December 13, 2011, 06:24:22 pm »
Not always Mishka. In many cases it's the other way around - settings are way ahead of implemented features.

DGMurdockIII

  • Traveller
  • *
  • Posts: 30
    • View Profile
Re: A Suggestion for the Implementation of Music
« Reply #42 on: December 16, 2011, 08:21:00 pm »
ABC notation should be used as it would making doing this alot easer

http://en.wikipedia.org/wiki/ABC_notation

http://abcnotation.com/wiki/abc:standard:v2.1

Gilrond

  • Hydlaa Notable
  • *
  • Posts: 764
    • View Profile
Re: A Suggestion for the Implementation of Music
« Reply #43 on: December 16, 2011, 10:09:05 pm »
The format itself is less critical, but support of the format in music editors is more important. If MusicXML is more or less supported, ABC notation is probably less so. Plus XML is rather good on its own and has good parsing/validating tools. I doubt there is a matching support for some custom notation.
« Last Edit: December 16, 2011, 10:12:21 pm by Gilrond »

Gilrond

  • Hydlaa Notable
  • *
  • Posts: 764
    • View Profile
Re: A Suggestion for the Implementation of Music
« Reply #44 on: December 21, 2011, 08:14:52 pm »
There is another issue, which might cause confusion for those who import scores from external editors.  If you set the tonality in the beginning, at present, PS will adjust all individual notes accordingly, while in conventional MusicXML each note would have an individual modifier (sharp or flat) in that case. So if you import some melody written not in C major, you'd get a messed up result. As a quick fix - set manually the tonality in the resulting XML to C major, and individual modifiers should do the rest for you automatically.
« Last Edit: December 21, 2011, 08:19:58 pm by Gilrond »