Learn R Programming

soundgen (version 2.7.4)

HzToNotes: Convert between Hz and notes

Description

Converts from Hz to musical notation like A4 - note A of the fourth octave above C0 (16.35 Hz).

Usage

HzToNotes(x, showCents = FALSE, A4 = 440)

notesToHz(x, A4 = 440)

Arguments

x

vector or matrix of frequencies or notes

showCents

if TRUE, show cents to the nearest notes (cent = 1/100 of a semitone)

A4

frequency of note A in the fourth octave (modern standard ISO 16 or concert pitch = 440 Hz)

Functions

  • notesToHz(): Convert notes to Hz

See Also

HzToOther

Examples

Run this code
HzToNotes(c(440, 293, 115, 16.35, 4))
notesToHz(c("A4", "D4", "A#2", "C0", "C-2"))

HzToNotes(c(440, 415, 80, 81), showCents = TRUE)
# 80 Hz is almost exactly midway (+49 cents) between D#2 and E2

# Baroque tuning A415, half a semitone flat relative to concert pitch A440
HzToNotes(c(440, 415, 16.35), A4 = 415)
notesToHz(c("A4", "D4", "A#2", "C0", "C-2"), A4 = 415)

Run the code above in your browser using DataLab