My workflow is needed to be an automation script, cause I want to create a
tool to generate the annotation of each note automatically. The process is
like the below:


   1.

   Turn the .xml file into .ly,
   1.

      Ideally, I want to eliminate all the decorations, like accent,
      staccato, any kind of ornament, and tempo-related expression.
      2.

      Such as --nd, do not convert directions (^, _ or -) for
      articulations, dynamics, etc.

Command example: musicxml2ly -v --nd --midi --output="1_Bach_Prelude1.ly"
./1_Bach_Prelude1.xml

   1.

   In the .ly file, convert the instrument into Violin or Cello, no matter
   what kind of instrument the score was originally made for, because the
   String instrument will get a more stable note duration of MIDI file than
   the Woodwind or Piano.



   1.

   In the .ly file, eliminate all the tempo expressions, and set the tempo
   to BPM=60.

For the same reason as 2nd step, this step aims to get a more stable note
duration.

The steps 2 and 3 I wrote a python code to replace the tempo and want to
change the instrument clef, see the attachment “replace_tempo.py”.

Command example: `python replace_tempo.py --path ./1_Bach_Prelude1.ly`,
then output the file named just add the `_replace` afterward, like:
`1_Bach_Prelude1_replace.ly`


   1.

   Then use the lilypond command “lilypond -dmidi-extension=mid MyFile.ly”
   to convert the .ly file into a .mid file.

The output file has 2 formats PDF and MIDI, the filename called:
`1_Bach_Prelude1_replace.mid` and `1_Bach_Prelude1_replace.pdf`


   1.

   Using the MIDI and original XML file, I can use my python script to get
   each note’s information, specifically, the attribute I want is listed
   below: ['Onset', 'Offset', 'MIDI number', 'Pitch name', 'Duration',
   'Staff', 'Measure', 'Beat in Measure']


I've done the few annotations by manually going through steps 1~4, now I
want to automate the full workflow, the target annotation example is put in
the directory, ./ideal_piano_example.

For a better explanation of my tiny example, I create a Git repository,
https://github.com/snowmint/Note_annotation, if my description has any
unclear parts please let me know I’ll try to explain each step more clearly
as possible.

Sincerely,

Angie Wei.


Carl Sorensen <[email protected]> 於 2022年8月3日 週三 晚上10:05寫道:

> Welcome to lilypond, Angie!
>
> On Wed, Aug 3, 2022 at 7:16 AM 柊希里子 <[email protected]> wrote:
>
>> Hello, everyone on the mail list, I'm new to lilypond.
>>
>> I have a list of questions below which I haven’t been able to solve
>> despite my best effort searching on the internet.
>>
>> 1. How do I convert the piano clef to violin and cello clef?
>>
>
> You need to change the PianoStaff to a StaffGroup.  And then you will need
> to set the instrumentName for each staff appropriately.
>
>
>> I've tried to modify the \set section, but converting it into MIDI and
>> then opening it still didn't change the instrument:
>>
>> = Original score ===================================
>> \new StaffGroup \with { systemStartDelimiter =
>>             #'SystemStartBrace }
>>         <<
>>             \new PianoStaff
>>             <<
>>                 \set PianoStaff.instrumentName = "Piano"
>>                 \set PianoStaff.midiInstrument = #"acoustic grand"
>>                 \context Staff = "1" <<
>>                     \mergeDifferentlyDottedOn\mergeDifferentlyHeadedOn
>>                     \context Voice = "PartPOneVoiceOne" {
>>  \PartPOneVoiceOne }
>>                     >> \context Staff = "2" <<
>>                     \mergeDifferentlyDottedOn\mergeDifferentlyHeadedOn
>>                     \context Voice = "PartPOneVoiceThree" {  \voiceOne
>> \PartPOneVoiceThree }
>>                     \context Voice = "PartPOneVoiceTwo" {  \voiceTwo
>> \PartPOneVoiceTwo }
>>                     \context Voice = "PartPOneVoiceFour" {  \voiceThree
>> \PartPOneVoiceFour }
>>                     >>
>>                 >>
>>             >>
>> = Turn into below ==================================
>> \new StaffGroup \with { systemStartDelimiter =
>>             #'SystemStartBrace }
>>         <<
>>             \new Staff
>>             <<
>>                 \set Staff.instrumentName = "Violin"
>>                 \set Staff.midiInstrument = #"violin"
>>
>>                 \context Staff = "1" <<
>>                     \mergeDifferentlyDottedOn\mergeDifferentlyHeadedOn
>>                     \context Voice = "PartPOneVoiceOne" {
>>  \PartPOneVoiceOne }
>>                     >> \context Staff = "2" <<
>>                     \mergeDifferentlyDottedOn\mergeDifferentlyHeadedOn
>>                     \context Voice = "PartPOneVoiceThree" {  \voiceOne
>> \PartPOneVoiceThree }
>>                     \context Voice = "PartPOneVoiceTwo" {  \voiceTwo
>> \PartPOneVoiceTwo }
>>                     \context Voice = "PartPOneVoiceFour" {  \voiceThree
>> \PartPOneVoiceFour }
>>                     >>
>>                 >>
>>             >>
>> ================================================
>>
>
> I don't see any \midi()  in your file, so I don't think you are creating
> any mid file at all.
>
>
> Ideally, I’d like to convert the left image to the right image:
>> [image: image.png]
>>
>
> Have you read the learning manual?
> https://lilypond.org/doc/v2.22/Documentation/learning/index
>
> It has a template for a string quartet that would be easily modified for
> your specific use case.
>
> Trying to modify examples without having worked through the Learning
> Manual will bring you a lot of frustration.  It's much better to start by
> working through the Learning Manual.
>
>>
>> 2. How do I delete all the tempo expressions of the music score in the
>> .ly file, and set the tempo to BPM=60?
>>
>> I have replaced all the \tempo tag with \tempo 4=60, but after I tried
>> the command 'lilypond -dmidi-extension=mid MyFile.ly', the tempo of the
>> outputted MIDI file didn't seem to be changed.
>>
>> the \midi section of .ly file: \midi { \tempo 4=60 }
>>
>
> If we don't see the entire input file, we can't tell what you've done.
> Please try to make  a tiny example:
> https://lilypond.org/tiny-examples.html
>
>>
>> 3. I wonder if the "-dmidi-extension" command is still being maintained.
>> Since I try to convert the .ly file into a .mid file with BPM=60, and
>> changed the piano into violin and cello timbre, but that didn't work. Are
>> there any other approaches to convert .ly into .mid?
>>
>
> -dmidi-extension doesn't create the midi file; it just sets the extension
> for the midi file.  I never use -dmidi-extension; I just put \midi() blocks
> in my score.
>
>
>> Thanks for reading my questions. Any help or input from you will be
>> greatly appreciated.
>>
>
> Try making a tiny example, with perhaps two notes ieach n the Violin and
> Cello parts.  If that doesn't work, post the exact code you are using, and
> then we will be able to tell what you are doing wrong.
>
>
>> Sincerely,
>>
> Angie Wei
>>
>
> Best wishes,
>
> Carl
>
>

Reply via email to