Skip to contents

Obtain a note from a period value or extract or replace a note of a PTCell object.

Usage

# S4 method for numeric
note(x)

# S4 method for PTCell
note(x)

# S4 method for PTCell,character
note(x) <- value

Arguments

x

Either a (vector of) numeric value(s), representing a period value. It can also be a PTCell object.

value

A character string representing the chromatic scale note with wich the current note needs to be replaced. Should have any of the folling values: "C-", "C#", "D-", "D#", "E-", "F-", "F#", "G-", "G#", "A-", "A#", "B-", or "--". Right-hand dashes can be omitted from these strings. Both upper and lower case are accepted.

If an octave is not yet specified for PTCell x, it will be set to 1.

Assigning a value of "--" will remove both the note and octave from object x.

Value

For note, a character string representing the note is returned.

For note<-, a copy of PTCell object x in which the note is replaced by value is returned.

Details

Period values are used by ProTracker to set a playback sample rate and in essence determine the key in which a sound is played. This method can be used to obtain the note (key) associated with a period value (according to the ProTracker period_table, assuming zero fineTune). If the period value is not in the period_table, the note associated with the period closest to this value in the table is returned.

The note can also be obtained or replaced for a PTCell object.

See also

Other period.operations: noteToPeriod(), octave(), periodToChar(), period_table, sampleRate

Other note.and.octave.operations: noteToPeriod(), noteUp(), octave(), periodToChar(), sampleRate

Other cell.operations: PTCell-class, PTCell-method, effect(), sampleNumber()

Author

Pepijn de Vries

Examples

data("mod.intro")

## get the note of PTCell at pattern #3, track #2,
## row #1 from mod.intro (which is note "C-"):

note(PTCell(mod.intro, 1, 2, 3))
#> [1] "C-"

## replace the note of PTCell at pattern #3, track #2,
## row #1 from mod.intro with "A-":

note(PTCell(mod.intro, 1, 2, 3)) <- "A-"

## get the notes associated with the period
## values 200 up to 400:

note(200:400)
#>   [1] "D-" "C#" "C#" "C#" "C-" "C#" "C#" "C#" "C-" "C-" "C-" "C-" "C#" "C-" "C-"
#>  [16] "C-" "C-" "C-" "C-" "C-" "C-" "B-" "B-" "C-" "B-" "B-" "B-" "B-" "B-" "B-"
#>  [31] "B-" "B-" "B-" "A#" "A#" "A#" "A#" "A#" "B-" "A#" "A#" "A#" "A#" "A#" "A#"
#>  [46] "A#" "A#" "A-" "A-" "A-" "A-" "A-" "A-" "A-" "A-" "A-" "A-" "A-" "A-" "A-"
#>  [61] "A-" "A-" "G#" "G#" "G#" "G#" "G#" "G#" "G#" "G#" "G#" "G#" "G#" "G#" "G#"
#>  [76] "G#" "G#" "G#" "G-" "G-" "G-" "G-" "G-" "G-" "G-" "G-" "G-" "G-" "G-" "G-"
#>  [91] "G-" "G-" "G-" "G-" "F#" "F#" "F#" "F#" "F#" "F#" "F#" "F#" "F#" "F#" "F#"
#> [106] "F#" "F#" "F#" "F#" "F#" "F#" "F-" "F-" "F-" "F-" "F-" "F-" "F-" "F-" "F-"
#> [121] "F-" "F-" "F-" "F-" "F-" "F-" "F-" "F-" "F-" "F-" "E-" "E-" "E-" "E-" "E-"
#> [136] "E-" "E-" "E-" "E-" "E-" "E-" "E-" "E-" "E-" "E-" "E-" "E-" "E-" "E-" "D#"
#> [151] "D#" "D#" "D#" "D#" "D#" "D#" "D#" "D#" "D#" "D#" "D#" "D#" "D#" "D#" "D#"
#> [166] "D#" "D#" "D#" "D#" "D#" "D-" "D-" "D-" "D-" "D-" "D-" "D-" "D-" "D-" "D-"
#> [181] "D-" "D-" "D-" "D-" "D-" "D-" "D-" "D-" "D-" "D-" "D-" "D-" "C#" "C#" "C#"
#> [196] "C#" "C#" "C#" "C#" "C#" "C#"