- Home /
GetSpectrumData From A Muted AudioSource?
I am trying to get the spectrum data from a muted audio source, to do some visual effects. Tricky part is I have another background music to play, so I dont want this audio clip to play out.
I feel like Unity's FFT Window only works with sounds that are not muted.
How could I do this?
What happens when calling GetSpectrumData on a muted AudioSource?
You are on unity 5 or 4.6?
What you could try is setting audioListenner to pause and then set the variable of audioSource to ignore listener for the sound you want to actually hear, hopefully it would do the trick.
@zach.r.d no data comes out (or the array is all zeros)
@Nerevar Im using unity4.6, tried your suggestion, unfortunately it doesnt work :(
setting audioListenner to pause acts the same as muting the audioSource, i tried setting audioSource.ignoreListenerPause = true, then i could hear the audioClip playing again..
Answer by zach-r-d · Jun 26, 2015 at 02:51 AM
In an audio mixer, try creating an audio mixer group with the volume turned all the way down, and playing the sound through that. It will be mixed down to nothing, but the spectrum data from the audio source itself should still be fine.
Thanks for the answer, bro, im using unity 4.6, any idea on what i could do in 4.6?
Hmm. This is pretty hacky, but you could create a GameObject with an AudioSource on it, put it far, far away from the AudioListener, and manually set the rolloff mode such that the volume rolloff makes it inaudible. This would require the sound to be 3d, though.
Tried your method, but once i drag the GO (AudioSource on it) away from the AudioListener, the data output comes to all zeros again ..
Your answer
Follow this Question
Related Questions
Microphone input volume to axis value translation 1 Answer
Audio.GetSpectrumData() returns NaN 1 Answer
Get microphone FFT input without playback 2 Answers
GetOutputData and GetSpectrumData, what represent the values returned? 2 Answers
Returning spectrumdata to an array of 64 floats in good framerate 1 Answer