lilypond-devel
[Top][All Lists]
Advanced

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

Re: Ritardandi and Accelerandi for MIDI


From: Michael Welsh Duggan
Subject: Re: Ritardandi and Accelerandi for MIDI
Date: Tue, 30 Aug 2005 23:47:16 -0400
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

Michael Welsh Duggan <address@hidden> writes:

> Han-Wen Nienhuys <address@hidden> writes:
>
>> Michael Welsh Duggan wrote:
>>> My only problem with this is the following:  It doesn't appear to
>>> allow a crescendo to happen throught a single note without some extra
>>> hackery added.  It would be better (IMHO) if we could emit
>>> Audio_dynamic events (or Audio_tempo events) at discrete quantum
>>> intervals.  It doesn't seem possible, however, to emit Audio_items at
>>> any moments other than those defined in the Music proper.
>>> Suggestions?  Maybe Audio_staff::audio_items_ can be a priority queue
>>> (by moment), allowing us to emit events out of order?
>>
>> Check out Global_context::sneaky_add_extra_time_moment()
>> It's the same mechanism that is used to maek sure that barlines always 
>> appear.
>
> Perfect.  I can definitely use this.  I'll see if I can't make the
> output for dynamic spanners happen on discrete quanta, and make a
> first stab at tempo spanners.

Here is a patch which inserts these extra moments for dynamic
spanners.  Work on tempo spanners proceeds apace.

Index: lily/span-dynamic-performer.cc
===================================================================
RCS file: /cvsroot/lilypond/lilypond/lily/span-dynamic-performer.cc,v
retrieving revision 1.41
diff -u -p -u -r1.41 span-dynamic-performer.cc
--- lily/span-dynamic-performer.cc      13 Aug 2005 21:35:22 -0000      1.41
+++ lily/span-dynamic-performer.cc      31 Aug 2005 03:43:52 -0000
@@ -9,6 +9,8 @@
 #include "performer.hh"
 #include "audio-item.hh"
 #include "music.hh"
+#include "duration.hh"
+#include "global-context.hh"
 
 /*
   TODO: fold this into 1 engraver: \< and \> should also stop when
@@ -159,6 +161,13 @@ Span_dynamic_performer::stop_translation
 
   span_events_[STOP] = 0;
   span_events_[START] = 0;
+
+  if (span_start_event_)
+    {
+      Duration *quant = unsmob_duration (get_property ("spanDynamicQuantum"));
+      Rational quantum = quant ? quant->get_length () : Rational (1, 16);
+      get_global_context ()->add_moment_to_process (now_mom () + quantum);
+    }
 }
 
 bool
Index: ly/performer-init.ly
===================================================================
RCS file: /cvsroot/lilypond/lilypond/ly/performer-init.ly,v
retrieving revision 1.54
diff -u -p -u -r1.54 performer-init.ly
--- ly/performer-init.ly        25 Aug 2005 16:20:04 -0000      1.54
+++ ly/performer-init.ly        31 Aug 2005 03:43:52 -0000
@@ -125,6 +125,7 @@
     instrumentEqualizer = #default-instrument-equalizer
     drumPitchTable = #(alist->hash-table midiDrumPitches)
     timing = ##t 
+    spanDynamicQuantum = #(ly:make-duration 4 0 1 1)
 }
 
 
Index: scm/define-context-properties.scm
===================================================================
RCS file: /cvsroot/lilypond/lilypond/scm/define-context-properties.scm,v
retrieving revision 1.51
diff -u -p -u -r1.51 define-context-properties.scm
--- scm/define-context-properties.scm   19 Aug 2005 10:13:08 -0000      1.51
+++ scm/define-context-properties.scm   31 Aug 2005 03:43:52 -0000
@@ -336,6 +336,9 @@ r1 r1*3 R1*3 \\\\property Score.skipBars
      (skipTypesetting ,boolean?
                      "When true, all no typesetting is done, speeding
 up the interpretation phase. This speeds up debugging large scores.")
+     (spanDynamicQuantum ,ly:duration? "When producing MIDI
+output for a (de)crescendo, volume change events will be produced
+at least as often as the given duration.")
      (soloIIText ,string? "text for begin of solo for voice ``two'' when 
part-combining.")
      (soloText ,string? "text for begin of solo when part-combining.")
      (squashedPosition ,integer? " Vertical position of
-- 
Michael Welsh Duggan
(address@hidden)

reply via email to

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