Skip to content
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

Audio demo #469

Merged
merged 15 commits into from
Jun 16, 2023
Merged

Audio demo #469

merged 15 commits into from
Jun 16, 2023

Conversation

DigitalN8m4r3
Copy link
Contributor

@DigitalN8m4r3 DigitalN8m4r3 commented May 28, 2023

AudioDemo.mp4

This adds my work on audio in xr
it contains new nodes such as the pickableaudio node and the areaaudio node.
Both can be used to play audio
Snap Zone was edited to allow for playing audio upon snap/ stash

pickable audio plays audio based on the velocity of the rigidbody3d

area audio can be attached to all nodes of type area3d or nodes based on the area3d node, it plays audio upon entering
and can be used for things like buttons..
snap zone can play a audio file if the snap zone contains a audiostreamplayer3d node and if not it will pass, maybe someone else could do this with some more elegance

The Demo is showcasing what can be done with the above

Note:
If you have ever experimented with audio for xr, you will know that there is alot that can be done and that can be done wrong
For now i have set all the pickables to Sleeping and it checks if its not sleeping and then it will run the process.

The pickables audiostreamplayer3D nodes are adjusted strictly to specific values, i spent some time gettin these for my ears right so you can of course try it with the standard settings but i do think that you might favor mine

Final Note:
an audio is only as good as the audio file that is being used, keep that in mind

added optional stash sound to snap zones

the way this works is that on snap it checks if the pickable object has a audiostreamplayer3d and if then make sure to stop its audio and play the stash sound on the audiostreamplayer3d node of the snapped pickable and if there is no audio node then pass
this adds a area audio node along with a area audio type node
what it does in a nutshell, it can play a touch sound when an object enters it

since for example all the interactables are extensions of the area3d node, the audio node can work with those as well

imagine u got a lightswitch or a button, now u can have sound when u touch it

ooh and i made a audio Fx icon
this adds the base scene for the audio demo with the arcade floor material
this adds the pingpong models - ball/ racket/ table along with the token coin
adds phymat for pingpong/ basketball
adds poses

Note: these assets are made by me Digitaln8m4r3
and am licensing these under CC0 Public Domain, will add a license file in the next commits
adds pickable audio nodes
adds basketball model with 4 different material/ baseColor variations
reorganized my folder under assets
this adds the arcade hoops machine
pingpong table with racket and ball
added license file to digitaln8m4r3 assets

adds public domain audio files from freesound.org
added the audio demo to the main menu and removed the footstep demo from the main menu

added soundtrack from the starcourt mall by bryan teoh
added holodeck small version

fixed snap zone stash sound not working
fixed typo in pickable_audio.gd
now u can type in what message u want to be displayed on the board when u
+score
+the game ends
+before the game starts
added footstep

Note: i might expand this audio demo in future with a jump pad arcade to demonstrate the footstep system in a better way
@BastiaanOlij
Copy link
Member

First impressions is that this looks really good. I really like the demo, it's a good exposition of what you can do with XR tools.

Just a nitpicking question, why did you keep the AudioStreamPlayer3D separate? I would have either inherited from AudioStreamPlayer3D or created it as a child (though you'd need to duplicate a number of key audio properties)?

For the snapzone stash sound I would just add the audio player to snap_zone.tscn, if it's unused it just doesn't contribute to the audio.

I would also make the 3 sounds in XRToolsPickableAudioType optional, I might not want to specify all 3. I'm also not sure if it's overkill to have this as a resource type instead of just having the sounds be properties of XRToolsPickableAudio, I'm not sure if there are a lot of scenarios where you would reuse these. Generally speaking you would add this node to an inherited scene for the pickable object and that already becomes a suitable container. But I might be overlooking some use case.

@DigitalN8m4r3
Copy link
Contributor Author

why did you keep the AudioStreamPlayer3D separate?
honestly it was because i was thinking about makinga visual Fx node and connect it with the audio node i made but you are actualy right there is no reason to make it seperate, thinking about it am gonna make this extend from the audiostreamplayer3d node

For the snapzone stash sound I would just add the audio player to snap_zone.tscn, if it's unused it just doesn't contribute to the audio.
Hmm am gonna look into this, wasnt sure how to code it actualy since redesigning current code should not end up in a hacky solution, that is why i introduced the check if a audiostreamplayer3d is present do this and if not just pass

I would also make the 3 sounds in XRToolsPickableAudioType optional, I might not want to specify all 3. I'm also not sure if it's overkill to have this as a resource type instead of just having the sounds be properties of XRToolsPickableAudio
not sure if i can make this optional :D and regarding the sounds being part of a resource, think about for example all the wooden items u got or that are made out of wood, you just drag in the wood resource and ur done but maybe am not understanding the impact of using the resource type here, so if its making a higher impact when using a resource then am gonna change it

On a sidenote, what about the floor material? am asking cuz am not sure how performant it is so maybe u can take a look at it

this makes the area and pickable audio nodes extend from audiostreamplayer3d and this way removing the need of adding the audiostreamplayer3d node in the first place

updated snap_zone.tscn with a audiostreamplayer3d node and removed the check for if one is present or not inside the snap_zone.gd script

moved the audio resource files into area and pickable subfolders of the audio_demo/audio folder
@DigitalN8m4r3 DigitalN8m4r3 marked this pull request as draft May 31, 2023 22:02
to ease the process of adding the audio nodes, now u can just add them as a inherited scene

arcade_hoops_ctrl:
adjusted the time of point where the token gets queue_free
@surreal6
Copy link
Contributor

surreal6 commented Jun 3, 2023

i was testing the pr and it works fine for me. I think it's a nice addition to the demos. Also find interesting to have the separate XRToolsPickableAudioType so many objects can share same sounds, and also as an example on how to setup this resources.

lgtm and thanks for takin the time to do this, it adds a lot to the visual appeal so nice that you made this into a res saving shader
@DigitalN8m4r3 DigitalN8m4r3 marked this pull request as ready for review June 6, 2023 04:36
@DigitalN8m4r3
Copy link
Contributor Author

thanks to @BastiaanOlij who was able to transfer the arcade floor material into a shader, this now performs way better since the material version i made had quiet a lot going on to achieve the effect.

with that being said, i see this demo complete and ready for review.
however am sure i will revisit this some time later in the future to add a proper demonstration for the footstep stuff since this demo replaces the footstep demo as well

Copy link
Member

@BastiaanOlij BastiaanOlij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good enough to merge, @Malcolmnixon if you could have a look as well and give your Ok?

@DigitalN8m4r3
Copy link
Contributor Author

since malcolm wasnt added to do a review i guess he just didnt rly noticed this, anyways... as he is not available in the coming weeks and since @BastiaanOlij already approved, i would like to see this merged so i can get to the other things such as the collision hands and twohanded stuff

@BastiaanOlij BastiaanOlij merged commit cda5d71 into GodotVR:master Jun 16, 2023
2 checks passed
@BastiaanOlij
Copy link
Member

Lets go for it, I'm sure we can polish up anything that we need later, thanks for the effort @DigitalN8m4r3 !

surreal6 added a commit to surreal6/godot-xr-tools that referenced this pull request Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants