My first time posting a question, so my apologies if I leave anything off etc.!
I’m having issues with audioClip.GetData. I have two different cases where I’m using this function, and it works for one case and not the other.
In the first case - I’m pulling in a pre-set audioClip (loaded in the inspector before runtime) and getting the clip’s samples to generate a waveform of the song precisely so that it can be tied to the track time when playing the actual track, like in a DJ Mixer. It works well when I load up the game, and matches up perfectly.
In the second case - I run through the exact same method, but the audioClip is loaded in with NAudio at runtime. I am fairly certain this is the cause of the problem - but when I load up the track, it only has the first 5% or so of the song, and so prints out that part of the waveform only. Upon further inspection - it looks like only that 5% of samples are being loaded in, and the rest are zeros. Furthermore - if I import the song then wait to run the waveform generator method, there are more samples loaded in.
If I delay running the method, it takes somewhere between 30-60 seconds to load all the samples for the song - and if I wait longer than that exact time (I couldn’t determine exactly how long it took to load them all), it started repeating some section of samples for some odd reason, printing out extra & what appear to be duplicate sections of the waveform at the end, AFTER the song audio was supposed to end!
It seems that there is some clip loading happening that I can’t detect, and I’ve read that using audioClip.GetData at runtime with imported tracks can be challenging. All my loadTypes etc. all seem to be within the ideal parameters, but I’m not sure what else to try or what is going on.
Any and all help is very much appreciated - thank you in advance!