private float[] Downsample(float[] array) { var wrapper = new ResamplerWrapper(1); var processed = wrapper.Engage(array, out float[] result, 48000, 16000); return(result); }
private WaveBuffer Downsample(WaveInEventArgs e) { Buffer.BlockCopy(e.Buffer, 0, _floats, 0, e.BytesRecorded); var resampler = new ResamplerWrapper(2); var samplesProcessed = resampler.Engage(_floats, e.BytesRecorded / 4, out var resampled, SampleRateIn, SampleRateOut); if (_debug) { Console.WriteLine($"processed {samplesProcessed} samples"); } Buffer.BlockCopy(resampled, 0, _buffer, 0, resampled.Length * 4); return(new WaveBuffer(_buffer) { FloatBufferCount = samplesProcessed }); }