2022-03-06 22:29:11

@50
Which error? The AttributeError or the Win32 error? If the latter, and if you have OpenAL installed, OpenAL Soft comes with a text file that tells you where to put it to overwrite your existing OpenAL install. Otherwise you just copy/paste the new binary into the working directory of whichever script your working with, and/or overwrite the OpenAL32.dll's.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2022-03-06 23:09:48

@tunmi i had to replace all the openl32.dll files with the .dll in the bin/win64 folder. Then rename that dll to OpenAL2.dll. Then for me, I added the
----------------

import os
os.add_dll(os.getcwd())

-------------------
above the
-----------

from openal import *

------------
in all the fials using the wrapper.

One of the lead developers of the Final Hour audio game, currently in beta.
https://finalhour.lowerelements.club

2022-03-09 04:53:48

Out of curiosity, what coordinate system is this using? Where does the z-axis point to?

2022-03-09 04:57:11

Right-handed Cartesian coordinate system (RHS), much like OpenGL. There's a bit on it [here].

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2022-09-23 22:44:57

Hello:
Could anyone give me an example which completely mutes a source if you get too far from it? I've managed to reduce over all volume after a long distance by setting source gain to 0, which makes it almost indistinguishable, but it's still there if you focus.
I hear that you gotta manually impliment the fully fading out thing and I just cannot find any examples or tutorials that are in python and I am rather unfamiliar with their syntax. I googled the same thing with different words like half a dozen times, I've scoured github for openAL python and similar entries just to see if there was an example I could draw from, plus searched on some of the websites which draw code examples from github and similar places, but I've not found anything.
Thanks.

You see a signature that is 800 characters and 8 lines long. You quickly report it to the administrators

2022-09-24 02:17:05

OpenAL automatically handles volume drop off via the Roll Off Factor setting in the source player, although you can also set the distance models via the current context. You could also program it to just stop, or not play the source after X distance if its still noticeable.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2022-09-24 04:12:09

it does drop off volume yes, but it's also present no matter how far you move, even if you can barely hear it. I'll search into pausing sources, although it might be a bit tricky to do because what if the thing moves towards you instead of you doing so to trigger resuming? Gotta have a lot of if checks maybe, I'm not really used to this.
Anyway, thanks for the response.

You see a signature that is 800 characters and 8 lines long. You quickly report it to the administrators

2022-09-24 04:28:45

There's a thread a few years ago [here] that seems to get into a similar question that may prove useful. Rendering distance based on local objects isn't an uncommon trick in many games, there's a few ways to do it, but one is to break the map into localized cells, and then to distance checks on objects within the cell the player is in, and adjacent cells, so like a 3 by 3 grid.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2022-11-16 20:47:52

hi everyone
so i  am thinking of a game which has a lot of ai players: and each AI player has 4 footstep sounds: a death sound: and some gunshot sounds. but there is the limit of 255 sources with openAL soft. i have made a example code with python using openAL pylite and i have made mor than 255 sources. and after that limit: the sources stopd generating what should I  do if I go over 255 sources? a not good scenario is geting the player killed with out a worning

2022-11-16 22:01:03

@59
To be clear, when you say source are you referring to sound data, or to a sound player to which sound data is loaded into and played?

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2022-11-17 07:31:45

no: i am   refering to the sound players. i think they are calld sources in openAL soft

2022-11-17 07:57:36 (edited by magurp244 2022-11-17 08:20:35)

Ah, the terms can get a bit mixed at times so I just wanted to be sure. Anyway...

The 256 source limit in openal soft is more of a soft limit in the software, technically there is no limit beyond what your hardware can handle. Although there are certain reasons why there are limits with things like multiple sounds playing simultaneously, which can overload the system (and the player). According to a few threads [here] and [here] its possible to increase the source limit to whatever you want as a context attribute when creating a context using ALC_MONO_SOURCES and ALC_STEREO_SOURCES.

Generally speaking, in term's of optimization and efficiency its always best to recycle sound players rather than generating them dynamically all the time, or creating a sound player for each and every object as opposed to X number for each object type. For example having X number of sound players for monsters, and then returning and passing them to new monsters as needed rather than just creating more. Such management is typically a result of proximity, as sighted games also feature things like rendering distances and such. In the event that you have X thousand monsters or objects on the screen at once, consolidating distant groups into a single "group" sound, and playing more local near objects with individual sound sources would also work, as near objects may be more relevant.

