Pitch
The pitch
channel maps a data variable to a perceived frequency (high and low).
Note that a higher frequency value tends to be perceived as a higher note, but the pitch itself is not the only determinant of a frequency.
A pitch
value can be written as a frequency or a note.
It is possible round to a note by setting roundToNote
as true
(default is false
).
For example, if a mapped pitch value is 130.6Hz, then the pitch sound is rounded to a closest note C3 (130.812Hz).
pitch
usage pattern
JSON
JavaScript
Using a note scale
Instead of frequency, one can use the name of note (conversion table).
A note name is formatted as NOS
standing for note
, octave
, and semitone
.
- A
note
can be: eitherC
/c
,D
/d
,E
/e
,F
/f
,G
/g
,A
/a
, orB
/b
(both upper and lower cases work). - A
octave
can be: either0
,1
,2
,3
,4
,5
,6
, or7
. - A
semitone
can be skipped or eithers
/S
/#
for sharp orb
/B
/♭
for flat.
For example, b3#
is the Si in Octave 3 with flat, equivalent to C4
.
Detune
For noise tones, pitch
can’t work because of the underlying structure (i.e., there is no absolute baseline pitch).
Instead, we can use the detune
channel (it only works for noise tones).
Detune can range from -1200
to 1200
, where each 100
is a distance between two notes.