note: Extract or replace a note

noteR Documentation

Extract or replace a note

Description

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

Usage

## S4 method for signature 'numeric'
note(x)

## S4 method for signature 'PTCell'
note(x)

## S4 replacement method for signature '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.

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.

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.

Author(s)

Pepijn de Vries

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()

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))

## 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)


ProTrackR documentation built on Aug. 23, 2023, 1:07 a.m.