CSoundPatch.ChangePitch

From GMod Wiki

Jump to: navigation, search
Function
Syntax CSoundPatch:ChangePitch( Float pitch [, Float delta ] )
Description:
Changes the pitch of the sound
Returns: nil
In Object: Csoundpatch
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=CSoundPatch.ChangePitch]CSoundPatch.ChangePitch [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionCreates a sound object attached to player 1 and changes its pitch to 125% normal pitch 5 seconds later.
Used onNewerShared.png
Code
sound = CreateSound( player.GetByID( 1 ), "npc/roller/mine/rmine_moveslow_loop1.wav" );
sound:Play();
timer.Simple( 5, sound.ChangePitch, sound, 50 );
-- This is calling sound:ChangePitch( 50 )
-- When you use a function with a timer you can't use an object, so use the generic form
-- Sound.ChangePitch( sound, pitch )
OutputThe roller mine roll sound emanates from the player, and changes pitch 5 seconds afterwards.


DescriptionCreates a sound object attached to player 1 and changes its pitch to 125% in a transition of 5 seconds.
Used onNewerShared.png
Code
sound = CreateSound( player.GetByID( 1 ), "npc/roller/mine/rmine_moveslow_loop1.wav" );
sound:Play();
sound:ChangePitch(50, 5)
OutputThe roller mine roll sound emanates from the player, and transitions to a lower pitch in 5 seconds.


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox