I guess this could be programmed with Scheme,

But there is a possibility to use regular expressions in a text editor or wordprocessor to extract sequentially the 1st then the 2nd voice.


        Search text
        Replace string
Left part of the chords
        <([^\s]+)\s[^\s]+>([0-9\.]*)
        \1\2
Right part of the chords
        <[^\s]+\s([^\s>]+)>([0-9\.]*)  \1\2

This regex extract the left part in <aaa bbb> and output it in the variable 1 (the first part in parenthesis), extract the duration after the chord (digits and dots) to add it in variable 2 (second group in parenthesis), Output string is \1\2 followed by a space.

Copy the sequence and select it, then one choses replace all on the selection.

Short explanation

 * \s means space
 * [^\s]+ means one or more characters which are not spaces
 * [0-9\.] means 0 or more characters which are digits or a dot.
 * (...) select a part as a variable for the output

An example I tried:

<c, e>4 <d f>4. <e g>8 <c c'>2


is transformed into

c,4 d4. e8 c2

then into

e4 f4. g8 c'2




Le 20.12.24 à 16:25, Knute Snortum a écrit :
On Fri, Dec 20, 2024 at 7:17 AM Kieren MacMillan <kie...@kierenmacmillan.info> 
wrote:

    Hi Frédéric,

    > I want to adapt a piano score for a small set of instruments. The
    > right hand is already written as a set of chords with 2 notes <a c'>
    > <b d'>... Is there a way to turn it into a set of 2 voices { a b } \\
    > { c' d' }?

    Maybe Frescobaldi has a function/script that does this?


Perhaps this is a job for python-ly?  (https://github.com/frescobaldi/python-ly?tab=readme-ov-file)

--
Knute Snortum


--
Silvain Dupertuis
Route de Lausanne 335
1293 Bellevue (Switzerland)
tél. +41-(0)22-774.20.67
portable +41-(0)79-604.87.52
web: silvain-dupertuis.org <https://perso.silvain-dupertuis.org>

Reply via email to