private static byte[] ResampleInternal(byte[] buff, int inputSampleRate, int outputSampleRate) { var floated = buff.AsSpan().Reinterpret().ToArray().Select(b => (float)b); var original = new DiscreteSignal(inputSampleRate, floated); var resampled = new Resampler().Resample(original, outputSampleRate); var max = Math.Abs(resampled.Samples.Max()); var min = Math.Abs(resampled.Samples.Min()); if (min > max) { max = min; } resampled.Attenuate(max / Int16.MaxValue); var defloated = resampled.Samples .Select(Convert.ToInt16).ToArray().AsSpan() .Reinterpret() .ToArray(); return(defloated); }