lilypond-user
[Top][All Lists]
Advanced

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

Re: MIDI tick resolution


From: David Kastrup
Subject: Re: MIDI tick resolution
Date: Mon, 19 Mar 2018 14:59:15 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

address@hidden 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



reply via email to

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