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

Extracting text from a music .XML file.

Expand Messages
  • Adrian
    The problem is this. Music XML files are cross program files to show music notation. I d like to extract lyrics from the files and in order. But they are
    Message 1 of 47 , Nov 11, 2012
    • 0 Attachment
      The problem is this. Music XML files are cross program files to show music notation. I'd like to extract lyrics from the files and in order. But they are arranged by verses vertically and then by word order horizontally. So in this example, at the start of the tune, you need to get the text in lyric number 1 each time before going back up the document to lyric number 2 and extracting its text.

      <lyric number="1">
      <syllabic>begin</syllabic>
      <text>Peo</text>
      </lyric>
      <lyric number="2">
      <syllabic>single</syllabic>
      <text>Hail</text>
      </lyric>
      <lyric number="3">
      <syllabic>single</syllabic>
      <text>Build</text>
      </lyric>

      a little later on...

      <lyric number="1">
      <syllabic>end</syllabic>
      <text>ple</text>
      </lyric>
      <lyric number="2">
      <syllabic>single</syllabic>
      <text>the</text>
      </lyric>
      <lyric number="3">
      <syllabic>single</syllabic>
      <text>the</text>
      </lyric>

      Now I see it as finding each lyric number and then the text and copying between the angular brackets and dumping that text in a separate page, like a pasteboard. Once it runs out of lyric number 1 it should move to 2 and so on, according to how many verses.

      In my hamfisted way that sometimes works, I created this clip and it does next to nothing. But there is a logic to it. It is just wrong. Can there be loops set up then to count the lyric number from 1 on and grab all its texts and then move up and so on until exhausted?

      Nothing here pastes - is it too fast or just clumsy? I can't get to a point of bad working so to get it to work well.

      ^!Toolbar New Document
      ^!MENU Document/Use as Paste Board
      ^!Document PREV

      ^!Set %n%=0

      :nextverse
      ^!Inc %n%
      ^!Keyboard CTRL+HOME
      ^!Find "<lyric number"
      ^!IfError END

      :thisverse
      ^!Find "%n%" [S]
      ^!IfError nextverse
      ^!Find "<text>" [S]
      ^!Keyboard RIGHT
      ^!Keyboard SHIFTDOWN
      ^!Delay 3
      ^!Find "</text>" [S]
      ^!Keyboard LEFT SHIFTUP
      ^!Toolbar Copy
      ^!Toolbar Paste New
      ^!Find "<lyric number"
      ^!Goto thisverse

      END
    • Adrian Worsfold
      Hello flo Brilliant. Later on today I will alter the clip and instructions on my webpage. How you have managed to account for different line lengths in verses
      Message 47 of 47 , Nov 16, 2012
      • 0 Attachment
        Hello flo

        Brilliant. Later on today I will alter the clip and instructions on my webpage. How you have managed to account for different line lengths in verses baffles me but thanks and I'll give appropriate thanks on the webpage when I re do it, including your further advice.




        Adrian Worsfold

        http://www.pluralist.co.uk
        http://pluralistspeaks.blogspot.com
        pluralist@...
        16-11-2012
        ----- Received the following content -----
        From: flo.gehrke
        Receiver: ntb-clips
        Time: 2012-11-16, 13:42:25
        Subject: Re: [Clip] Extracting text from a music .XML file.


        [Non-text portions of this message have been removed]
      Your message has been successfully submitted and would be delivered to recipients shortly.