SHARE
TWEET

Untitled

a guest Apr 23rd, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main() {
  6.     FILE *fr = fopen("input.wav", "r");
  7.  
  8.     fseek(fr, 0, SEEK_END);
  9.     long int file_size = ftell(fr);
  10.     fseek(fr, 0, SEEK_CUR);
  11.  
  12.     char *data = malloc(file_size);
  13.     fread(data, file_size, 1, fr);
  14.  
  15.     char *startDataBlock = strstr(data, "data");
  16.     unsigned int block_size = *((unsigned int*)(startDataBlock + 4));
  17.  
  18.     for (int i = 0; i < block_size; i += 2) {
  19.         short value = *((short *) (startDataBlock + 8 + i));
  20.  
  21.         value *= 1.25;
  22.  
  23.         *((short *) (startDataBlock + 8 + i)) = value;
  24.     }
  25.  
  26.     FILE *fw = fopen("output.wav", "wb");
  27.  
  28.     fwrite(data, file_size, 1, fw);
  29.  
  30.     fclose(fw);
  31.  
  32.     fclose(fr);
  33.  
  34.     return 0;
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top