asdfSound = noisyThing.playsound('asdf.wav') ... #every frame newVolume = soundVolumn(noisyThing, viewPosition) asdfSound.volume(newVolume)