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 Debugging View #4249

Merged
merged 22 commits into from
Jun 22, 2021
Merged

Audio Debugging View #4249

merged 22 commits into from
Jun 22, 2021

Conversation

keianhzo
Copy link
Contributor

@keianhzo keianhzo commented May 7, 2021

Support for a debugging view and a debugging panel to visualize and tweak the positional audio parameters.

audio_debugging.mp4

This PR adds:

  • An audio-debugging-system and a view that that can be enabled from preferences and renders the audio sources elements and it's parameters.
  • A audio-gain-system that handles all the audio gains and clips audio when attenuation is below certain threshold

Closes #4165
Closes #4166

@keianhzo keianhzo requested review from netpro2k and takahirox May 7, 2021 17:03
@keianhzo keianhzo force-pushed the panner-params branch 4 times, most recently from ee096c9 to 241e3fe Compare May 10, 2021 15:09
@netpro2k
Copy link
Contributor

Still haven't gotten around to reviewing this but I will try to soon....

The one thing I noticed off hand is that I think we should not change any falloff defaults in this PR. For me one of the main goals of the debug view will be to help us figure out what better defaults are. So we should first ship just the debug view (and hopefully some way to easily play with values) and then come up with defaults by getting in a room with a bunch of people and messing around with values till we find something we are happy with.

@keianhzo
Copy link
Contributor Author

I think the only one that I've changed is the avatarConeInnerAngle that by default is 360 and I've changed it to 180, I thought that one was a must but I can revert. avatarConeOuterAngle and avatarConeOuterGain are set to the default value. I've just added them to the settings so we can eventually also change them from the scene settings in Spoke.

I wanted to jump right away to the OB blitting issue so I haven't pushed the tweaking panel but I'll add that too.

Copy link
Contributor

@netpro2k netpro2k left a comment

Choose a reason for hiding this comment

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

This is looking great! I love the debug view and the debug panel will be really helpful for coming up with better defaults. We still have a few more stages of refactoring to clean up audio handling but this is a great first step that at least gives us the target for "source of truth" then we can start reading from. Then we can migrate it to actually being the source of truth and remove all the other places where we define these settings.

src/components/audio-params.js Outdated Show resolved Hide resolved
src/components/audio-params.js Outdated Show resolved Hide resolved
src/components/audio-params.js Outdated Show resolved Hide resolved
src/components/audio-params.js Show resolved Hide resolved
const MUTE_DELAY_SECS = 1;

AFRAME.registerComponent("audio-params", {
dependencies: ["media-views", "avatar-audio-source"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, would be very careful with this. If I remember correctly having this will cause aframe to create these components if they aren't already on the entity, that would cause avatar-audio-source components to get added to everything this is on which does not seem correct. Also media-views is not a component as far as I am aware.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Humm, I thought it just affected the components initialization order. Removed.

src/systems/audio-debug-system.js Outdated Show resolved Hide resolved
src/systems/audio-debug-system.js Outdated Show resolved Hide resolved
src/systems/audio-debug-system.js Outdated Show resolved Hide resolved
src/systems/audio-debug-system.js Outdated Show resolved Hide resolved
src/systems/audio-debug-system.js Outdated Show resolved Hide resolved
@keianhzo
Copy link
Contributor Author

@netpro2k Thanks a lot for the thorough review, it definitely looks better. I've a few questions but otherwise I think I've addressed all your concerns.

@keianhzo keianhzo requested a review from netpro2k May 20, 2021 08:00
@keianhzo
Copy link
Contributor Author

I've also added debug support for audio-target.

Copy link
Contributor

@netpro2k netpro2k left a comment

Choose a reason for hiding this comment

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

Still a bit concerned about the GC cost of the audio() function, particularly since its called many times per frame. Other than that this LGTM. Nice work!

@@ -1,3 +1,38 @@
export const AvatarAudioDefaults = Object.freeze({
Copy link
Contributor

Choose a reason for hiding this comment

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

Yay for having the defaults all in one place!

@@ -0,0 +1,161 @@
// Based on: https://www.shadertoy.com/view/Mll3D4#

#define MAX_DEBUG_SOURCES 64
Copy link
Contributor

Choose a reason for hiding this comment

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

Just FYI you can have threejs pass this in by putting it in defines on the material if you want it to be configurable from the js side. Not really needed for this since there is only ever a single instance of this shader anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh that's cool, updated!

const worldQuat = new THREE.Quaternion();
avatarRigObj.getWorldQuaternion(worldQuat);
this.avatarRigOrientation.applyQuaternion(worldQuat);
return {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is allocating several new objects per avatar every frame. I think that is going to lead to noticeable GC pressure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this to a temp var to avoid allocation

@keianhzo
Copy link
Contributor Author

@netpro2k Updated with the latest change requests.

@keianhzo keianhzo requested a review from netpro2k May 31, 2021 09:27
@keianhzo keianhzo merged commit 2f0d6a3 into master Jun 22, 2021
@keianhzo keianhzo deleted the panner-params branch June 22, 2021 17:44
@keianhzo keianhzo added the whats new Include this PR on the "What's New" page label Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
whats new Include this PR on the "What's New" page
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Visual representation of the audio falloff Improve AudioPanner node settings
2 participants