Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: MIDI support  (Read 23293 times)

0 Members and 1 Guest are viewing this topic.

Russell

  • Newbie
  • *
  • Posts: 7
    • View Profile
MIDI support
« on: August 20, 2008, 10:32:52 am »
Does SFML support MIDI at all?

I tried writing a small program, while I got the other formats to work, midi files don't.

Avency

  • Full Member
  • ***
  • Posts: 113
    • View Profile
MIDI support
« Reply #1 on: August 20, 2008, 10:53:05 am »
As far as I know, sfml doesn't support midi.
You can try to render them into another format like ogg vorbis.
Also, portable midi support is unlikely to happen.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
MIDI support
« Reply #2 on: August 20, 2008, 11:11:29 am »
MIDI is not easy to support. I still haven't found a decent portable library to load them ; I don't even know if it will be compatible with the current system, as playing MIDIs is different from playing audio samples. I guess I should find a library to convert MIDI sequences to sample buffers.
Laurent Gomila - SFML developer

Russell

  • Newbie
  • *
  • Posts: 7
    • View Profile
MIDI support
« Reply #3 on: August 20, 2008, 11:52:04 am »
You could take the SDL approach, but use a much much newer version of timidity, like timidity++. :o

Not the best option, but the only option for unices?  :?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
MIDI support
« Reply #4 on: September 18, 2008, 09:36:07 pm »
Some news about MIDI support : I've recently tried WildMidi, which is a much simpler library than Timidity++. It works fine, but requires tons of configuration files for MIDI instruments. I still don't know how to handle this "automatically".
Laurent Gomila - SFML developer

Russell

  • Newbie
  • *
  • Posts: 7
    • View Profile
MIDI support
« Reply #5 on: September 19, 2008, 11:13:57 am »
Ah nice, wildmidi seems to work well, I tried out the midi player.

I found that you can put a standard timidity.cfg (which points to the location of the sf2's/gus patches) in the directory where the wildmidi library is located, that works well on windows atleast.

It appears the latest version of wildmidi is released under GPLv2 (including the library), but the author stated on his website that it has been changed to (L)GPLv3 in newer source files.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
MIDI support
« Reply #6 on: September 19, 2008, 01:17:25 pm »
Quote
I found that you can put a standard timidity.cfg (which points to the location of the sf2's/gus patches) in the directory where the wildmidi library is located, that works well on windows atleast.

And this configuration file points to several instrument files. The problem is, how to provide all these files with SFML ?
It would be nice to find a way to use any standard instrument files installed with the OS / audio driver / whatever (I guess that's what DirectMusic does on Windows).
Laurent Gomila - SFML developer

Russell

  • Newbie
  • *
  • Posts: 7
    • View Profile
MIDI support
« Reply #7 on: September 20, 2008, 01:40:08 am »
Well, you can point people to instrument sets on the net, like freepats (~30mb package), which is under the gplv2

Windows has a system called DLS (or DownLoadable Sounds), its supposed to be a patch system (and there is even specs for it on the net), most systems (XP+) come with a GM.DLS file

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
MIDI support
« Reply #8 on: September 21, 2008, 08:07:31 pm »
It seems WildMidi is unable to load DLS files, nor SF2. Timidity++ does, but is under GPL which is not compatible with SFML :(
Laurent Gomila - SFML developer

Russell

  • Newbie
  • *
  • Posts: 7
    • View Profile
MIDI support
« Reply #9 on: September 22, 2008, 02:17:55 am »
Bugger :(

I did find something else though: http://portmedia.sourceforge.net/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
MIDI support
« Reply #10 on: September 23, 2008, 10:39:25 pm »
PortMedia doesn't seem to be able to convert a MIDI file to a sampled sound. It only handles MIDI sounds directly.
Laurent Gomila - SFML developer

eleinvisible

  • Newbie
  • *
  • Posts: 47
    • View Profile
MIDI support
« Reply #11 on: September 24, 2008, 12:29:22 am »
Hmm, aren't .it/.mod files similar to MIDI files? If they are then DUMB might be an option. Then again I've never used any MIDI formats...
Edit: Ah never mind, it appears to have the same problem as Port Media.

Russell

  • Newbie
  • *
  • Posts: 7
    • View Profile
MIDI support
« Reply #12 on: December 19, 2008, 03:42:32 pm »
Hi again :)

I was scouring the internet again and came across this: http://www.fluidsynth.org

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
MIDI support
« Reply #13 on: December 19, 2008, 05:13:25 pm »
This project looks interesting, but there's almost no documentation so I don't know if it can just provide decoded samples instead of playing the MIDI files directly.
Laurent Gomila - SFML developer

Russell

  • Newbie
  • *
  • Posts: 7
    • View Profile
MIDI support
« Reply #14 on: December 19, 2008, 11:51:00 pm »
Damn :/

There is a frontend program: http://qsynth.sourceforge.net/ which can (apparently) dump the output to a file

I don't know if the code is of any help though