note-logic: Relational operators for noteworthy class

note-logicR Documentation

Relational operators for noteworthy class

Description

Relational operators for comparing two noteworthy class objects.

Usage

## S3 method for class 'noteworthy'
e1 == e2

## S3 method for class 'noteworthy'
e1 != e2

## S3 method for class 'noteworthy'
e1 < e2

## S3 method for class 'noteworthy'
e1 <= e2

## S3 method for class 'noteworthy'
e1 > e2

## S3 method for class 'noteworthy'
e1 >= e2

Arguments

e1

noteworthy string.

e2

noteworthy string.

Details

Equality is assessed in the same manner as used for note_sort() when sorting pitches. What matters is the underlying semitone value associated with each pitch, not the string notation such as flat vs. sharp (see pitch_is_identical()). When comparing chords, or a chord vs. a single note, comparison favors the root. Comparison is made of the respective lowest pitches, then proceeds to the next pitch if equal.

For these operators, the objects on the left and right side of the operator must both be noteworthy or an error is returned.

The examples include a chord with its pitches entered out of pitch order. This does not affect the results because pitches within chords are sorted before note to note comparisons at each timestep are done between e1 and e2.

Value

logical vector

Examples

x <- as_noteworthy("f# a d'f#'a' d'f#'a'")
y <- as_noteworthy("g_ b f#'a'd' d'd''")
x == y
x != y
x < y
x > y
x <= y
x >= y

leonawicz/tabr documentation built on Sept. 24, 2023, 2:49 p.m.