[Top][All Lists]

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

Re: Issue 687 in lilypond: Enhancement: inequal MIDI quantization of equ

From: lilypond
Subject: Re: Issue 687 in lilypond: Enhancement: inequal MIDI quantization of equal durations (swing, rubato)
Date: Mon, 09 Aug 2010 22:54:27 +0000

Comment #15 on issue 687 by adam.spiers: Enhancement: inequal MIDI quantization of equal durations (swing, rubato)

Superb work! This is a giant leap forward, and it's great news that we can do this without touching any C++. Regarding your points:

1. Actually I think we're better off working in ratios, because (a) it removes the dependency on the length of the swing duration, and (b) the ratio will typically have a large denominator anyway, in order to cater for the full range from very subtle amounts of swing to very obvious heavy swing. But I think I see your point - if a dotted quarter note was in the right position within the measure that it needed to be lengthened, it would be lengthened by the same amount as an eighth note in the same position.

2. Your solution looks good to me. It seems a reasonable assumption that a swing pattern never spans multiple bars. There is also the Timing.measurePosition property which might help?

3. I think (begin ...) is just like (progn ...) in Common Lisp - required whenever you want to sequentially evaluate multiple forms and the enclosing form only expects a single form.

4. Yes that would be nice :-) Here's a poor man's template for Scheme testing:

\version "2.12.2"

schemetest =
#(define-music-function (parser location music)  (ly:music?)
  (let ((mom (ly:moment-add
              (ly:make-moment 1 2)
              (ly:make-moment 1 4))))
   (ly:input-message location "~a" mom))

\score { \schemetest { a } }

A few other points (for now still assuming eighth note jazz swing,
which will need to be parametrized later on) ...

As you already note in the code, the lengthening/shortening criteria
and ratio calculations both need some work.  One thing we need to
ensure is that the total measure length remains constant.  In the
simple case of jazz swing, this means that the ratio by which an
eighth note gets lengthened needs to be the reciprocal of the ratio by
which it gets shortened.  In your code it seems to be lengthened by
4/3 and shortened by 2/3 rather than by 3/4.

Another is that it's not just eighth notes which are
lengthened/shortened - it's any note whose duration is an odd multiple
of an eighth note.  In other words, either it starts on an even eighth
note boundary defined by one of these moments:

  (ly:make-moment 0 8)
  (ly:make-moment 2 8)
  (ly:make-moment 4 8)
  (ly:make-moment 6 8)

and ends on an odd eighth note boundary:

  (ly:make-moment 1 8)
  (ly:make-moment 3 8)
  (ly:make-moment 5 8)
  (ly:make-moment 7 8)

or vice-versa.

For example, in the measure:

  | a8 b4. a8 c4 a8 |

going from left to right:

  a8  would need to be lengthened
  b4. would need to be shortened
  a8  would need to be lengthened
  c4  would stay the same length
         (as the concatenation of a shortened 8th note with
          a lengthened 8th note)
  a8  would need to be shortened

Having said all that, we need to think carefully about how to
generalize this in a way which can cope with much complicated swing
patterns, such as the samba swing I describe in comments 1 and 6.

reply via email to

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