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.500 c# 0.530
d 0.561 d# 0.595
e 0.630
f 0.667 f# 0.707
g 0.749 g# 0.794
a 0.841 a# 0.891
b 0.944
C 1.000 C# 1.059
D 1.122 D# 1.189
E 1.260
F 1.335 F# 1.414
G 1.498 G# 1.587
A 1.682 A# 1.782
B 1.888
C2 2.000

note you can recreate this table by taking the lowest note (at pith 0.5), and multiply it by 1.05946 [1] to get the next note, and so on.

See also


Personal tools