-
-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added audio buffer #486
Added audio buffer #486
Conversation
These madlads @hegde95 and @alex-petrenko did it and added sound buffer support for ViZDoom. The code has been tested to work with nice results (see here). There are some tweaks @hegde95 is still adding, but once that is done, can you also take glance over it to see if it checks out? I will also add a Python example on using this. |
Hi @hegde95 and @alex-petrenko, thank you very much for this PR, this is really amazing! I will take a more detailed look at the code this week, for now, I just replaced OpenAL requirement with OpenAL Soft, since basic MacOS and Windows implementations don't have required extensions. |
I updated the example to be more compact and specific to the sound buffers (along with example of storing audio). Major comments:
|
@Miffyli, I'm sorry, my previous commit broke the Ubuntu version, I've fixed this, but...:
|
@hegde95 and @alex-petrenko, I agree with @Miffyli comments and I would only add one: if |
Oh that is interesting. For me (before your updates) the normal sound did not work either (it ran the game, I just could not hear anything). At least we are taking steps to right direction :D |
@hegde95 and @mwydmuch a small poke, to avoid leaving this PR all alone :) Quick test with 20.04 original OpenAL still yields no luck. Did not try to install newer OpenAL system-wide in case it breaks something. Conda has OpenAL Soft 1.20 in their packages, which could (maybe?) fix this but seems to require more setup to point compilers to the conda library. |
The last three changes address #391 |
@hegde95 thank you for adding these! |
Hi guys, I tested it again on different configurations. It seems that after upgrading OpenAL Soft to 1.21 (from source), the current version of this branch works as expected on Ubuntu 20.04 and on Ubuntu 21.04. It also works on Windows 10 (with alext.h header added). I still have a problem with Mac, but I guess it's related to building. I think we can merge this after improving the nameing of few methods. I would like to make it more consistent with the rest of the API. Also, the "sound" and "audio" is used interchangeably right now. I think we should decide to use one of these words. Personally, I think "audio" fits the context better. Thus I would propose to change the current API to (and also rename some internals):
What do you think? |
Can you provide instructions on how you updated the OpenAL package? I assume it was system-wide update? It would be nice to have instructions (or just a pointer that "go here, follow instructions") on this somewhere in case somebody runs into same problems :D. I can also try this on couple of machines (the results have been odd all around tbh). I agree with the naming, sounds good! |
Sure @Miffyli, my way may not be entirely correct, since I'm tinkering with paths a bit. The paths should probably be setup during project configuration, but right I'm not sure how to do it.
This will install to
|
Hi Marek! I think the naming suggestions are great, let's change it!
Regarding the openal version thing, does this mean that everyone will need
to install this custom version?
Or does it work out of the box on the new Ubuntu versions?
…On Thu, Jul 29, 2021, 12:07 Marek Wydmuch ***@***.***> wrote:
Sure @Miffyli <https://github.com/Miffyli>, my way maybe not entarily
correct, since I'm tinkering with paths a bit. The paths should probaly be
setup during project configuration, but right I'm not sure how to do it.
git clone https://github.com/kcat/openal-soft.git
cd openal-soft
git checkout 1.21.1 # Latest tagged version
cd build
cmake ..
make -j
sudo make install
This will install to /usr/local/, which is ok, except that libopenal.so
is expected to be in /usr/lib/x86_64-linux-gnu instead of /usr/local/lib,
that is why I add link manually:
sudo rm /usr/lib/x86_64-linux-gnu/libopenal.so # If allready instaled from apt
sudo rm /usr/lib/x86_64-linux-gnu/libopenal.so.1
sudo ln -s /usr/local/lib/libopenal.so /usr/lib/x86_64-linux-gnu/libopenal.so
sudo ln -s /usr/local/lib/libopenal.so.1 /usr/lib/x86_64-linux-gnu/libopenal.so.1
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#486 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABJ6HLYMDVTCE47JEYMOFCDT2GRHTANCNFSM472N6MSQ>
.
|
There is the same problem with Ubuntu 20.04 and 21.04 since they are using the same OpenAL Soft versions (1.19.1). I did some more research, and found that efx extension is responsible for the error. One can disable it in ViZDoom using |
I gave the suggestions a quick try but no luck. Installing OpenAL Soft led to some confused stuff with sudo ("no permissions"), and even doing the awful thing of installing/running things in sudo, I was given a buffer of silent audio :( . I am running KDE Neon which might change results, and this might be too complex to fix over all distros right here. I added some notes in example to help people spot this and possibly fix it. |
Ok, I've made few more small changes. The amount of memory allocated for the audio buffer now depends on the value passed by |
@Miffyli both of them failed? |
Yeah, sadly both of the approaches failed :(. However, I have one more silly thing I could try out: I did not have any audio devices attached to the machine (remote workstation), so it might be OS's settings that mute audio (maybe). I will try running it with headset attached, and also test if I can hear sound without audio buffers. @hegde95 can you check if changes are ok to you so we can merge this? :) |
@mwydmuch Now the things work! After several re-installations of openal-soft the things now work. I think removing the old openal-soft first and then installing this new one eventually did the trick (I used Edit: I got hold of a fresh-er Ubuntu 20.04 (vanilla, not KDE neon like my workstation), and there the For anybody reading and trying to get sound in ViZDoom working, try out:
@hegde95 will check this soon for validity, and then we can merge it. Splendid job 👍 |
@Miffyli great to hear that! Can't wait to merge it :) |
@hegde95 I added explicit "thank you"s to you in Readme for audio buffer. Give 👍 if that is ok to you :) |
… bots configurations
I'm going through the PR again, I've noticed that you modified bots.cfg, I reverted these changes, since this file should serve as an example, so I would like to keep it simple. I'm not sure why you made this change, perhaps you would like to have these bots for your sample-factory. That's why quickly added the CVAR variable that allows loading custom bots config:
(added this line and comment to |
…or audio buffer related methods
Hey sorry for the delay, I was able to look at things and they seem fine! Merge away! |
Ok, merged. Thank you very much @hegde95, @alex-petrenko, and @Miffyli for your contributions, I will prepare a new release soon :) |
closes #225
This work adds sound into the state space of vizdoom, we can now pass audio buffers synchronously as a NumPy array to the state variable. To enable this set game.set_soft_sound_enabled(True). enabling this slows down sync frame rate by a bit, but this gives researchers the option to tap into a lesser-seen state space.