Programmer Guide/Command Reference/EVAL/hz2cent: Difference between revisions
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 9: | Line 9: | ||
::*'''hz2cent''': ''r''<sub>i,j</sub> = 1200 * log<sub>2</sub>(''x''<sub>i,j</sub> / ''ref'') + ''ofs'' | ::*'''hz2cent''': ''r''<sub>i,j</sub> = 1200 * log<sub>2</sub>(''x''<sub>i,j</sub> / ''ref'') + ''ofs'' | ||
''fac'' * log<sub>10</sub>(''x''<sub>i,j</sub> / ''ref'') | ''fac'' * log<sub>10</sub>(''x''<sub>i,j</sub> / ''ref'') | ||
::*'''cent2hz''': ''r''<sub>i,j</sub> = ''ref'' * 2 ^ ((''x''<sub>i,j</sub> - ''ofs'') / | ::*'''cent2hz''': ''r''<sub>i,j</sub> = ''ref'' * 2 ^ ((''x''<sub>i,j</sub> - ''ofs'') / 1200) | ||
;See also: [[Programmer_Guide/Command_Reference/EVAL/hz2mel|hz2mel, mel2hz]], [[Programmer_Guide/Command_Reference/EVAL/hz2erb|hz2erb, erb2hz]], [[Programmer_Guide/Command_Reference/EVAL/hz2bark|hz2bark, bark2hz]], [[Programmer_Guide/Command_Reference/EVAL/hth|hth]], [[Programmer_Guide/Command_Reference/EVAL/log2lin|lin2log, log2lin]] | ;See also: [[Programmer_Guide/Command_Reference/EVAL/hz2mel|hz2mel, mel2hz]], [[Programmer_Guide/Command_Reference/EVAL/hz2erb|hz2erb, erb2hz]], [[Programmer_Guide/Command_Reference/EVAL/hz2bark|hz2bark, bark2hz]], [[Programmer_Guide/Command_Reference/EVAL/hth|hth]], [[Programmer_Guide/Command_Reference/EVAL/log2lin|lin2log, log2lin]] | ||
[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]] | [[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]] |
Revision as of 15:37, 6 April 2011
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