Closed Connor14 closed 5 years ago
Do you open any actual MIDI output device/software? ALSA default MIDI port is "MIDI through" which has no sound output.
I don't have any MIDI specific output devices or software connected, which is definitely the problem.
I thought the player would interpret the MIDI and play it to speakers (like any other audio file) or a MIDI output device depending on the configuration. It played directly to speakers in Windows so I assumed it would work the same way in Linux. But that's probably because Windows has some additional functionality built in. I guess I just misunderstood what the MidiPlayer was doing.
Ultimately what I was looking for is a way to take in a MIDI file and spit out audio. The best way to do that might be by "rendering" it to a WAV or MP3 and then playing that back separately.
Exactly. Windows has built-in "Microsoft GS Wavetable Synth". On Linux there is timidity or fluidsynth (which also needs some attention on how to use it; it needs soundfont file as the command line argument) that work like MS GS Synth. On Mac I have no idea. Fluidsynth should build on Mac too, but I don't see any package.
For audio rendering fluidsynth is an easy option on Linux. It has file rendering "audio driver". (disclaimer: I am a fluidsynth contributor so it's from very personal point of view.)
I think I'll use FluidSynth. It works great so far!
I am working on an app written in .NET Core using this library and it works great on Windows. I tried it on my Ubuntu 18.04 installation and I got this exception:
I tried installing
libasound2-dev
and that resolved the exception, but no sound was played. I am running the my compiled program usingdotnet DemoPlayer.dll
from my terminal.Here is the code used to play the midi:
The
Console.WriteLine
was shown and my computer was definitely doing something becausehtop
showed 2 threads running at 100% here and there. After the midi finished playing, the program ended.I just don't hear any sound. It's probably a missing package on my end but I'm not sure which one.