lilypond-user
[Top][All Lists]
Advanced

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

midi note durations


From: karl
Subject: midi note durations
Date: Wed, 28 May 2014 20:48:34 +0200 (CEST)

 I'm looking into the problem of converting midi files (from
other notesetting programs) to lilypond code.
My experiments is available as:

http://turkos.aspodata.se/git/musik/bin/miditoly.pl

and my intentions is to make it generate code like I would have
written it.

So if you have any helpful thoughts, you are welcome.

///

The current problem is how to interpret midi note lengths.

 As examples I'm using:
http://www1.cpdl.org/wiki/images/0/0e/Slovenec_sem.mid
http://www1.cpdl.org/wiki/images/1/12/Slovenec_sem.pdf

http://manfredhoessl.de/files/F295n6.MID
http://www3.cpdl.org/wiki/images/sheet/fuh-2956.pdf

///

Some comments on midi2ly's output of Slovenec_sem:

Here midi2ly takes the easy way out letting lilypond do
splitting of notes and rests at engraving time:

 \layout {
   \context {
     \Voice
     \remove "Note_heads_engraver"
     \consists "Completion_heads_engraver"
     \remove "Rest_engraver"
     \consists "Completion_rest_engraver"
   }
 }

I want the generated code to generate

 \time 4/4 r4 a a2~ | a4 r r2 |

instead of

 \time 4/4 r4 a a2. r2.

===

midi2ly doesn't detect upbeats. In a midi file, one can identify
an upbeat with by looking at the first two time signatures n1/d1 n2/d2.
It is an upbeat if d1 == d2 && n1 < n2 && the second time signature 
appear in the second bar:

 trackAchannelA = {
   \key c \major
   \time 1/4
   \tempo 4 = 80 
   \key c \major
   \skip 4 
   | % 2
   \time 3/4 
 }

The above should be written as:

 trackAchannelA = {
   \key c \major
   \time 3/4
   \tempo 4 = 80
   \partial 4 \skip 4 |
 }

===

This is not how I want my lilypond code:

 trackBchannelB = \relative c {
  g'4*442/480 r4*38/480 <e' c >4*332/480 r4*28/480 <c g >4*111/480 
  r4*9/480 g4*442/480 r4*38/480 
  | % 2
  <e' c >4*442/480 r4*38/480 <f d >4*332/480 r4*28/480 <d b >4*111/480 
  r4*9/480 <b g >4*442/480 r4*38/480 
...
  | % 9
  <e c >4*442/480 r4*38/480 <f b, >4*884/480 r4*76/480 
  | % 10

everything is 4th's, the 16th's (third note/chord) as well as the
half notes (<e c> in bar 10), it also inserts rests which more is an
articulation, perhaps a "long staccato". I want the above to be rendered
more like:

 trackBchannelB = \relative c {
   \partial 4 g4 |
   <e' c>8. <c g>16
etc.

///

Taking statistics of the file gives me (ticks is #of timesteps
for a quarter none):

ticks : 480
Duration 1/4   Count
   111 0.2313     15 *(111)*
   221 0.4604    128 *(221)*
   332 0.6917     15 *(332)*
   442 0.9208     94 *(442)*
   663 1.3813     34 *(663)*
   884 1.8417     18 *(884)*

I see that 221 is close to 2*111 (the shortest duration),
332 close to 3*111, etc. That could be a hint.

Robert Führers mass (the second example) have durations that
are easily converted to lilypond lengths:

ticks : 1024
Duration 1/4   Count
   205 0.2002     13 *(205)*
   256 0.2500     16 16
   512 0.5000    850 8
   768 0.7500      3 8.
  1024 1.0000   1182 4
  1280 1.2500      1 16*5
  1536 1.5000     57 4.
  2048 2.0000    290 2
  2560 2.5000      1 8*5
  3072 3.0000     14 2.
  4096 4.0000     15 1

16*5 is (here) the same as like a4~ a16

Ideas on algorithms on how to decode the durations, how do I separate
staccato from real rests, etc. are welcome.


Regards,
/Karl Hammar

-----------------------------------------------------------------------
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]