[Top][All Lists]

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

Re: detecting the start and end of a polyphonic passage from scheme

From: Maurits Lamers
Subject: Re: detecting the start and end of a polyphonic passage from scheme
Date: Wed, 1 Jul 2020 17:44:05 +0200

Hi all,

The way the staff is usually printed (through format and display) already gave 
me that idea, but it is good to see it confirmed.

Let me try to sketch my problem and perhaps you could help me find an answer on 
how to achieve it.
I am trying to find a way that I can serialize the voices and their content. 
The maximum size of the serialization block is a bar.
Within this bar, I need to be able to order voices from low to high or the 
other way around.
The polyphony in the serialization is indicated as either being full bar, 
partial bar or a combination of both.

My technique currently is to use (par) and (seq) to indicate parallel or 
sequential structures.
The example below would become something like this

(par (seq g1) (seq g'8 e'8 (par (seq a'8. g'16 f'8 e'16 f' g' f' e' d') (seq 
c'8 a d'8. c'16 b8 a16 b ))))

or by only describing the voices:

(par (seq "bottom") (seq "one" (par (seq "two") (seq "three")) )

The actual serialized output would then be (indicators between []) :

g'8 e'8 [start partial polyphony] a'8. g'16 f'8 e'16 f' g' f' e' d' 
[simultaneous voice start] c'8 a d'8. c'16 b8 a16 b [start full measure 
polyphony] g1

From the structure above it is doable to get to this serialization as the 
initialization order because the order of events will be

start of voice 1
start of voice 2
g'8 (voice 1)
g1 (voice 2)
e'8 (voice 1)
start of voice 3
start of voice 4

This allows me to "anchor" the partial bar polyphony to voice 1 as it is the 
last note.

I however realized that this approach is problematic in case the separation 
starts one eighth earlier, as it is no longer possible to find which voice is 
actually a partial bar 
polyphony or a whole bar.

Any kind of hierarchical info on those voices would have helped me make the 
separation properly. As it obviously doesn't work this way, I need a different 
I do see a solution which I saw before I took this approach, which is that I 
run rhythmically through the bar and "sort" the notes into the voices by 
keeping track of what sounds simultaneously. To be honest I have no clue how to 
do this. Moreover, there might be a better / easier way?

Thanks in advance,



> Op 1 jul. 2020, om 11:34 heeft Aaron Hill <> het 
> volgende geschreven:
> On 2020-07-01 2:07 am, Maurits Lamers wrote:
>> Follow up question: is there a way to know the "parent" of the voices
>> as they are defined in the code?
>> In the following example, I would like to determine that voice "two"
>> splits off from voice "one" without relying on the context-id.
>> (ly:context-parent ctx) gives me the staff, not the "parent voice"...
>> [...]
> If I am not mistaken, Voices do not form a hierarchy with each other.  The 
> parent context will always be some form of Staff.  Consider:
> %%%%
> \version "2.20.0"
> \new Voice = outer { e'8 g' \new Voice = inner { a'2 } b'4 }
> %%%%
> LilyPond syntax might make it appear as if one Voice is "inside" another, but 
> that is an illusion.  In reality, the two voices are in parallel with each 
> other.  The inlining of the inner Voice here only serves to keep the outer 
> Voice alive.
> Here is an alternate way to view the above:
> %%%%
> \version "2.20.0"
> {
>  \new Voice = outer { e'8 g' }
>  <<
>    \context Voice = outer { s2 }
>    \new Voice = inner { a'2 }
>  >>
>  \context Voice = outer { b'4 }
> }
> %%%%
> Hopefully it is more clear that the two Voices are siblings, not parent-child.
> -- Aaron Hill

reply via email to

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