This function modulates the frequency of a playing sound. This affects the speed it plays at, as well as the perceived pitch.
- pitch: the new pitch to set.
--Create a window
window = Window:Create()
context = Context:Create(window)
--Load a sound
local sound = Sound:Load("Sound/Music/menutheme.wav")
source = Source:Create()
while true do
--Press up/down keys to alter pitch
local pitch = source:GetPitch()
if (window:KeyDown(Key.Up))then pitch=pitch+Time:GetSpeed()*0.01 end
if (window:KeyDown(Key.Down))then pitch=pitch-Time:GetSpeed()*0.01 end
if window:Closed() or window:KeyHit(Key.Escape) then return false end