I’m trying to mirror this code
var buffer = output.ToArray();
//The buffer length is divided by 2 because each sample in
//the raw PCM format is encoded as a signed 16-bit integer,
//which takes up 2 bytes of memory. Dividing the buffer
//length by 2 gives the number of samples in the audio data.
var result = new float[buffer.Length / 2];
for (int i = 0; i < buffer.Length; i += 2)
{
short sample = (short)(buffer[i + 1] << 8 | buffer[i]);
//The division by 32768 is used to normalize the audio data
//to have values between -1.0 and 1.0.
//The raw PCM format used by ffmpeg encodes audio samples
//as signed 16-bit integers with a range from -32768
//to 32767. Dividing by 32768 scales the samples to have
//a range from -1.0 to 1.0 in floating-point format.
result[i / 2] = sample / 32768.0f;
}
with this these nodes
and I’m always feeling vertigo when I get near bit operations, I’m always assuming my output is somehow wrong.
How do I patch the above?
H