Hello,
I have a problem with loading a couple of mp3 files.
They are the same track, just exported with different parameters.
In track 1, the audio is extremely sped up and with a wrong length. In track 2, on the other hand, the audio is fine but the duration is wrong (it should be about 45 seconds instead it is almost 6 minutes).
The code I am using is as follows:
var mpgFile = new NLayer.MpegFile(path);var samples = new float[mpgFile.Length];mpgFile.ReadSamples(samples, 0, (int)mpgFile.Length);clip = AudioClip.Create("clip-mp3", samples.Length, mpgFile.Channels, mpgFile.SampleRate, false);clip.SetData(samples, 0);
I'm using Unity and the last two lines are for creating the audio clip, but I think the problem is earlier, in reading the samples.
Hello, I have a problem with loading a couple of mp3 files. They are the same track, just exported with different parameters.
In track 1, the audio is extremely sped up and with a wrong length. In track 2, on the other hand, the audio is fine but the duration is wrong (it should be about 45 seconds instead it is almost 6 minutes).
The code I am using is as follows:
var mpgFile = new NLayer.MpegFile(path);
var samples = new float[mpgFile.Length];
mpgFile.ReadSamples(samples, 0, (int)mpgFile.Length);
clip = AudioClip.Create("clip-mp3", samples.Length, mpgFile.Channels, mpgFile.SampleRate, false);
clip.SetData(samples, 0);
I'm using Unity and the last two lines are for creating the audio clip, but I think the problem is earlier, in reading the samples.
Here are the two tracks: Tracks.zip
Thank you in advance.