Line {gm} | R Documentation |
Create Line
Object
Description
Create a Line
object.
Line
objects represent musical lines.
Usage
Line(
pitches,
durations,
tie = NULL,
name = NULL,
as = NULL,
to = NULL,
after = NULL,
bar = NULL,
offset = NULL
)
Arguments
pitches |
A list whose members are
|
durations |
A list whose members are
|
tie |
Optional. A list of indices of argument |
name |
Optional. A single character to name the |
as |
Optional. "part", "staff" or "voice", to specify the state
of the |
to |
Optional. An index or a |
after |
Optional. A single logical which indicates whether to add the
|
bar |
Optional. A positive integer which indicates the number of
the measure to which to insert the |
offset |
Optional. A duration value, sum of duration values or 0,
which indicates the position in a measure, at which to insert the |
Value
A list with class Line
.
See Also
+.Music()
for adding Line
objects to a Music
object.
vignette("gm", package = "gm")
for more details about Line
objects.
Examples
# 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
# add the Line object to the Music object
m <- m + l
m
if (interactive()) {
show(m)
}