You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An audio file converted to PCM will be many 10s if not hundreds of MB, so not necessarily surprising that it can't be allocated. The recommended way of processing the audio in a file is to work your way through it in buffers (e.g. 1 second of audio at a time)
An audio file converted to PCM will be many 10s if not hundreds of MB, so not necessarily surprising that it can't be allocated. The recommended way of processing the audio in a file is to work your way through it in buffers (e.g. 1 second of audio at a time)
How to through it in buffers? like this:
int windowSize = 1048576 * 2000;
byte[] buffer = new byte[windowSize];
long readLiength = 0;
while ((readLiength = await _audioFileReader.ReadAsync(buffer.AsMemory(0, windowSize))) > 0)
{
float[] wavdata = new float[buffer.Length / 4];
Buffer.BlockCopy(buffer, 0, wavdata, 0, buffer.Length);
float[] samples = wavdata.Select((float x) => x * 32768f).ToArray();
result.Add(samples);
buffer = new byte[windowSize];
}
I use AudioReaderFile.Read large file ,it
Throws an exception like this
The text was updated successfully, but these errors were encountered: