Create a Line
object.
Line
objects represent musical lines.
Line(
pitches,
durations,
tie = NULL,
name = NULL,
as = NULL,
to = NULL,
after = NULL,
bar = NULL,
offset = NULL
)
A list whose members are
single pitch notations, like "C4", to represent the pitch contents of notes,
single MIDI note numbers, like 60 or "60", also to represent the pitch contents of notes,
single NA
s to represent the pitch contents of rests, or
vectors of pitch notations and MIDI note numbers, like c("C4", "61")
,
to represent the pitch contents of chords.
A list whose members are
single duration notations or their abbreviations, like "quarter" or just "q",
single duration values, like 1, which is equivalent to "quarter", or
Duration
objects returned by tuplet()
, which is used to create
complex tuplets.
Optional. A list of indices of argument pitches
, which
indicates at which positions to add ties.
Optional. A single character to name the Line
object.
Optional. "part", "staff" or "voice", to specify the state
of the Line
object. The default value is "part".
Optional. An index or a Line
name, which indicates with which
Line
object as the reference to add the Line
object.
Optional. A single logical which indicates whether to add the
Line
object after or before a reference Line
object. The default value
is TRUE
.
Optional. A positive integer which indicates the number of
the measure to which to insert the Line
object. By default, a Line
object will be inserted to the first measure.
Optional. A duration value, sum of duration values or 0,
which indicates the position in a measure, at which to insert the Line
object. The default value is 0.
A list with class Line
.
+.Music()
for adding Line
objects to a Music
object.
vignette("gm", package = "gm")
for more details about Line
objects.
# create a Music object
m <- Music() + Meter(4, 4) + Line(list("C4"), list(8), name = "a")
# create a Line object
l <- Line(
pitches = list("C5", "C5", "C5"),
durations = list(1, 1, 1),
# tie the first two notes
tie = list(1),
# add the Line as a voice
as = "voice",
# with Line "a" as reference
to = "a",
# before Line "a"
after = FALSE,
# insert the Line to bar 2 with offset 1
bar = 2,
offset = 1
)
l
#> Line
#>
#> * of length 3
#> * of pitches C5, C5, C5
#> * of durations 1, 1, 1
#> * tied at position 1
#> * to be inserted in bar 2 with offset 1
#> * as a voice
#> * to be inserted before Line "a"
# add the Line object to the Music object
m <- m + l
m
#> Music
#>
#> Line 1
#>
#> * as part 1 staff 1 voice 1
#> * of length 3
#> * of pitches C5, C5, C5
#> * of durations 1, 1, 1
#> * tied at position 1
#> * to be inserted in bar 2 with offset 1
#>
#> Line 2
#>
#> * as part 1 staff 1 voice 2
#> * of length 1
#> * of pitch C4
#> * of duration 8
#> * of name "a"
#>
#> Meter 4/4
if (interactive()) {
show(m)
}