Skip to contents

These functions return the note and octave that is closest to the provided period value.

Usage

periodToChar(period)

Arguments

period

integer value of a period value.

Value

periodToChar returns a character representing the combination of octave and note that is closest to period in the ProTracker period table.

Details

ProTracker uses a period_table to link period values to certain octaves and notes. This function serves to look up corresponding notes and octaves for specific period values.

See also

Other character.operations: as.character(), name, rawToCharNull(), sampleRate

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

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

Author

Pepijn de Vries

Examples

## Note C# in octave 3 is closest to a period of 200 in the table:
periodToChar(200)
#> [1] "D-3"
## try with a range of period values:
periodToChar(200:400)
#>   [1] "D-3" "C#3" "C#3" "C#3" "C-3" "C#3" "C#3" "C#3" "C-3" "C-3" "C-3" "C-3"
#>  [13] "C#3" "C-3" "C-3" "C-3" "C-3" "C-3" "C-3" "C-3" "C-2" "B-2" "B-2" "C-3"
#>  [25] "B-2" "B-2" "B-2" "B-2" "B-2" "B-2" "B-2" "B-2" "B-2" "A#2" "A#2" "A#2"
#>  [37] "A#2" "A#2" "B-2" "A#2" "A#2" "A#2" "A#2" "A#2" "A#2" "A#2" "A#2" "A-2"
#>  [49] "A-2" "A-2" "A-2" "A-2" "A-2" "A-2" "A-2" "A-2" "A-2" "A-2" "A-2" "A-2"
#>  [61] "A-2" "A-2" "G#2" "G#2" "G#2" "G#2" "G#2" "G#2" "G#2" "G#2" "G#2" "G#2"
#>  [73] "G#2" "G#2" "G#2" "G#2" "G#2" "G#2" "G-2" "G-2" "G-2" "G-2" "G-2" "G-2"
#>  [85] "G-2" "G-2" "G-2" "G-2" "G-2" "G-2" "G-2" "G-2" "G-2" "G-2" "F#2" "F#2"
#>  [97] "F#2" "F#2" "F#2" "F#2" "F#2" "F#2" "F#2" "F#2" "F#2" "F#2" "F#2" "F#2"
#> [109] "F#2" "F#2" "F#2" "F-2" "F-2" "F-2" "F-2" "F-2" "F-2" "F-2" "F-2" "F-2"
#> [121] "F-2" "F-2" "F-2" "F-2" "F-2" "F-2" "F-2" "F-2" "F-2" "F-2" "E-2" "E-2"
#> [133] "E-2" "E-2" "E-2" "E-2" "E-2" "E-2" "E-2" "E-2" "E-2" "E-2" "E-2" "E-2"
#> [145] "E-2" "E-2" "E-2" "E-2" "E-2" "D#2" "D#2" "D#2" "D#2" "D#2" "D#2" "D#2"
#> [157] "D#2" "D#2" "D#2" "D#2" "D#2" "D#2" "D#2" "D#2" "D#2" "D#2" "D#2" "D#2"
#> [169] "D#2" "D#2" "D-2" "D-2" "D-2" "D-2" "D-2" "D-2" "D-2" "D-2" "D-2" "D-2"
#> [181] "D-2" "D-2" "D-2" "D-2" "D-2" "D-2" "D-2" "D-2" "D-2" "D-2" "D-2" "D-2"
#> [193] "C#2" "C#2" "C#2" "C#2" "C#2" "C#2" "C#2" "C#2" "C#2"