Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

sampleRate

Calculate the sample rate for a note or period value


Description

Calculate the sample rate for a note or a ProTracker period value.

Usage

noteToSampleRate(note = "C-3", finetune = 0, video = c("PAL", "NTSC"))

periodToSampleRate(period, video = c("PAL", "NTSC"))

Arguments

note

A character string representing a note for which the sample rate is to be calculated.

finetune

An integer value ranging from -8 up to 7. A value used to tune an audio sample.

video

The video mode used to calculate the sample rate. A character string that can have either the value 'PAL' or 'NTSC'. PAL is used by default.

period

A ProTracker integer value of a period value for which the sample rate is to be calculated.

Details

The timing on a Commodore Amiga depends on the video mode, which could be either 'PAL' or 'NTSC'. Therefore sample rates also depend on these modes. As the PAL is mostly used in Europe, and the Amiga was most popular in Europe, PAL is used by default.

Value

Returns the sample rate in samples per seconds.

Author(s)

Pepijn de Vries

See Also

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

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

Other sample.rate.operations: playSample()

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

Examples

## calculate the sample rate for a ProTracker period value of 200
periodToSampleRate(200)

## calculate the sample rate for a sample at note 'A-3'
noteToSampleRate("A-3")

## note that the NTSC video system gives a slightly different rate:
noteToSampleRate("A-3", video = "NTSC")

## fine tuning a sample will also give a slightly different rate:
noteToSampleRate("A-3", finetune = -1)

ProTrackR

Manipulate and Play 'ProTracker' Modules

v0.3.7
GPL-3
Authors
Pepijn de Vries [aut, cre, dtc]
Initial release
2020-02-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.