Returns which octave each pitch falls in.
By default, middle-C is the bottom of the zeroth-octave, but this can be changed with the octave.offset
argument.
Other octave labels (like lilypond()
-style marks) can be used if you set octave.integer = FALSE
.
Arguments
- x
Input data to parse as pitch information.
The
x
argument can be any (atomic) vector, or a tonalInterval, orNULL
.- ...
Arguments passed to the pitch deparser.
There are also two hidden (advanced) arguments you can specify:
memoize
anddeparse
(see the details below).- generic
Should "specific" pitch information (accidentals and qualites) be discarded?
Defaults to
FALSE
.Must be a singleton
logical
value: an on/off switch.- simple
Should "compound" pitch information (octave/contour) be discarded?
Defaults to
FALSE
.Must be a singleton
logical
value: an on/off switch.- Key
The input
Key
used by the parser, deparser, and transposer.Defaults to
NULL
.Must be a
diatonicSet
or something coercable todiatonicSet
; must be either length1
orlength(x)
- transposeArgs
An optional list of arguments passed to a special
transpose()
call.Defaults to an empty
list()
.Must be a
list
of named arguments totranspose()
.- parseArgs
An optional list of arguments passed to the pitch parser.
Defaults to an empty
list()
.Must be a
list
of named arguments to the pitch parser.- inPlace
Should non-pitch information be retained in the output string.
Defaults to
FALSE
.Must be a singleton
logical
value: an on/off switch.This argument only has an effect if the input (the
x
argument) ischaracter
strings, and there is extra, non-pitch information in the input strings "besides" the pitch information. If so, andinPlace = TRUE
, the output will be placed into an output string beside the original non-pitch information. IfinPlace = FALSE
, only the pitch output information will be returned (details below).
Examples
if (FALSE) {
chorales <- readHumdrum(humdrumRroot, 'HumdrumData/BachChorales/.*krn')
within(chorales, octave(Token))
within(chorales, octave(Token, octave.offset = 4)) # traditional octaves
within(chorales, octave(Token, octave.integer = FALSE))
}