- Home /
AudioClip.SetData not working
Hello there, i am trying to write a code to filter audio data of a clip reading the sample data before playing it and setting the sample data to another AudioClip after all the modifications i want to make to the audio. I have achieved to read the data and transforming it but at the time of using SetData, the new clip that i create seems empty. I am sure that the final data is exactly the same, so the problem isn't the sample transfer neither the array creation. Maybe i have misunderstood the setData usage so if anyone nows how it exactly works i will be pleased with any help.
public void OnGui {
AudioClip newClip;
//windowLenght is the amount of samples I use for the FFT
float[] samplesFull = new float[clipsInfo[i][0].windowLenght * clipsInfo[i].Length];
//Here is the code i use for FFT conversion and filling samplesFull, it works perfectly fine
if (myObject != null)
{
newClip = AudioClip.Create("KrillClip", samplesFull.Length, 2, 88200, false);
newClip.SetData (samplesFull, 0);
AudioSource tempAudioSource;
tempAudioSource = myObject.AddComponent<AudioSource>();
tempAudioSource.clip = newClip;
}
}
I don't think that anyone can help you without looking at your code.
Answer by IlSupremo · Oct 03, 2019 at 03:42 PM
Did you find a solution to this? I am experiencing the same exact issue
Answer by unity_4nCFrb5L3C2qdQ · Jan 11 at 02:47 PM
Hello @krillaudio , Did you find a solution please? I have the same problem.
Your answer
Follow this Question
Related Questions
playing a different animation in an array 1 Answer
Triggering a specific sound in an Array - syntax help likely... 1 Answer
AudioClip array not working 1 Answer
How to make an array list set to false gradually instead of instantly? 2 Answers
Multidimensional arrays - editing one element within one of the arrays 1 Answer