Sound.setPitch

From Spheriki

Jump to: navigation, search

Set the pitch for a sound

pitch ranges from 0.5 to 2.0. 0.5 is an octave down (and half as fast) while 2.0 is an octave up (and twice as fast). pitch defaults to 1


Contents

Usage

Sound.setPitch(pitch);


Examples


var mysound = LoadSound(); //Load a new sound
mysound.setPitch(2); //Increase pitch
mysound.play(false); //play the sound without looping

Notes

If your sound file is "C", then use this table to get the pitch for the other notes.

Notes to pitch
note pitch note # pitch
c 0.5 + 0/24 c# 0.5 + 1/24
d 0.5 + 2/24 d# 0.5 + 3/24
e 0.5 + 4/24
f 0.5 + 5/24 f# 0.5 + 6/24
g 0.5 + 7/24 g# 0.5 + 8/24
a 0.5 + 9/24 a# 0.5 + 10/24
b 0.5 + 11/24
C 1.0 + 0/12 C# 1.0 + 1/12
D 1.0 + 2/12 D# 1.0 + 3/12
E 1.0 + 4/12
F 1.0 + 5/12 F# 1.0 + 6/12
G 1.0 + 7/12 G# 1.0 + 8/12
A 1.0 + 9/12 A# 1.0 + 10/12
B 1.0 + 11/12
C2 1.0 + 12/12


See also


Personal tools