This function can be used to simplify the LilyPond syntax of a phrase. Not intended for direct use. See details.
simplify_phrase(phrase)
character
This function not intended to be used directly, but is available so that you
can see how LilyPond syntax for phrases will be transformed by default in
the process of creating a LilyPond file. This function is used by the
lilypond()
function and associated render_*
functions. When using
lilypond()
directly, this can be controlled by the simplify
argument.
The result of this function is a character string containing simpler, more
efficient LilyPond syntax. It can be coerced back to a phrase with
as_phrase()
, but its print method colors will no longer display properly.
More importantly, this simplification removes any possibility of transforming
the phrase back to its original inputs. The more complex but nicely
structured original representation does a better job at maintaining
reasonable possibility of one to one transformation between a phrase object
and the inputs that it was built from.
notes <- "a~ a b c' c'e'g'~ c'e'g'"
info <- "8.. 8..-. 8- 8-^ 4.^ 4."
(x <- p(notes, info))
#> <Musical phrase>
#> <a~>8.. <a>8..-. <b>8\glissando <c'>8-^ <c'~ e'~ g'~>4.\bendAfter #+6 <c' e' g'>4.
as_phrase(simplify_phrase(x))
#> <Musical phrase>
#> a8..~ a-. b8\glissando c'-^ <c' e' g'>4.~\bendAfter #+6 <c' e' g'>
(x <- p(notes, info, 5))
#> <Musical phrase>
#> <a~\5>8.. <a\5>8..-. <b\5>8\glissando <c'\5>8-^ <c'~\5 e'~\4 g'~\3>4.\bendAfter #+6 <c'\5 e'\4 g'\3>4.
as_phrase(simplify_phrase(x))
#> <Musical phrase>
#> a8..~\5 a\5-. b8\5\glissando c'\5-^ <c'\5 e'\4 g'\3>4.~\bendAfter #+6 <c'\5 e'\4 g'\3>