var waveOut = new WaveOutEvent(); waveOut.Init(new WaveChannel32(new WaveFileReader("audio.wav"))); waveOut.Play();
var waveOut = new WaveOutEvent(); var format = new WaveFormat(48000, 16, 2); var buffer = new BufferedWaveProvider(format); buffer.BufferDuration = TimeSpan.FromSeconds(5); waveOut.Init(buffer); waveOut.Play();In this example, the output device is initialized with custom settings, including a sample rate of 48000 Hz, 16-bit depth, and two channels. The audio is played using a BufferedWaveProvider with a buffer duration of 5 seconds. The WaveOutEvent Init method is part of the NAudio library, which is an open-source C# library that provides a range of audio-related functions, such as playing, recording, mixing, and manipulating audio files.