- Home /
How to AudioSource.GetSpectrumData while muted?
I'm writing an audio visualizer, which works fine. However, it needs to work even if the AudioSource is muted. But when I mute it, GetSpectrumData no longer returns any data. So I need sample data that isn't related to the current volume. Does anyone know if there's any way to do that?
Thanks!
Answer by ChristopherCreates · Feb 03, 2018 at 12:44 PM
An answer provided by the generous reddit.com/user/nGear !
Make an audio mixer, and add one sub-group within it. Set the AudioSource to output to the sub-group. Expose the sub-group volume to scripting. Then "mute" the AudioSource by setting the volume of the sub-group via script. The played audio will change, but the GetSpectrumData will remain.
(Note that if you're looking at the mixer editor, the master levels will fall with the sub-group, implying that the spectrum data would be changing. That is not the case.)
Your answer
Follow this Question
Related Questions
How can I pre-load samples from an audio file to spawn objects? 1 Answer
Audio continuation through two scenes 3 Answers
How to play music/audio 2 Answers
Timeline Audio Source problem using Cinemachine 1 Answer
AudioSource.clip.time won't work? 2 Answers