Frammenti LilyPond: Simultaneous notes

# Simultaneous notes

Simultaneous notes

## Voci ulteriori per evitare le collisioni

In alcuni casi di musica polifonica complessa sono necessarie delle voci ulteriori per evitare le collisioni tra note. Se servono più di quattro voci parallele, si possono aggiungere altre voci definendo una variabile con la funzione Scheme function `context-spec-music`.

    voiceFive = #(context-spec-music (make-voice-props-set 4) 'Voice)

    \relative c'' {
      \time 3/4
      \key d \minor
      \partial 2
      <<
        \new Voice  {
          \voiceOne
          a4. a8
          e'4 e4. e8
          f4 d4. c8
        }
        \new Voice {
          \voiceTwo
          d,2
          d4 cis2
          d4 bes2
        }
        \new Voice {
          \voiceThree
          f'2
          bes4 a2
          a4 s2
        }
        \new Voice {
          \voiceFive
          s2
          g4 g2
          f4 f2
        }
      >>
    }

## Changing a single note’s size in a chord

Individual note heads in a chord can be modified with the `\tweak` command inside a chord, by altering the `font-size` property.

Inside the chord (within the brackets `< >`), before the note to be altered, place the `\tweak` command, followed by `font-size` and define the proper size like `#-2` (a tiny note head).

    \relative c' {
      <\tweak font-size #+2 c e g c
       \tweak font-size #-2 e>1
       ^\markup { A tiny e }_\markup { A big c }
    }

## Modificare le indicazioni testuali di partCombine

Quando si usa la funzionalità di combinazione automatica delle parti, si può modificare il testo delle sezioni soliste e dell’unisono:

    \new Staff <<
      \set Staff.soloText = #"girl"
      \set Staff.soloIIText = #"boy"
      \set Staff.aDueText = #"together"
      \partCombine
        \relative c'' {
          g4 g r r
          a2 g
        }
        \relative c'' {
          r4 r a( b)
          a2 g
        }
    >>

## Clusters

Clusters are a device to denote that a complete range of notes is to be played.

    fragment = \relative c' {
      c4 f <e d'>4
      <g a>8 <e a> a4 c2 <d b>4
      e2 c
    }

    <<
      \new Staff \fragment
      \new Staff \makeClusters \fragment
    >>

## Combinare due parti sullo stesso rigo

Lo strumento di unione delle parti (il comando `\partCombine`) permette di combinare varie parti sullo stesso rigo. Indicazioni testuali come “solo” e “a2” sono aggiunte automaticamente; per toglierele basta impostare la proprietà `printPartCombineTexts` su `f`. Per le partiture vocali (inni), non c’è bisogno di aggiungere i testi “solo/a2”, quindi dovrebbero essere disattivati. Tuttavia potrebbe convenire non usarlo se c’è una qualche parte solista, perché non verrebbe indicata. In tali casi è preferibile usare la notazione polifonica normale.

Questo frammento illustra i tre modi con cui due parti possono essere stampate su uno stesso rigo: normale polifonia, `\partCombine` senza testo e `\partCombine` con testo.

    %% Combining pedal notes with clef changes

    musicUp = \relative c'' {
      \time 4/4
      a4 c4.( g8) a4 |
      g4 e' g,( a8 b) |
      c b a2.
    }

    musicDown = \relative c'' {
      g4 e4.( d8) c4 |
      r2 g'4( f8 e) |
      d2 \stemDown a
    }

    \score {
        <<
        \new Staff \with { instrumentName = "Standard polyphony" }

          << \musicUp \\ \musicDown >>

        \new Staff \with {
          instrumentName = "PartCombine without text"
          printPartCombineTexts = ##f
        }

        \partCombine \musicUp \musicDown

        \new Staff \with { instrumentName = "PartCombine with text" }
          \partCombine \musicUp \musicDown
        >>
      \layout {
        indent = 6.0\cm
        \context {
          \Score
          \override SystemStartBar.collapse-height = #30
        }
      }
    }

## Displaying complex chords

Here is a way to display a chord where the same note is played twice with different accidentals.

    fixA = {
      \once \override Stem.length = #11
    }

    fixB = {
      \once \override NoteHead.X-offset = #1.7
      \once \override Stem.length = #7
      \once \override Stem.rotation = #'(45 0 0)
      \once \override Stem.extra-offset = #'(-0.1 . -0.2)
      \once \override Flag.style = #'no-flag
      \once \override Accidental.extra-offset = #'(4 . -.1)
    }

    \relative c' {
      << { \fixA <b d!>8 } \\ { \voiceThree \fixB dis } >> s
    }

## Forzare lo spostamento orizzonatale delle note

Quando il motore tipografico non riesce a risolvere una situazione, si può usare la sintassi che sovrascrive le decisioni tipografiche. L’unità di misura usata è lo spazio del rigo.

    \relative c' <<
      {
        <d g>2 <d g>
      }
      \\
      {
        <b f'>2
        \once \override NoteColumn.force-hshift = #1.7
        <b f'>2
      }
    >>

## Making an object invisible with the ’transparent property

Setting the `transparent` property will cause an object to be printed in “invisible ink”: the object is not printed, but all its other behavior is retained. The object still takes up space, it takes part in collisions, and slurs, ties and beams can be attached to it.

This snippet demonstrates how to connect different voices using ties. Normally, ties only connect two notes in the same voice. By introducing a tie in a different voice, and blanking the first up-stem in that voice, the tie appears to cross voices.

    \relative {
      \time 2/4
      <<
        {
          \once \hide Stem
          \once \override Stem.length = #8
          b'8 ~ 8\noBeam
          \once \hide Stem
          \once \override Stem.length = #8
          g8 ~ 8\noBeam
        }
        \\
        {
          b8 g g e
        }
      >>
    }

## Spostare le note puntate in polifonia

Quando una nota puntata della voce più alta viene spostata per evitare una collisione con una nota di un’altra voce, il comportamento predefinito è spostare la nota più alta a destra. Tale comportamento può essere modificato tramite la proprietà `prefer-dotted-right` di `NoteCollision`.

    \new Staff \relative c' <<
      {
        f2. f4
        \override Staff.NoteCollision.prefer-dotted-right = ##f
        f2. f4
        \override Staff.NoteCollision.prefer-dotted-right = ##t
        f2. f4
      }
      \\
      { e4 e e e e e e e e e e e }
    >>

## Suppressing warnings for clashing note columns

If notes from two voices with stems in the same direction are placed at the same position, and both voices have no shift or the same shift specified, the error message ‘`warning: ignoring too many clashing note columns`’ will appear when compiling the LilyPond file. This message can be suppressed by setting the `'ignore-collision` property of the `NoteColumn` object to `#t`. Please note that this does not just suppress warnings but stops LilyPond trying to resolve collisions at all and so may have unintended results unless used with care.

    ignore = \override NoteColumn.ignore-collision = ##t

    \relative c' {
      \new Staff <<
        \new Voice { \ignore \stemDown f2 g }
        \new Voice { c2 \stemDown c, }
      >>
    }

## Two \partCombine pairs on one staff

The `\partCombine` function takes two music expressions each containing a part, and distributes them among four `Voice`s named “two” “one” “solo” and “chords” depending on when and how the parts merged into a common voice. The voices output from `\partCombine` can have their layout properties adjusted in the usual way. Here we define extensions of `\partCombine` to make it easier to put four voices on a staff.

    soprano = { d'4 | cis'  b  e'  d'8 cis' | cis'2 b }
    alto = { fis4 | e8 fis gis ais b4 b | b ais fis2 }
    tenor = { a8 b | cis' dis' e'4 b8 cis' d'4 | gis cis' dis'2 }
    bass = { fis8 gis | a4 gis g fis | eis fis b,2 }

    \new Staff <<
      \key b\minor
      \clef alto
      \partial 4
      \transpose b b'
      \partCombineUp \soprano \alto
      \partCombineDown \tenor \bass
    >>

    \layout {
      \context {
        \Staff
        \accepts "VoiceBox"
      }
      \context {
        \name "VoiceBox"
        \type "Engraver_group"
        \defaultchild "Voice"
        \accepts "Voice"
        \accepts "NullVoice"
      }
    }

    customPartCombineUp =
    #(define-music-function (partOne partTwo)
      (ly:music? ly:music?)
    "Take the music in @var{partOne} and @var{partTwo} and return
    a @code{VoiceBox} named @q{Up} containing @code{Voice}s
    that contain @var{partOne} and @var{partTwo} merged into one
    voice where feasible.  This variant sets the default voicing
    in the output to use upward stems."
    #{
      \new VoiceBox = "Up" <<
        \context Voice = "one" { \voiceOne }
        \context Voice = "two" { \voiceThree }
        \context Voice = "shared" { \voiceOne }
        \context Voice = "solo" { \voiceOne }
        \context NullVoice = "null" {}
        \partCombine #partOne #partTwo
      >>
    #})

    customPartCombineDown = #
    (define-music-function (partOne partTwo)
      (ly:music? ly:music?)
    "Take the music in @var{partOne} and @var{partTwo} and return
    a @code{VoiceBox} named @q{Down} containing @code{Voice}s
    that contain @var{partOne} and @var{partTwo} merged into one
    voice where feasible.  This variant sets the default voicing
    in the output to use downward stems."
    #{
      \new VoiceBox = "Down" <<
        \set VoiceBox.soloText = #"Solo III"
        \set VoiceBox.soloIIText = #"Solo IV"
        \context Voice ="one" { \voiceFour }
        \context Voice ="two" { \voiceTwo }
        \context Voice ="shared" { \voiceFour }
        \context Voice ="solo" { \voiceFour }
        \context NullVoice = "null" {}
        \partCombine #partOne #partTwo
      >>
    #})

    soprano = { d'4 | cis'  b  e'  d'8 cis' | cis'2 b }
    alto = { fis4 | e8 fis gis ais b4 b | b ais fis2 }
    tenor = { a8 b | cis' dis' e'4 b8 cis' d'4 | gis cis' dis'2 }
    bass = { fis8 gis | a4 gis g fis | eis fis b,2 }

    \new Staff <<
      \key b\minor
      \clef alto
      \partial 4
      \transpose b b'
      \customPartCombineUp \soprano \alto
      \customPartCombineDown \tenor \bass
    >>

#### LilyPond — Frammenti v2.22.2 (ramo stabile).