k...@aspodata.se writes:

> 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

The patch is pretty awful.  I think we'd rather want this value to be
read from some \midi layout block variable when Midi is getting
initialized.

By the way, that value is also written out in the SMF file header (which
you don't appear to do).  This is initialized in

lily/performance.cc:  midi_stream.write (Midi_header (1, tracks_, 384));

and changing MIDI_CLOCK elsewhere but not here is going to wreak serious
havoc.

-- 
David Kastrup

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to