-
Notifications
You must be signed in to change notification settings - Fork 162
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
How do I play sound at a new position immediately? #366
Comments
@DrSanjeep Steam Audio is designed to interpolate between successive frames for smooth variation of distance attenuation, direction, etc, so rapid teleportation of the AudioSource may not produce the results you might be expecting. Also, what is the value of Doppler level in the Audio Source settings? If this is non-zero, Unity might be applying very aggressive Doppler effect to the audio clip, resulting in distortion. |
@lakulish thank you. i have tried doppler 0 and 1 and it sounds the same. do you happen to know the recommended method to overcome or clear this interpolation? can this system make a bullet ricochet sound from a raycast for instance? do i have to recreate the unity audio source? |
@DrSanjeep You can certainly use Steam Audio to make one-off sounds like a bullet ricochet. You will, however, have to use a separate Audio Source for each ricochet (you can use a pool of a finite number of Audio Sources for this). |
@lakulish so i can only use an audio source once. i think i can do that but its going to be annoying. Wish i could just reset it |
Using a pool of audio sources was not a good solution because 1. The pool runs out 2. It means continuously filling the pool |
turns out the performance suffers having to create a new source for every sound played. will anything be done? |
@DrSanjeep I'd like to understand more about the performance impact you're seeing. Is there a minimal Unity project you can share that exhibits this issue? |
|
@lakulish or this |
This comment was marked as spam.
This comment was marked as spam.
also i would like to avoid allocating 1KB every sound played |
@DrSanjeep That does seem like a significant amount of time for instantiating the prefab. Can you share more details about how the Steam Audio Source is configured? Again, a minimal Unity project will help us diagnose the issue. Thanks! |
steamaudio_unity_4.5.3
Unity version: 2022.3.38f1
I don't know ahead of time where the next sound will play
I hoped that i could move an audio source and then immediately play a sound
but it sounds like its interpolating
Steps To Reproduce
create a blank unity 3d project
set up steamaudio unity 4.5.3
create an empty game object
add audio source with short audio clip e.g. footstep
set the 3D slider to 3D
add the steam sudio source
Enable Distance Attenuation
add the below script
play the scene
check Spatialize to hear distorted sounds
we expect to hear only one sound because the second sound its too far away
but we hear two distorted sounds
the script below attempts to play the sound in one position, waits 0.5 seconds then plays the sound in the second position and repeats. And it sounds terrible
The text was updated successfully, but these errors were encountered: