private static int test03_generate16BitsMono440HzWAVFile() { 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); const System.UInt32 C_SAMPLES_PER_SEC = 8000; const System.UInt32 C_TIME_SEC = 5; my_wav_file.BitsPerSample = WAV_file.BITS_PER_SAMPLE.BPS_16_BITS; my_wav_file.NumOfChannels = WAV_file.NUM_CHANNELS.ONE; my_wav_file.SampleRate = C_SAMPLES_PER_SEC; my_wav_file.NumberOfSamples = C_SAMPLES_PER_SEC * C_TIME_SEC; // 5 segundos my_wav_file.initializeWaveHeaderStructBeforeWriting(); System.Int16[] buffer_16_bits_Mono; // Allocate the memory for the buffer. my_wav_file.getBuffer_16_bits_mono(out buffer_16_bits_Mono); // Fills the buffer with a sinusoidal. float alphaAngle = 0; const System.UInt32 C_SIGNAL_FREQUENCY = 440; // 440 Hz La (A) for (uint i = 0; i < my_wav_file.NumberOfSamples; i++) { buffer_16_bits_Mono[i] = (System.Int16) (Math.Round(Math.Sin(alphaAngle) * System.Int16.MaxValue)); alphaAngle += (2 * (float)(Math.PI) * C_SIGNAL_FREQUENCY) / C_SAMPLES_PER_SEC; } my_wav_file.setBuffer_16_bits_mono(buffer_16_bits_Mono); my_wav_file.writeFile(); return 0; }