Array of 4 bytes to double.
Hello all. So I'm looking for a way to convert an array that contains 4 bytes to a double. These bytes are actually 1 sample rate of an audio file, so it contains 2 channels, with each channel being 2 bytes. The bytes are also in Little Endian, so I've heard that you can just swap the bytes for each channel to convert to Big Endian. Example:
Array of bytes: [30, -20, 10, 50]
Left Channel (Little Endian): [30, -20]
Right Channel (Little Endian): [10, 50]
Left Channel (Big Endian): [-20, 30]
Right Channel (Big Endian): [50, 10]
So now that I've got the bytes in Big Endian (is this a valid way?), how can I convert these two channels into one double? I'm not sure if this information is needed, but the sample rate can be either 22050 (22.05 kHz) or 44100 (44.1 kHz), frame rate is 4 bytes / frame (with over all frame rate being the same as the sample rate, so if I want 1 second of audio, it's sample rate * 4 bytes), and it's all stereo (2 channel). If any more information is needed, let me know.