如何使用 NAudio 将波形立体声文件转换为单声道并将其作为 blob 返回

问题描述

我正在使用以下代码将 Wave 立体声转换为使用 Naudio 的单声道文件

try
{
    // convert our stereo ISampleProvider to mono
    var mono = new StereoToMonoSampleProvider(inputReader)
    {
        LeftVolume = 1.0f,// if discard the left channel keep  0.0f
        RightVolume = 1.0f // keep the right  channel
    };
    var root = _config.GetValue<string>("Downloadpath");
    if (!Directory.Exists(root))
    {
        Directory.CreateDirectory(root);
    }
    string tempFile = Path.Combine(root,$"MonoFile-{DateTime.UtcNow:yyyyMMddTHHmmssfff}.wav");
    _logger.Loginformation(tempFile,"file location");
    WaveFileWriter.CreateWaveFile16(tempFile,mono);
    _logger.Loginformation("Write Mono File Successful");
}

任何人都可以帮助如何将转换后的文件作为 blob 返回

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)