And before anyone asks, I have looked at an earlier thread in this forum that contained a number of code examples, while I have been able to figure a few things out and get some audaspace code running without errors, there’s still the error where the console says that the file can’t be played, even though I have imported the aud and bge modules.
The code setup I have (helped by looking at other threads and the Blender wiki), has these lines setting the basic variables for audaspace at the beginning of the script
device = aud.device() walkSound = aud.Factory.file(bge.logic.expandPath("//Sounds/foot_steps_1.wav"))
And then further down, when the movement actuator is activated.
handle = aud.device().play(walkSound) handle.loop_count = -1 handle.location = [Px, Py, Pz] #set the location to the player's position#
However, I’ve tried every line I’ve seen as an example to play a sound in audaspace, but the console still shows the same error saying the sound file cannot be played, it doesn’t matter if I try to use expandPath or not, noting that the file is packed within the .blend file so I’m not sure what I’m doing wrong.
This isn’t really for a new project, but converting the code in an older project to the 2.5 API which includes converting a piece of code to play a sound from the old API for the sound actuator in 2.49 to use audaspace in 2.5 (using a fairly recent build). I have nearly everything else working, but I don’t have much of an idea on how to get the sound file to play if it seems nothing I’ve gathered from other threads is working.