[Top][All Lists]

[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: H. S. Teoh
Subject: Re: How should I convert an existing ".ly" file to a MIDI file containing audible arpeggios?
Date: Fri, 4 Dec 2020 22:30:16 -0800

On Sat, Dec 05, 2020 at 06:34:52AM +0100, Petr Pařízek wrote:
>    On 5.12.2020 1:07, Knute Snortum wrote:
>      > I'm confused.  Why doesn't the notation create arpeggios in MIDI?  
>      The \arpeggio command only prints the relevant symbols in the
>      notated score (i.e. in the PDF output) but does not have any
>      effect on the MIDI file.
>      The final part of the documentation on "Ties" contains a snippet
>      that explains that written-out arpeggios can be typed more
>      efficiently by applying the "tieWaitForNote" property and then
>      reseting it again:
> [1]
>      But I can't imagine rewriting it manually for every single
>      arpeggiated chord of my original file, considering how many they
>      are there. I'd love to find a way of automating this process but
>      I don't know how I would do that.

Some time ago I wrote a little .ly snippet to generate midi arpeggios
(see attached).  It takes a number N and a chord, and generates an
arpeggio where the start of each subsequent note of the chord (in the
order they are spelled in the input) is delayed from the previous note
by a duration equal to the length of the chord divided into N units.
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. By
varying the first argument you can control how fast the chord is rolled
(useful for adapting the generated midi to the current tempo of the
music so that it doesn't sound too fast or too slow).

Unfortunately, the output will look like a horrendous mess if you
typeset it; so I usually use it in a midi-only score tagged by #'midi,
with a layout-only score tagged by #'layout that uses lilypond's
built-in \arpeggio command, e.g., something like this:

        \include ""
        myMusic = {
                \tag #'layout { <c e g c>\arpeggio }
                \tag #'midi { \midiArpeggio 24 <c e g c> }

        % This score is for printing only
        \score {
                \removeWithTag #'midi \myMusic
                \layout {}

        % This score is for generating midi
        \score {
                \removeWithTag #'layout \myMusic
                \midi {}


My program has no bugs! Only unintentional features...

Description: Text Data

reply via email to

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