hz2cent, cent2hz

From STX Wiki
Jump to navigationJump to search

Convert the elements of x from Hertz to Cent and vice versa.

Usage
hz2cent(x {, ref {, ofs}})
log2lin(x {, ref {, ofs}})
x
a scalar, vector or matrix
ref
the reference frequency in Hz; must be a positive number (default=440)
fac
a shift value in Cent; must be a number (default=0)
Result
The result r has the same type as x and contains the converted elements of x. The following conversion algorithms are used:
  • hz2cent: ri,j = 1200 * log2(xi,j / ref) + ofs

fac * log10(xi,j / ref)

  • cent2hz: ri,j = ref * 2 ^ ((xi,j - ofs) / 1200)
See also
hz2mel, mel2hz, hz2erb, erb2hz, hz2bark, bark2hz, hth, lin2log, log2lin

<function list>


Example:

#hz  := eval vv(100, 200, 440, 880)
#cent1 := eval hz2cent($#hz)
#cent2 := eval 1200 * ld($#hz / 440) // this is a the same as #cent1

Navigation menu

Personal tools