But when i get this RAW Data from a Memorystream and put a WAVEFORM header in front. Sound is overdriven and crackling.
Here is my code
- Code: Select all
/*
* NOTE: data is an array representing the raw PCM data as a floating point type, i.e. 4-byte value(s)
* Based on noOfFrames and the channels value passed to IAudioHandler.OnAudioStreamStarted
* you can calculate the size of the data array in bytes.
*
* Audio data (PCM, 32-bit, float) will be save to rawAudioFile stream.
*/
unsafe
{
float** channelData = (float**)data.ToPointer();
int size = channelCount * noOfFrames * 4;
byte[] samples = new byte[size];
fixed (byte* pDestByte = samples)
{
float* pDest = (float*)pDestByte;
for (int i = 0; i < noOfFrames; i++)
{
for (int c = 0; c < channelCount; c++)
{
*pDest++ = channelData[c][i];
}
}
}
//if (BitConverter.ToInt32(samples, 0) != 0)
//{
// rawAudioFile.Write(samples, 0, size);
//}
ms.Write(samples, 0, size);
}
Bellow is a sample in base64 after adding header (You can hear to it using https://base64.guru/converter/decode/audio).
Any help is very welcome. I don't understand that this is not sounding properly. Sounds like to high volume or something. I use CefSharp Nuget 107.1.5 and i'm using the Windows Forms one not the offscreen browser.
Sample:
[sample to large]
uploaded here:
https://drive.google.com/file/d/13sfbnt ... share_link