octave {ProTrackR}R Documentation

Extract or replace an octave

Description

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

Usage

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

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

## S4 replacement method for signature 'PTCell,numeric'
octave(x) <- value

Arguments

x

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

value

A numeric value representing the octave number with which that of object x needs to be replaced. 0, 1 and 3 are valid octave numbers. Use zero to disable both the note and octave for object x.

Note that the octave can only be set for PTCells for which a note is already defined.

Details

Period values are used by ProTracker to set a playback sample rate and in essence determine the key and octave in which a sound is played. This method can be used to obtain the octave number 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 octave number associated with the period closest to this value in the table is returned.

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

Value

For octave, a numeric value representing the octave number is returned.

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

Author(s)

Pepijn de Vries

See Also

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

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

Examples

data("mod.intro")

## get the octave number of PTCell at pattern #3, track #2,
## row #1 from mod.intro (which is number 3):

octave(PTCell(mod.intro, 1, 2, 3))

## replace the octave number of PTCell at pattern #3, track #2,
## row #1 from mod.intro with 2:

octave(PTCell(mod.intro, 1, 2, 3)) <- 2

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

octave(200:400)

[Package ProTrackR version 0.4.3 Index]