lilypond-devel
[Top][All Lists]
Advanced

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

Support articulations, slurs and breaths in MIDI (issue 26470047)


From: dschudy
Subject: Support articulations, slurs and breaths in MIDI (issue 26470047)
Date: Fri, 15 Nov 2013 09:30:11 +0000

Reviewers: ,

Message:
Shouldn't Lilypond's MIDI output be as beautiful as its engraving
output?

This patch is a step toward that: it makes the most common articulations
work in MIDI without requiring the use of articulate.ly and a separate
\score. It also overlaps notes in slurs, which gives better results on
legato instruments (e.g. winds and strings) than articulate.ly's
approach of shortening unslurred notes.

Since the meanings of articulations vary widely, their performance can
be customized or disabled through properties on the articulation (and
the parser is modified to make c-. equivalent to c\staccato, so setting
its properties works). This is less convenient than it ought to be,
especially for \breathe — is there a better way? Currently slurOverlap
is a context property because I couldn't find a better place to put it,
but maybe the other properties should also be on contexts so they're
easier to set.

This change doesn't interfere with articulate.ly, since the script's
output doesn't contain any articulations.

Problems:

1) Length calculations use written durations rather than absolute time,
which is not ideal — switching from 2/2 to 2/4 shouldn't affect the
sound at all. I think this can be handled by looking up the tempo and
time signature.

2) Perform-length is not enough to support everything articulate.ly does
— it can't express ornaments that add notes (e.g. \mordent) or change
timing (e.g. swing). Ideally, articulations would be able to replace
notes with arbitrary music, not just change the length. AFAICT this is
hard to implement, because it requires feeding the replacements back
into the performers without interfering with the ongoing iteration. (It
also requires changing how Audio_item times are determined, so they can
start at times other than now_mom(), but I have a solution for this.) An
easier alternative would be to have the perform hook return a list of
notes, but this doesn't cover \fermata, which needs to change the tempo.


Description:
Support articulations, slurs and breaths in MIDI.

Articulations and breaths can alter the length and volume of the note.
(Breaths affect the previous chord.) This is controlled by their
perform-length and perform-volume properties. The standard articulations
now have these properties where appropriate.

Notes in a slur overlap slightly in MIDI output. This approximates how
they're played on keyboards, and triggers the legato mode of many
synthesizers. The degree of overlap is controlled by the slurOverlap
context property.

Shorthand articulations indirect to their long versions. Previously a
shorthand (e.g. -.) looked up its name (dashDot) to get an articulation
name (staccato), and then created a new ArticulationEvent with that
name, ignoring the existing global (staccato). This meant changes to
the long names (such as adding properties) didn't affect the shorthand.

Now it looks up the articulation name to get the existing
ArticulationEvent.
This makes c-. behave exactly like c\staccato.

Please review this at https://codereview.appspot.com/26470047/

Affected files (+106, -31 lines):
  M lily/audio-item.cc
  M lily/drum-note-performer.cc
  M lily/include/audio-item.hh
  M lily/midi-item.cc
  M lily/note-performer.cc
  M lily/parser.yy
  M ly/music-functions-init.ly
  M ly/script-init.ly
  M scm/define-context-properties.scm
  M scm/define-music-properties.scm
  M scm/music-functions.scm



reply via email to

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