[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: midi note durations
From: |
karl |
Subject: |
Re: midi note durations |
Date: |
Thu, 29 May 2014 00:55:48 +0200 (CEST) |
Derek:
> I used music21 to measure note lengths, and was able to convert midi (and a
> variety of other formats). See: http://web.mit.edu/music21/
Looks useful, tough it is big:
$ git clone https://github.com/cuthbertLab/music21.git
...
$ du -s music21/
393864 music21/
Think I got it working...
$ python
Python 2.7.3 (default, Jan 2 2013, 16:53:07)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from music21 import *
music21: Certain music21 functions might need these optional packages:
matplotlib, scipy; if you run into errors, install it by following the
instructions at http://mit.edu/music21/doc/installing/installAdditional.html
>>> s = converter.parse("/home/karl/most/music/noter/manskor/Slovenec_sem.mid")
>>> print lily.translate.LilypondConverter().textFromMusic21Object(s)
\version "2.19"
\include "lilypond-book-preamble.ly"
color = #(define-music-function (parser location color) (string?) #{
\once \override NoteHead #'color = #(x11-color $color)
\once \override Stem #'color = #(x11-color $color)
\once \override Rest #'color = #(x11-color $color)
\once \override Beam #'color = #(x11-color $color)
#})
\header { }
\score {
<< \new Staff = xbdycdydc { \key c \major
\time 1/4
g 8..
r 32
\time 3/4
< e' c' > 4
r 32
< c' g > 16
g 8..
r 32
< e' c' > 8..
r 32
< f' d' > 4
r 32
< d' b > 16
< b g > 8..
r 32
< f' b > 8..
...
Output looks better than midi2ly, but it is missing the upbeat and
it has thoose strange rests between the notes. So, as is it didn't
solve the issue.
The durations are handled in music21/duration.py, maybe I can get some
ideas from it.
Regards,
/Karl Hammar
-----------------------------------------------------------------------
Aspö Data
Lilla Aspö 148
S-742 94 Östhammar
Sweden
+46 173 140 57