Sound Actuator Loop Bidirectional: pitch

pitch
  • gets/sets the pitch of the sound.

Type: 
  • float number

Range:

  • 0.5 to 2.0
Sound Actuator Pitch Settings:
  • Range:  -12.0 to 12.0
  • Sound Actuator Pitch set to -12.00: pitch (python) returns 0.5
  • Sound Actuator Pitch set to 0.00: pitch (python)  returns 1.00
     
  • Sound Actuator Pitch set to 12.00: pitch (python)  returns 2.00
Loop Bidirectional:
  • Plays the sound file from start to finish.  Then finish to start.  Over and over.
  • Positive Pulse:  Starts playing the sound file from the beginning.
  • Negative pulse:  Keeps playing the sound file until it reaches the end, then stops playing.
Sample Code


################  get the amount of pitch

# import bge module
import bge

# get the controller
cont = bge.logic.getCurrentController()

# get the actuator attached to the controller
# my actuator is named Song

act = cont.actuators["Song"]

# get the amount of pitch
amount = act.pitch
 
Sample Code


################  set the amount of pitch

# import bge module
import bge

# get the controller
cont = bge.logic.getCurrentController()

# get the actuator attached to the controller
# my actuator is named Song

act = cont.actuators["Song"]

# set the amount of pitch to maximum amount of 2.0
act.pitch = 2.0