2

I was trying to do some work in Python with simulating 3D sound. I was trying to run this code (provided in the answer): Python openAL 3D sound and similar, both times receiving:

ModuleNotFoundError: No module named 'openal.audio'

I've installed OpenAL, PyAL, and tried installing an older version (uninstalled it and reinstalled the new one), but it still doesn't work.

I've also tried the following code:

from openal import *

class AudioSource:
    def __init__(self, path_to_file):
        self.src = oalOpen(path_to_file)

    def play(self):
        self.src.play()
        self.src.position = (-100, 0, 0)
        self.src.update()

which doesn't use the openal.audio package, but the position doesn't seem to have any effect on the sound source either. I'm open to any solution (including using a newer package if one is available that will produce 3D sound)

Nazim Kerimbekov
  • 4,712
  • 8
  • 34
  • 58

1 Answers1

1

Using link to python OpenAL library at https://bitbucket.org/marcusva/py-al/downloads/

just download either the tar.gz or other one then once expanded it gives you dir something like

~/src/PyAL-0.1.0/

then type

make

if no errors there to install issue

make install

sudo make install  #  this works on ubuntu ... dunno about Windows or osx

then to kick tires run the provided example

cd ~/src/PyAL-0.1.0/examples/
python ./player.py 

which is a rather nice 3D audio demo ... now your python import openal will work ... I confirmed this by running another script at https://stackoverflow.com/a/40945609/147175

If this still goes pear shaped what OS are you on ?

Scott Stensland
  • 26,870
  • 12
  • 93
  • 104