Hi all, I am playing an audio file. I read it as a byte[]
and then I need to normalize the audio by putting values into range of [-1,1]. I want to then put each flo
You can change temp
to a list of byte arrays to avoid overwriting it all the time.
byte[] data = new byte[] { 1, 3, 5, 7, 9 }; // sample data
IList temp = new List(data.Length);
float biggest = 0; ;
for (int i = 0; i < data.Length; i++)
{
if (data[i] > biggest)
biggest = data[i];
}
for (int i = 0; i < data.Length; i++)
{
temp.Add(BitConverter.GetBytes(data[i] * (1 / biggest)));
}