Put another way: using your example of 4 footstep sounds, a death sound, and some gunshot sounds, do all of those sounds need to play simultaneously? If an enemy dies they don't play footsteps or gunshots, if their firing gunshots they don't play a death sound, or in some cases footsteps either. So in that case, you can assign one sound player to an enemy within range of the player, and load whatever appropriate sounds are required when their required, and switch between them as needed. If/when they move out of range (or die), the assigned sound player can be returned to the queue and wait to be assigned to another monster if needed in range, etc.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2022-11-17 10:21:20

no i will not play them all simultaneously. what i want to hapen is the monsters will walk around the map: and if they see you: and they go closer to you they will start shooting at you

2022-11-17 10:24:17

and is there is a way to controll alc_mono_sources or alc_stereo_sources with openAL pylite?

2022-11-17 10:43:30

Mmm, sort of. Context swapping/handling isn't something currently implemented in the handler classes, I believe I was working on that a bit ago and haven't gotten around to expanding it. The bindings are there, but it may require sub-classing the listener to add context attributes. As it stands, whenever you make a listener it will automatically create a context, with no way to add custom attributes.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2022-11-17 11:06:41

are you going to update the listener to support controlling alc_mono_sources or alc_stereo_sources in the future?

2022-11-17 11:13:23

Yes, I was working on isolating and expanding on context control and switching for handling different listener positions and such, and proper handling for attributes at context creation would be part of that.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2022-11-18 08:20:29

hi @magurp244
as you say: you can pass sounds to other for example: monsters when an other monster gos out of range. can you give a small example about how to do that?

2022-11-18 09:55:41 (edited by magurp244 2022-11-18 11:07:28)

There's a few ways to go about doing it, but here's a basic example demonstrating the concept:

class main(object):
    def __init__(self):
        self.sound_queue = [player(), player(), player()]

        self.user = user()

        self.monsters = [monster(self),monster(self),monster(self)]

        self.update()

    def update(self):
        for a in self.monsters:
            a.update()


class player(object):
    def __init__(self):
    #plays sounds
        pass
    def stop(self):
        pass
    def unload(self):
        pass


class user(object):
    def __init__(self):
        self.x = 0
        self.y = 0


class monster(object):
    def __init__(self,main):
    #pass and store a reference to the main game class
        self.main = main
        self.x = 0
        self.y = 0
        self.sound_player = None

    def update(self):
    #are we in range of the user?
        if (self.x < self.main.user.x+50 and self.x > self.main.user.x-50
            and self.y < self.main.user.y+50 and self.y > self.main.user.y-50):
            #if we are, and we don't already have a player, get one.
                if self.sound_player == None:
                    if len(self.main.sound_queue) != 0:
                        self.sound_player = self.main.sound_queue.pop(0)
                    print(self.sound_player)

    #if were out of range, return sound player to queue
        elif self.sound_player != None:
            self.sound_player.stop()
            self.sound_player.unload()
            self.main.sound_queue.append(self.sound_player)
            self.sound_player = None

main = main()

In this case I hand off a reference of the main game class to the monsters at creation so that they can access the users position, map information, along with the sound queue when needed for retrieving or returning players. Again, a number of ways to handle things like that, such as with state handlers and such, but this should let you play around with the idea.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2022-11-18 10:21:20

@magurp244: thank you a lot for this example

2022-12-04 09:40:23

Hello,

Apologies for a newbie question. I am really new at directional audio. My question is what is the best way of panning audio relative to player movement in a 2D sidescroller? in my basic learning example, I am representing my map as a list. When updating the sound position, I am doing enemy.position - player.position. For example, if the player is at index five and the enemy is at index three the sound coordinates will be (-2,240,0), x,y,z respectively. Is this the best way to go about this? as the audio sounds a bit off to me.

2022-12-04 10:17:42

It can depend on a few things, the current roll off factor for example, which determines how much the audio fades over distance. Or how the Listener is oriented relative to the intended position. In what way do you find the audio is off?

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2022-12-04 10:31:08

@72:

Thanks for your response. When the player is next to the enemy, for instance, the enemy is at Index five and the player is at index 4, the enemy sounds sort of far away, not right next to the player. My current roleoff factor is 0.01, the default value in your example and the listener is also  set two (zero, 240, zero) the default value in your example as well.

I apologize for these Nube questions, as I am trying to learn, so I cannot use the actual terminologies to explain the problem. :-)

2022-12-04 10:50:46

Curious, assuming the enemy sounds position is (1,240,0), then it should play just fine. Can you post an example demonstrating the issue?

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2022-12-04 11:09:53

@74:

It plays fine, but it sounds slightly  further to the right rather than sounding as though it’s next to the player position. I also tried dividing the enemy position - player position by 2, and it sounds slightly better, but not perfect. Is this the best way to go about this or should I use some other method that will give me better results? Also, the Y value for both player and listener is set to 240, is this the best value or should I change this?