Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement