I need to write such a code that would send the sound of one frequency to the right channel (right speaker) and to the left another.

I want to implement under .NET using DirectSound, I write in C #.

Tell me some methods, functions, classes from DirectX libraries (or others if you know) that allow you to work with sound at a low level, that is, so that you can set the frequency.

    1 answer 1

    First option. Synthesize sound in any sound processing program and write to a file, then play:

    SoundPlayer sp = new SoundPlayer(); sp.SoundLocation = @"beep.wav"; sp.Play(); 

    The second option. Use speaker

     // Пищит в течение одной секунды с частотой 1кГц Console.Beep(1000, 1000); 

    The third option. There is a good sound library for .NET: NAudio . Using her

     var sineWaveProvider = new SineWaveProvider32(); sineWaveProvider.SetWaveFormat(16000, 1); // 16kHz mono sineWaveProvider.Frequency = 1000; sineWaveProvider.Amplitude = 0.25f; waveOut = new WaveOut(); waveOut.Init(sineWaveProvider); waveOut.Play(); 
    • Thank you very much! The third option is just for me. So far, you answered something with a secondarybuffer, but it turned out too clumsy. - Neamtu Daniel