Hi everybody!
I would want to know how i can play .mid file sounds in a love game with several soundfonts (.sf2, are instruments) without sounding very horrible. I've seen a lot of libreries that supports midi, but i don't know how i can use them.
I want to use .mid because the other audio formats are very heavy. Could someone explain me how i can do this?
Love2d and .mid files
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Love2d and .mid files
At least two MIDI related projects exist, but as far as i can tell, one used a dll to hook into the MIDI device set to default on windows, which isn't cross-platform (and probably isn't developed further currently), while the other, which does use a soundfont player as dependency, might be what you want, but i don't know the current state of that project, sadly.
That said, if we'd knew the correct path that libmodplug (in löve) expects for timidity patches, then MIDI files would probably sound at least marginally better, with distinguishable instruments.
Edit: Should be one of the following: "C:\\TIMIDITY\\INSTRUMENTS" "/usr/local/share/timidity/instruments" "/usr/share/timidity/patch"
"/usr/local/share/timidity/timidity.cfg" "/etc/timidity.cfg"
That said, if we'd knew the correct path that libmodplug (in löve) expects for timidity patches, then MIDI files would probably sound at least marginally better, with distinguishable instruments.
Edit: Should be one of the following: "C:\\TIMIDITY\\INSTRUMENTS" "/usr/local/share/timidity/instruments" "/usr/share/timidity/patch"
"/usr/local/share/timidity/timidity.cfg" "/etc/timidity.cfg"
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: Love2d and .mid files
Well yeah sounds are data-heavy, you'll just have to deal with it. Choosing midi over waveform formats just for file size is a poor decision, especially now that soundcard manufacturers don't bother anymore with proper midi support, oftentimes you can't get midi to play at all, not without resorting to software rendering. If you want small music files that badly, consider using module tracker formats, most common being those of impulse tracker, modplug tracker and fast tracker 2. Otherwise, choose what sounds best.
Re: Love2d and .mid files
I looked into playing MIDI files with LÖVE for Thrust II Reloaded. Timidity patches turned out to be pretty broken. https://sourceforge.net/p/modplug-xmms/bugs/19/
My advice: don't, because it won't be cross-platform. I ended up converting the MIDI file to ogg (and later a musician made a better song anyway).
My advice: don't, because it won't be cross-platform. I ended up converting the MIDI file to ogg (and later a musician made a better song anyway).
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Love2d and .mid files
Proper MIDI support is iffy, not only because the actual soundbanks have exactly zero to do with MIDI itself, but also because some companies had proprietary extension messages (Yamaha XG, Roland GS, also incompatible) that aren't emulated by nigh anything (not that that many files even use those, mind you).raidho36 wrote:Well yeah sounds are data-heavy, you'll just have to deal with it. Choosing midi over waveform formats just for file size is a poor decision, especially now that soundcard manufacturers don't bother anymore with proper midi support, oftentimes you can't get midi to play at all, not without resorting to software rendering. If you want small music files that badly, consider using module tracker formats, most common being those of impulse tracker, modplug tracker and fast tracker 2. Otherwise, choose what sounds best.
Also, even GM (General MIDI, or at least MPU-401 compatible) doesn't define what note "velocity" is... so you can't rely on a mid file having the same mixing level across soundfonts or patches.
Also, older soundcards used FM synthesis for sounds. Whether one prefers PC Speaker, Tandy, AdLib, GUS or SB patches, or a Hardware soundbank like Roland SC-88 had it, is really subjective.
I agree that with most soundcards, one needs to resort to software rendering, but depending on the renderer, the sound will vary. (Yes, the default windows one is bad.)
I'd also agree with using a tracker module format, even if you don't want to hand-convert notes, for example, OpenMPT can import midi, and save it (with instruments) as a module. It'll be a bit bigger than a mid file, but still less than an ogg or mp3. You can even use different samples for the various instruments, if you're not satisfied by what MPT uses by default (again, you shouldn't be).
So yeah, either have it fully rendered as an ogg, or make it/them into tracker modules.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Who is online
Users browsing this forum: Ahrefs [Bot] and 6 guests