lilypond-user
[Top][All Lists]
Advanced

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

Re: How should I convert an existing ".ly" file to a MIDI file containin


From: Thomas Morley
Subject: Re: How should I convert an existing ".ly" file to a MIDI file containing audible arpeggios?
Date: Sat, 5 Dec 2020 13:38:38 +0100

Am Sa., 5. Dez. 2020 um 13:17 Uhr schrieb Petr Pařízek
<petrparizek2000@yahoo.com>:
>
> H. S. Teoh wrote:
>
>  > For example:
>  >
>  >         \midiArpeggio 24 <c e g c>4
>  >
>  > divides a quarter note into 24 units, and plays the first c on-beat, the
>  > e 1/24th of a quarter note past the beat, g 2/24th of a quarter note
>  > past the beat, and the last c 3/24th of a quarter note past the beat.
>
> Thanks for sharing.
> Unfortunately, if I wanted to convert an existing ".ly" file either from
> one that uses \arpeggio to one that uses \midiArpeggio or vice versa, I
> still couldn't do it with a tool like some sort of "Find and replace".
> Unlike \arpeggio which is given after the notes of the chord,
> \midiArpeggio needs to be used before them. So I'm afraid I would still
> have to rewrite it manually for each single chord. And if I wanted to
> avoid doing it all manually, I would have to know how to write code that
> would do it for me (which I have no idea which programming language
> would be the most appropriate for doing something of that sort).
>
> Petr
>
>
>
> --
> Tento e-mail byl zkontrolován na viry programem AVG.
> http://www.avg.cz
>
>

Amending the shared code, you could probably do

getMidiArpeggios =
#(define-music-function (val mus) (number? ly:music?)
  (map-some-music
    (lambda (m)
      (and (music-is-of-type? m 'event-chord)
           (any
             (lambda (elt)
               (eq? (ly:music-property elt 'name) 'ArpeggioEvent))
             (ly:music-property m 'elements))
           (midiArpeggio val  m)))
    mus))

\getMidiArpeggios 24
\new Staff \relative c' {
  <c e g c>4\arpeggio
  r2.
  |
  <c e g c>2
  <c e g c>\arpeggio
}

HTH,
  Harm



reply via email to

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