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

noteFromFF

Deriving notes from frequencies


Description

Deriving notes from given (fundamental) frequencies.

Usage

noteFromFF(x, diapason = 440, roundshift = 0)

Arguments

x

Fundamental frequency.

diapason

Frequency of diapason a, default is 440 (Hertz).

roundshift

Shift that indicates from here to round to the next integer (note). The default (0) is “classical” rounding as described in round. A higher value means that roundshift is added to the calculated real note value before rounding to an integer. This is useful if it is unclear that some instruments really shift the note in the center between two theoretical frequencies.

Example: if x = 452 and diapason = 440, the internally calculated real value of 0.46583 is rounded to 0, but for roundshift = 0.1 we get 0.56583 and it is rounded to note 1.

Details

The formula used is simply round(12 * log(x / diapason, 2) + roundshift).

Value

An integer representing the (rounded) difference in halftones from diapason a, i.e. indicating the note that corresponds to fundamental frequency x given the value of diapason. For example: 0 indicates diapason a, 3: c', 12: a', ...

Author(s)

See Also

FF, periodogram, and tuneR for a very complete example.


tuneR

Analysis of Music and Speech

v1.3.3
GPL-2 | GPL-3
Authors
Uwe Ligges <ligges@statistik.tu-dortmund.de> with contributions from Sebastian Krey, Olaf Mersmann, Sarah Schnackenberg, Guillaume Guenard, Andrea Preusser, Anita Thieler, Johanna Mielke and Claus Weihs, as well as code fragments and ideas from the former package 'sound' by Matthias Heymann and functions from 'rastamat' by Daniel P. W. Ellis. The included parts of the libmad MPEG audio decoder library are authored by Underbit Technologies.
Initial release
2018-07-03

We don't support your browser anymore

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