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

Add support for playing 3d (stereo) sound effect. #745

Open
Tanay-ErrorCode opened this issue Jan 9, 2025 · 1 comment
Open

Add support for playing 3d (stereo) sound effect. #745

Tanay-ErrorCode opened this issue Jan 9, 2025 · 1 comment

Comments

@Tanay-ErrorCode
Copy link
Contributor

Tanay-ErrorCode commented Jan 9, 2025

Description:

Currently, Ursina does not support playing stereo sound effects. All audio is heard equally in both speakers, which limits the immersive experience for 3D environments. This issue aims to introduce support for playing 3D sound effects, where audio volume and balance dynamically adjust based on the sound's position in 3D space, as well as the orientation of the listener.

The goal is to allow developers to input the following parameters:

  1. The position (x, y, z) and rotation of the entity (listener) that hears the sound.
  2. The position (x, y, z) of the entity (sound source) that plays the sound.

The system will use this information to:

  1. Calculate the distance between the sound source and the listener to adjust the overall volume (e.g., closer sounds are louder, farther sounds are quieter).
  2. Determine the direction of the sound relative to the listener's position and rotation to calculate the left and right audio channel volumes, creating a realistic stereo effect.

For example:

  • A sound coming from the left of the listener's current orientation will have higher volume in the left speaker and lower volume in the right speaker.
  • A sound coming from the right of the listener will do the opposite.
  • If the sound is directly in front of the listener, both speakers will play the sound equally.
  • The system will also account for cases where the listener rotates or moves, dynamically adjusting the audio to match the new orientation and distance.

This feature will help create more realistic and immersive soundscapes for 3D environments in Ursina by integrating position and rotation-based audio effects.

@Tanay-ErrorCode
Copy link
Contributor Author

@pokepetter Please assign this issue to me.

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

No branches or pull requests

1 participant