diff --git a/headeredit.cpp b/headeredit.cpp new file mode 100644 index 0000000..9ca0607 --- /dev/null +++ b/headeredit.cpp @@ -0,0 +1,34 @@ +#include +#include +#include +#include +#include + + +main() +{ + std::vector data; + FILE* f = fopen("outputfileulaw.wav", "rb"); + rewind(f); + while(!feof(f)) + { + unsigned char s; + fread(&s, sizeof s, 1, f); + data.push_back(s); + } + FILE* o = fopen("outputfileulaw.raw", "wb"); + int headersize = 4; + int old_header_size = 58; + unsigned int samples = data.size() - old_header_size; + unsigned char* new_data = (unsigned char*)malloc(sizeof(char) * (samples + headersize)); + //little endian: + new_data[0] = (unsigned char) samples; + samples >>= 8; + new_data[1] = (unsigned char) samples; + samples >>= 8; + new_data[2] = (unsigned char) samples; + samples >>= 8; + new_data[3] = (unsigned char) samples; + memcpy(&new_data[4], &data[58], samples); + fwrite(&new_data[0], sizeof(unsigned char), samples+headersize, o); +} \ No newline at end of file diff --git a/outputfileulaw.raw b/outputfileulaw.raw new file mode 100644 index 0000000..08f3750 Binary files /dev/null and b/outputfileulaw.raw differ diff --git a/outputfileµlaw.wav b/outputfileulaw.wav similarity index 100% rename from outputfileµlaw.wav rename to outputfileulaw.wav