Skip to content


tyrylu edited this page Oct 12, 2011 · 1 revision

The following code is a demo which demonstrates some of the 3d capabilities of fmod ex and python access to them.

import time
import pyfmodex as pf
system = pf.System()
system.threed_settings.doppler_scale = 0 #Turn off doppler effect for this demo
sound = system.create_sound("sounds/beep.wav")
sound.min_distance = 600 #Set the minimum distance, where the volume is at full
channel =
channel.mode = pf.constants.FMOD_LOOP_NORMAL
poslist = [-10000, 0, 0] #A list which represents the position in 3d space.
channel.position = poslist #Poslist can be everything that can be indexed and has at least 3 numeric items (0, 1 and 2).
channel.paused = False
for xcoord in range(-9999,10000, 250):
    poslist[0] = xcoord
    channel.position = poslist
    system.update() #At least for now, you mustn't forgot to call this method which tells fmod ex to update the underliing structures and calculate the 3d position
    time.sleep(0.2) #Wait a while, so you can hear the sound moving.

Note that the velocity property is set like the position property e.g. sound.velocity = [2, 0, 0] and you have to update it manually.

Clone this wiki locally
You can’t perform that action at this time.