Skip to content

Instantly share code, notes, and snippets.

@bothie
Created August 24, 2019 17:24
Show Gist options
  • Save bothie/8c2261912cdc625bfee60fa2969bccad to your computer and use it in GitHub Desktop.
Save bothie/8c2261912cdc625bfee60fa2969bccad to your computer and use it in GitHub Desktop.
Example of a possible new audio wave file format for practical use with high sample rates and depths that will overwhelm RIFF WAVE due to exceeding maximum file size of 2/4GB
#include <stdint.h>
/*
* Sample encodings
*/
#define SE_PCM_ULE 0 // Puls-Code-Modulation with unsigned integers least significant byte fist (little endian)
#define SE_PCM_UBE 1 // Puls-Code-Modulation with unsigned integers most significant byte fist (big endian)
#define SE_PCM_SLE 2 // Puls-Code-Modulation with signed integers least significant byte fist (little endian)
#define SE_PCM_SBE 3 // Puls-Code-Modulation with signed integers most significant byte fist (big endian)
#define SE_PCM_FLE 4 // Puls-Code-Modulation with floating point values least significant byte fist (little endian)
#define SE_PCM_FBE 5 // Puls-Code-Modulation with floating point values most significant byte fist (big endian)
struct wave64_header {
uint64_t magic; // Reads as "WAVE64\0\0"
uint64_t header_size; // Size of this header excluding the fields magic and header_size, 16 for the header format presented here
uint64_t rate; // Sample rate
uint16_t bit_depth; // Number of bits per sample
uint16_t channels; // Number of channels, i.e. 1 for mono, 2 for stereo, 6 for full DOLBY Digital 5.1
uint32_t sample_encoding; // Format of each individual sample.
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment