www.pudn.com > raw-wave-lib-v0.1.zip > testwave.c


#include "wave.h"
#include 
#include 

int main() {
  wave_file_16_bit str;
  double* array;
  int count;
  initialize_wave_struct_from_file(stdin, &str, 0);
  array = (double*)malloc(sizeof(double) * str.num_of_samples * str.channels + 1);
  extract_array_from_struct(&str,array);

  /* lower the volume of the 1st channel as an example */
  for (count = 0; count < str.num_of_samples * 1; ++count) { //only first ch
    array[count] /= 8;

  }

  initialize_wave_struct(&str,array, str.num_of_samples * str.channels, str.sample_rate, str.appendage, str.channels);
  write_out_wave_file(stdout, &str);
  free_wave_struct(&str);
  return 0;
}
//int initialize_wave_struct(wave_file_16_bit* str, double* array, unsigned int array_length, int sample_rate, unsigned int appendage, int channels);
//extract_array_from_struct(str,array)