您可以使用具有播放功能的.NET 库。 DryWetMIDI 允许这样做(示例显示通过默认 Windows 合成器播放 MIDI 文件):
var midiFile = MidiFile.Read("Greatest song ever.mid");
// Or you can read a MIDI file from a stream
// var midiFile = MidiFile.Read(stream);
using (var outputDevice = OutputDevice.GetByName("Microsoft GS Wavetable Synth"))
{
midiFile.Play(outputDevice);
}
You can use a .NET library that has playback functionality. DryWetMIDI allows this (example shows playing a MIDI file via default Windows synthesizer):
var midiFile = MidiFile.Read("Greatest song ever.mid");
// Or you can read a MIDI file from a stream
// var midiFile = MidiFile.Read(stream);
using (var outputDevice = OutputDevice.GetByName("Microsoft GS Wavetable Synth"))
{
midiFile.Play(outputDevice);
}
You can read more about playing MIDI data on the library docs: Playback.
发布评论
评论(3)
好吧,我做了一个临时解决方案。
仍然有效
Ok, i made kind of a temporary solution.
Still, it works
您可以使用 SoundPlayer 类:
You can use the SoundPlayer class:
您可以使用具有播放功能的.NET 库。 DryWetMIDI 允许这样做(示例显示通过默认 Windows 合成器播放 MIDI 文件):
您可以阅读有关播放的更多信息库文档上的 MIDI 数据: 播放。
You can use a .NET library that has playback functionality. DryWetMIDI allows this (example shows playing a MIDI file via default Windows synthesizer):
You can read more about playing MIDI data on the library docs: Playback.