3D sound with pyglet

3D sound with pyglet

Postby civral » Tue Apr 12, 2016 2:32 pm

Hello,
I am trying to implement 3D sound in my game, but i just can't get it to work :?
I read it, that pyglet uses openAL. So i tried it with pyglet and openAL, but i failed with both

This is what i tried in openAL, the program actually executes, but it doesn't do anything
Code: Select all
from openal.loaders import load_wav_file
from openal.audio import *#al, alc, SoundSink, SoundListener, SoundSource, load_wav_file# imports all relevant AL and ALC functions

sink = SoundSink()   

#SoundSink.activate(sink)

listener = SoundListener()
listener.position = (0, 0, 0)
listener.velocity = (0, 0, 0)
listener.orientation = (0, 0, -1, 0, 1, 0)

source = SoundSource()
wavsound = load_wav_file("test.wav")
source.queue(wavsound)

sink.play(source)


This is with pyglet:

Code: Select all
import pyglet
import pyglet.media as media

def main():
    sound='test.wav'
    src=media.load(sound)
    player=media.Player()
    player.queue(src)
    player.volume=1.0
    player.position(1,1,1)
    player.play()
    try:
        pyglet.app.run()
    except KeyboardInterrupt:
        player.next()

if __name__=="__main__":
    main()


and I receive this error:
player.position(1,1,1)
TypeError: 'tuple' object is not callable


I am woking on OSX
civral
 
Posts: 2
Joined: Tue Mar 15, 2016 9:42 am

Return to Game Development

Who is online

Users browsing this forum: No registered users and 2 guests