lilypond-user
[Top][All Lists]
Advanced

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

Re: understanding midi files


From: karl
Subject: Re: understanding midi files
Date: Tue, 28 Jan 2014 12:24:03 +0100 (CET)

Johan Vromas:
> address@hidden writes:
> 
> >> > IOError: [Errno 2] No such file or directory: 'aeiou.mid'
> >
> > $ ls -l aeiou.mid 
> > -rw------- 1 karl users 9760 Jan 27 10:44 aeiou.mid
> 
> To eliminate some odds, try passing the file using a complete path, e.g.
> 
>   $ lilymidi --pretty `pwd`/aeiou.mid

$ lilymidi --pretty /home/karl/examples/aeiou.mid | head
Filename:     /home/karl/examples/aeiou.mid
MIDI format:  1 (one or more simultaneous tracks)
Divisions:    768 per whole note
#Tracks:      10

Track 1:
    Time 0:
        Track name: A-e-i-o-u
        Copyright:  T&M: trad. occitan. / Marc H?nsenberger
Q: Musique Simili: Falbalas. Ins-Anet 1998
Traceback (most recent call last):
  File "/usr/local/bin/lilymidi", line 250, in <module>
    go ()
  File "/usr/local/bin/lilymidi", line 234, in go
    dump_midi (midi_data, midi_file, options);
  File "/usr/local/bin/lilymidi", line 224, in dump_midi
    dump_event (ev[1], time, "        ");
  File "/usr/local/bin/lilymidi", line 192, in dump_event
    print padding + f.format (ev[1], ev[2])
IOError: [Errno 32] Broken pipe
$

Ok, full path made it work, but why does it complain so verbosely about 
broken pipe, pipeing things to e.g. head is normal behaviour, it should
not complain about that.

///

Also:

 ** lilymidi output:
...
Divisions:    768 per whole note
...
Track 1:
...
        Tempo:      500000 msec/quarter
        Time signature: 1/8, metronome 1/4

 ** midi.pl output:
...
  'ticks'  => 192,
    # Track #0 ...
        ['set_tempo', 0, 500000],
        ['time_signature', 0, 1, 3, 24, 8],
...

 ** lilymidi code:

class time_signature_formatter (formatter):
   def format_vals (self, val1, val2 = ""):
       from fractions import Fraction
       # if there are more notated 32nd notes per midi quarter than 8,
       # we display a fraction smaller than 1 as scale factor.
       r = Fraction(8, ord (val2[3]))
       if r == 1:
           ratio =""
       else:
           ratio = " *" + str (r)
       return str (ord (val2[0])) + "/" + str(1 << ord (val2[1])) + ratio \
           + ", metronome "  + str (Fraction (ord (val2[2]), 96))
=====

Why does lilymidi treat val2[3] as a multiplier and where comes the "96"
from (in relation to val2[2]) ?

http://www.cdik.se/pdf/midiformat.pdf describes the time signature
event on page 12. It is unclear written. Is there anyone here that
have a clear understanding about the last two parameters, named cc and 
bb in the document ?

And page 4 describes "ticks per quarter-note" where the "quater note"
isn't nessesarily a quarter note.

The text says something like

 cc     number of ticks in metronome click
 bb     number of 32nd notes to the quarter note

So if I have a 6/8 key signature, the beat is two per measure (on 4.
in lilypond notation), but the text confuses the reader with
expressions like "quarter note", "MIDI quarter note" and
"metronome click". Where obviously the "quarter note" isn't a normal
quater note.

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]