lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Experience with several import filters


From: karl
Subject: Re: Experience with several import filters
Date: Tue, 3 Jan 2017 12:48:47 +0100 (CET)

Urs:
> midi2ly

Here we are talking of program (programs mainly used to make scores) 
generated midi files.

It kindof works, but has problems with

////// lyrics
/// character encoding
The midi file format standard says (about text events, [1] page 10):
 However, other characters codes
 using the high-order bit may be used for interchange of files between
 different programs on the same computer which supports an extended
 character set. Programs on a computer       which  does not support
 non-ASCII characters should ignore those characters.
Soo, there is a need to identify which encoding is used, and midi2ly 
gives you errors like "warning: non-UTF-8 input"
/// word combining
E.g. given lyrics like:
 'Sta' 'bat ' 'Ma' 'ter ' 'do' 'lo' 'ro' 'sa ' 
RP-017 (recommended practice 17, see [2]) implies that it in lilypond
code should become
 Sta -- bat Ma -- ter do -- lo -- ro -- sa
Instead midi2ly gives me 
  "Sta"2 "bat " 
  | % 2
  "Ma" "ter "4 "do"2 "lo"4 "ro"2 
  | % 4
  "sa "4*15
/// assoiation with a voice
The first few events in track 1 of [4] is
        ['track_name', 0, 'S1'],
...
        ['lyric', 0, 'Sta'],
        ['note_on', 0, 0, 69, 80],
        ['note_off', 959, 0, 69, 64],
        ['lyric', 1, 'bat '],
        ['note_on', 0, 0, 71, 110],
        ['note_off', 959, 0, 71, 64],
and there is no simultaneous music in the same track and it is clear
that this lyrics belongs to this voice, but midi2ly doesn't identify
that, it treats the lyrics as a totatly independent thing to the music
where I would have liked a result like:

lS_I = \context Lyrics = LS_I \lyricmode { ... }
mS_I = \context Voice  = VS_I \relative f { ... }

\score {
  \new ChoirStaff <<
    \new Staff mS_I
    \lyricsto VS_I \LS_I
  >>
}

or similar.

////// notes
/// midi2ly uses Completion_heads_engraver
instead of splitting notes at the bar lines and using ties

/// note durations
I get lilypond code like

trackBchannelB = \relative c {
  a''4*959/480 r4*1/480 b4*959/480 r4*1/480 
  | % 2
  c4*959/480 r4*1/480 c4*479/480 r4*1/480 c4*959/480 r4*1/480 c4*479/480 
  r4*1/480 ais4*959/480 r4*1/480 

where I would have expected

MaA = \relative f {
  \time 2/2
  \key c \major
  a'2 b |
  c2 c4 c2 c4 ais2 |

As you can see the notes are ended early and midi2ly inserts a very 
short little rest. In this piece [3,4], the three shortest note
durations are

Duration 1/4     Count note_len
   108   0.2250      1 *(108)*
   119   0.2479      8 *(119)*
   120   0.2500      5 16

in that view it is not reasonable to treat a silence of duration 1
as a rest. It seems that $quanta = int($duration[0]*0.6) works well
for that kind of things and durations such as the three above is
better treated as phrasing than followed by a rest.

(Also, you might treat a note duration of 0 as an \appogiatura
(not present in my example [3,4]).)

/// missing \time
see the above example and "track 0" below

/// missing \key
even though \key c \major is default, its nice to write it out

////// score
I get

trackI = <<

  \clef bass
  
  \context Lyrics = voiceA \trackIchannelA
  \context Voice = voiceB \trackIchannelB
>>


\score {
  <<
    \context Lyrics=trackB \trackB
    \context Lyrics=trackC \trackC
    \context Lyrics=trackD \trackD
    \context Lyrics=trackE \trackE
    \context Lyrics=trackF \trackF
    \context Lyrics=trackG \trackG
    \context Lyrics=trackH \trackH
    \context Lyrics=trackI \trackI
  >>
  \layout {}
  \midi {}
}

which gives me everything on a single staff instead of 8.

////// track 0

    # Track #0 ...
    MIDI::Track->new({
      'type' => 'MTrk',
      'events' => [  # 8 events.
        ['track_name', 0, 'Stabat Mater Dolorosa'],
        ['time_signature', 0, 2, 1, 48, 8],
        ['set_tempo', 0, 454540],
        ['time_signature', 140160, 3, 2, 24, 8],
        ['set_tempo', 0, 416660],
        ['time_signature', 28800, 2, 1, 48, 8],
        ['set_tempo', 0, 454540],
        ['end_track', 186240],
      ]
    }),

is converted to 

trackAchannelA = {
  
  \set Staff.instrumentName = "Stabat Mater Dolorosa"
  
  \time 2/2 
  
  \tempo 4 = 132 
  \skip 1*73 
  \time 3/4 
  
  \tempo 4 = 144 
  \skip 1*15 
  \time 2/2 
  
  \tempo 4 = 132 
  
}

where the track_name of track 0 is better converted to

\header {
  title = "Stabat Mater Dolorosa"
}

and I would like \time to be included in the music.

Regards,
/Karl Hammar

[1] http://www.music.mcgill.ca/~ich/classes/mumt306/midiformat.pdf
[2] https://www.midi.org/specifications/item/standard-midi-files-smf
[3] http://www.johnkilpatrick.co.uk/music/misc/stabat-palestrina-e.pdf
[4] http://www.johnkilpatrick.co.uk/music/misc/stabat-palestrina-e.mid

-----------------------------------------------------------------------
Aspö Data
Lilla Aspö 148
S-742 94 Östhammar
Sweden
+46 173 140 57





reply via email to

[Prev in Thread] Current Thread [Next in Thread]