private static int test11_ReadWrite16BitsStereo__double__WAVFile() { WAV_file my_wav_file = new WAV_file(); my_wav_file.File_name = "test05_A440_16_Bits_Stereo.wav"; Console.WriteLine("Nome: " + my_wav_file.File_name); my_wav_file.Path = ".\\"; // my_wav_file.Path = ".\\Debug\\wav_files\\"; Console.WriteLine("Path: " + my_wav_file.Path); my_wav_file.loadFile(); Console.Write(my_wav_file.toWAVHeaderString()); double[] buffer_double_left; double[] buffer_double_right; uint numberOfSamples = (uint)my_wav_file.getBuffer_double_stereo_normalized(out buffer_double_left, out buffer_double_right); // Buffer processing. Console.WriteLine(); Console.WriteLine(); for (uint i = 0; i < numberOfSamples; i++) { // Console.Write( buffer_double_left[i].toString() + "."); // Console.Write( buffer_double_right[i].toString() + "."); } Console.WriteLine(); Console.WriteLine(); // We are going to save the file on the hard drive with another name. my_wav_file.File_name = "test11_A440_16_Bits_Stereo.wav"; my_wav_file.initializeWaveHeaderStructBeforeWriting(); my_wav_file.setBuffer_double_stereo_normalized(buffer_double_left, buffer_double_right); my_wav_file.writeFile(); return 0; }
private static int test01_ReadWrite8BitsMonoWAVFile() { WAV_file my_wav_file = new WAV_file(); my_wav_file.File_name = "dog_bark.wav"; Console.WriteLine( "Nome: " + my_wav_file.File_name ); my_wav_file.Path = ".\\"; // my_wav_file.Path = ".\\Debug\\wav_files\\"; Console.WriteLine( "Path: " + my_wav_file.Path ); my_wav_file.loadFile(); Console.Write(my_wav_file.toWAVHeaderString()); System.Byte[] buffer_8_bits_Mono; uint numberOfSamples = (uint) my_wav_file.getBuffer_8_bits_mono( out buffer_8_bits_Mono); // Buffer processing. Console.WriteLine(); Console.WriteLine(); for (uint i = 0; i < numberOfSamples; i++) { // Console.Write( buffer_8_bits_Mono[i].toString() + "."); } Console.WriteLine(); Console.WriteLine(); // We are going to save the file on the hard drive with another name. my_wav_file.File_name = "test01_dog_bark_saved.wav"; my_wav_file.initializeWaveHeaderStructBeforeWriting(); my_wav_file.setBuffer_8_bits_mono(buffer_8_bits_Mono); my_wav_file.writeFile(); return 0; }
private static int test05_Read16BitsMonoWrite16bitsStereoWAVFile() { WAV_file my_wav_file = new WAV_file(); my_wav_file.File_name = "test03_A440_16_Bits_Mono.wav"; Console.WriteLine("Nome: " + my_wav_file.File_name); my_wav_file.Path = ".\\"; // my_wav_file.Path = ".\\Debug\\wav_files\\"; Console.WriteLine("Path: " + my_wav_file.Path); my_wav_file.loadFile(); Console.Write(my_wav_file.toWAVHeaderString()); System.Int16[] buffer_16_bits_Mono; uint numberOfSamples = (uint)my_wav_file.getBuffer_16_bits_mono(out buffer_16_bits_Mono); // Buffer processing. Console.WriteLine(); Console.WriteLine(); for (uint i = 0; i < numberOfSamples; i++) { // Console.Write( buffer_16_bits_Mono[i].toString() + "."); } Console.WriteLine(); Console.WriteLine(); // We are going to save the file on the hard drive with another name. my_wav_file.File_name = "test05_A440_16_Bits_Stereo.wav"; my_wav_file.NumOfChannels = WAV_file.NUM_CHANNELS.TWO; my_wav_file.initializeWaveHeaderStructBeforeWriting(); my_wav_file.setBuffer_16_bits_stereo(buffer_16_bits_Mono, buffer_16_bits_Mono); my_wav_file.writeFile(); return 0; }