Giberto:
> Does anyone know if it possible to change the tick resolution of LilyPond's
> MIDI output to a value other than the default 384? One reason for wanting
> this change is due to the fact that 384 cannot be divided by 5 and so
> quintuplets on a crotchet are not precise. For instance, the default
> settings in my DAW of choice is 960.

It seems pretty hardcoded:
===============
In lily/audio-item.cc:

int
moment_to_ticks (Moment m)
{
  return int (moment_to_real (m) * 384 * 4);
}
===============
In lily/midi-walker.cc:

void
Midi_walker::do_start_note (Midi_note *note)
{
  Audio_item *ptr = items_[index_];
  assert (note->audio_ == ptr);
  int now_ticks = ptr->audio_column_->ticks ();
  int stop_ticks = int (moment_to_real (note->audio_->length_mom_) *
                        Real (384 * 4)) + now_ticks;
===============

You could try the attached rudimentary patch and recompile your
lilypond source, see if that solves your problem, and report back.

BTW,
 384 = 128 * 3
 960 =  64 * 3 * 5

Regards,
/Karl Hammar

-----------------------------------------------------------------------
Aspö Data
Lilla Aspö 148
S-742 94 Östhammar
Sweden
+46 173 140 57

diff --git a/lily/audio-item.cc b/lily/audio-item.cc
index a8a78199c7..cf5b827899 100644
--- a/lily/audio-item.cc
+++ b/lily/audio-item.cc
@@ -129,7 +129,7 @@ moment_to_real (Moment m)
 int
 moment_to_ticks (Moment m)
 {
-  return int (moment_to_real (m) * 384 * 4);
+  return int (moment_to_real (m) * MIDI_TICKS * 4);
 }
 
 void Audio_span_dynamic::set_end_moment (Moment mom)
diff --git a/lily/include/midi-item.hh b/lily/include/midi-item.hh
index 57bb2d4da2..a843abb855 100644
--- a/lily/include/midi-item.hh
+++ b/lily/include/midi-item.hh
@@ -23,6 +23,8 @@
 #include "audio-item.hh"
 #include "std-vector.hh"
 
+#define MIDI_TICKS 960
+
 string int2midi_varint_string (int i);
 
 /**
diff --git a/lily/midi-walker.cc b/lily/midi-walker.cc
index d9765c6814..1d1b3196f7 100644
--- a/lily/midi-walker.cc
+++ b/lily/midi-walker.cc
@@ -86,7 +86,7 @@ Midi_walker::do_start_note (Midi_note *note)
   assert (note->audio_ == ptr);
   int now_ticks = ptr->audio_column_->ticks ();
   int stop_ticks = int (moment_to_real (note->audio_->length_mom_) *
-                        Real (384 * 4)) + now_ticks;
+                        Real (MIDI_TICKS * 4)) + now_ticks;
   for (vsize i = 0; i < stop_note_queue.size (); i++)
     {
       /* if this pitch already in queue, and is not already ignored */
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to