octToFreq: Convert from csound-style oct notation for pitches to...

Description Usage Arguments Details Value See Also Examples

Description

This function converts from the ‘oct’ notation notation for pitches, where 8 is middle C and 1 represents an octave, to the corresponding frequency in Hertz.

Usage

1
  octToFreq(oct)

Arguments

oct

A numeric of length 1, which is a pitch in ‘oct’ notation

Details

Most users of playitbyr will not need this function, but those wishing to make add-ons may find it useful.

The conversion to Hertz is quite simple:

1
440*2^(oct-8.75)

where oct is the input value. Note that both 440 Hz and 8.75 are tuning A.

Value

A numeric value of length 1, which is a frequency in Hertz.

See Also

sonaes

Examples

1
2
3
4
5
6
7
8
## In oct, middle c is 8
octToFreq(8)

## An octave below tuning A, in Hz
octToFreq(7.75)

## A little more than that, in Hz
octToFreq(7.76)

playitbyr documentation built on May 2, 2019, 6:08 p.m.