本文整理汇总了C#中NAudio.Wave.Mp3FileReader.ToSampleProvider方法的典型用法代码示例。如果您正苦于以下问题:C# Mp3FileReader.ToSampleProvider方法的具体用法?C# Mp3FileReader.ToSampleProvider怎么用?C# Mp3FileReader.ToSampleProvider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NAudio.Wave.Mp3FileReader
的用法示例。
在下文中一共展示了Mp3FileReader.ToSampleProvider方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CombineAudioSignal
/// <summary>
/// Takes 1 wave file, Takes 1 Mp3 File and Combines the two files and resaves on top of the wav.
/// </summary>
/// <returns></returns>
public string CombineAudioSignal()
{
var audioPath = _file.Remove(0, _file.IndexOf("Uploads"));
var server = HttpContext.Current.Server;
var directoryInfoBeats =
new DirectoryInfo(new ResourceProvider().GetPath(RapResource.Beats));
var sortedFiles = from f in directoryInfoBeats.EnumerateFiles() orderby f.CreationTime select f;
var beats = sortedFiles.Select(item => item.FullName).ToList();
using (var recordedAudio = new WaveFileReader(server.MapPath("~/" + audioPath)))
using (var instrumental = new Mp3FileReader(beats[_beatLocation]))
{
var inputs = new List<ISampleProvider>
{
recordedAudio.ToSampleProvider(),
instrumental.ToSampleProvider(),
};
var mixer = new MixingSampleProvider(inputs);
//requires work to avoid overriding the file being used
WaveFileWriter.CreateWaveFile16(
new ResourceProvider().GetPath(RapResource.RapBattleAudio) + new Guid() + ".wav", mixer);
}
return _file;
}
示例2: ReadMp3File
private static ISampleProvider ReadMp3File(Mp3FileReader reader, CompositeDisposable disposables)
{
disposables.Add(reader);
return reader.ToSampleProvider();
}