【问题标题】:C# NAudio 3D SoundC# NAudio 3D 声音
【发布时间】:2019-03-04 12:14:53
【问题描述】:

我编写了一个可以正常播放声音的程序,但是如何设置 3D 声音的位置,或者至少可以设置声音在右侧应该有多强以及声音有多强应该在左边?

到目前为止,这是我的代码:

WaveOut wavOut = new WaveOut();
            wavOut.Init(new BlockAlignReductionStream(new WaveFileReader(File.OpenRead("Wav File")));
            wavOut.Play();

            while(wavOut.PlaybackState == PlaybackState.Playing)
            {
                Thread.Sleep(250);
            }

【问题讨论】:

    标签: c# audio naudio


    【解决方案1】:

    假设你有一个立体声录音,它没有“3D”组件。

    也许您想改为调整左右声道的响度。如果是这样,您可以尝试使用 WaveChannel32 类来控制平移 - 请参阅此处:https://github.com/naudio/NAudio/blob/e359ca0566e9f9b14fee1ba6e0ec17e4482c7844/NAudio/Wave/WaveStreams/WaveChannel32.cs

    将 WaveFileReader 传递给它并提供适当的平移值 (-1 >= x

    WaveOut wavOut = new WaveOut();
    wavOut.Init(new WaveChannel32(new WaveFileReader(File.OpenRead("WavFile"), 0, 0)); // the last argument in the WaveChannel32 is the pan value
    wavOut.Play();
    

    【讨论】:

      猜你喜欢
      • 2012-04-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-21
      • 1970-01-01
      相关资源
      最近更新 更多