lilypond-user
[Top][All Lists]
Advanced

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

Re: Adding metronome click track to MIDI


From: Francesco Petrogalli
Subject: Re: Adding metronome click track to MIDI
Date: Wed, 3 Jun 2020 22:43:33 -0500

Robin, Valentin,

thank you both for your help. I have created a solution based on your
examples. I hope you don't mind the copy and paste + tweak exercise,
as I am assuming that you are happy for me to give a CC BY SA 4.0
license to code that is based on the examples you have published in
the mailing list. FWIW, I have credited both of you in the commit
messages. Please let me know if my assumption is correct. Conversely,
if you rather not have this code included in the source of this open
source project, I will remove it and try to find an alternative
solution. [*]

The code that works for me is the following, I will merge it when I
get an "OK go" from both of you:

https://github.com/fpetrogalli/trr/pull/1/files

The `unfold 83` is a bit ugly, but it allows me to obtain what I need
without having to dig into lilypond internals and scheme syntax.

Kind regards,

Francesco

[*] Admittedly, I should have dont this the other way around, first
ask about using your code, and then including it into my project on
github. Hopefully what I have done, although not formally correct, is
in line with the open source spirit of the lilypond community in terms
of sharing snippets and examples.

On Wed, Jun 3, 2020 at 11:04 AM Valentin Villenave
<valentin@villenave.net> wrote:
>
> On 6/3/20, Francesco Petrogalli <francesco.petrogalli@gmail.com> wrote:
> > Is there a special midi instrument I could use for that?
>
> Not that I know.
> BTW, here’s a quick-and-dirty way of adding a click track, in case you
> might find it useful:
>
> %%%%%%
>
> addTicks =
> #(define-music-function (m) (ly:music?)
>    #{ << $m
>          \new Devnull \with {
>            \consists Drum_note_performer
>            \consists Staff_performer
>            \consists Dynamic_performer
>            midiInstrument = #"woodblock"
>          } \drummode {
>            <>\ff \repeat unfold
>            $(ly:moment-main-numerator
>              (ly:moment-div
>               (ly:music-length m)
>               (ly:make-moment 1 4)))
>            rb4 }>> #})
>
> music = \relative  c' { c2 d e f g a b c }
>
> \score {
>   \new Staff \addTicks \music
>   \layout {}
>   \midi {}
> }
>
> %%%%
>
> Cheers,
> -- V.



reply via email to

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