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

Author Topic: Enhanced Music Control  (Read 21694 times)

0 Members and 1 Guest are viewing this topic.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Enhanced Music Control
« Reply #15 on: February 21, 2012, 04:37:06 pm »
I've added a task in the issue tracker, so that this feature won't be forgotten.

https://github.com/SFML/SFML/issues/177
Laurent Gomila - SFML developer

Ryan Bram

  • Newbie
  • *
  • Posts: 6
    • View Profile
Enhanced Music Control
« Reply #16 on: February 22, 2012, 01:29:29 am »
1.
Quote from: "Laurent"

- it's hard to find a library that converts MIDI files to audio samples (most libraries directly play songs)


Have you ever tried OpenMPT? I use it to convert Standard MIDI Files to module music format or even WAV and MP3 format.

2.
Quote from: "Laurent"

- MIDI requires an instrument bank, which is usually too big to be embedded in SFML, and not standard enough not to be embedded in SFML


What the mean of "big" for you? If Roland GS sound font is too big for you (about 3 MB in size) you can use soundfont from Synthfont www.synthfont.com  (only about 1 MB in size)

3.
If you didn't want to implement Standard Midi File support for SFML, how about module music format?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Enhanced Music Control
« Reply #17 on: February 22, 2012, 08:09:11 am »
Quote
Have you ever tried OpenMPT? I use it to convert Standard MIDI Files to module music format or even WAV and MP3 format.

Ok but it's a software, not a library, right? And I haven't looked at their source code yet.

Quote
What the mean of "big" for you? If Roland GS sound font is too big for you (about 3 MB in size) you can use soundfont from Synthfont www.synthfont.com (only about 1 MB in size)

I'm not an expert but I heard that a good instrument bank was at least 10 MB. Others are either bad quality or not complete enough. Well, that's what I remember, it may be wrong ;)
But even 1 MB is a lot, it would be embedded inside the sfml-audio library. And I don't even know if it can be embedded properly.
It would also cause problems such as "my music, played by SFML, is not the same as when I created it" -- because the sound bank was a different one.

Quote
If you didn't want to implement Standard Midi File support for SFML, how about module music format?

Same problem, I have to find a library. But if I remember correctly, there was one (libmodplug?). Don't remember if it was good, maintained and had a compatible license though.
Laurent Gomila - SFML developer

Ryan Bram

  • Newbie
  • *
  • Posts: 6
    • View Profile
Enhanced Music Control
« Reply #18 on: February 22, 2012, 09:19:47 am »
1.
Quote from: "Laurent"
think about how many loop points we want/can have


Two loop point. LOOPSTART (for mentioning starting point when the audio loop back) and LOOPLENGTH (for mentioning ending point for the audio to loop back)

2.
Quote from: "Laurent"
if we have a "start" loop point, is it active right from the start, or only after the first loop?


LOOPSTART only active after the first loop

3.
Quote from: "Laurent"
should we investigate metadata to see if we can enable loop points there for some audio formats, in addition to the C++ API?

Yes we should using metadata

4.
Quote from: "Shy Guy"
But is there a standard for some formats specifying the loop points?
For WAV there is, I think, but what's about OGG vorbis?


In RPG Maker VX we can define loop point in OGG Vorbis format by adding "LOOPSTART:<sample index>" and "LOOPLENGTH :<sample index>" in metadata.
For sample music you can inspect metadata from this file http://www.4shared.com/music/RWLsejla/Battle_1__FF_IV_-_DS_.html and play it with RPG Maker VX (Fully Function for 30 days trial).
For tutorial, you can see http://www.rpgrevolution.com/forums/index.php?showtopic=53387 or

Ryan Bram

  • Newbie
  • *
  • Posts: 6
    • View Profile
Enhanced Music Control
« Reply #19 on: February 22, 2012, 10:04:03 am »
1.
Quote from: "Laurent"
Ok but it's a software, not a library, right? And I haven't looked at their source code yet.

I think this software is modular so you can take just its libraries, and if you want to look to its source code, you can go to https://modplug.svn.sourceforge.net/svnroot/modplug/

2.
Quote from: "Laurent"

I'm not an expert but I heard that a good instrument bank was at least 10 MB. Others are either bad quality or not complete enough. Well, that's what I remember, it may be wrong ;)


Roland GS soundfont (about 3 MB in size) is actually same as GM.dls in Microsoft Windows so you can hear it by yourself how good it sounds. Or if you may you can try Synthfont's soundfont (about 1 MB in size) by downloading it at http://www.synthfont.com/SynthFontSetup.exe and play it or inspect the program folder by yourself.

3.
Quote from: "Laurent"
But even 1 MB is a lot, it would be embedded inside the sfml-audio library. And I don't even know if it can be embedded properly.


Okay, if 1 MB is a lot for you, so you don't need to embed it to SFML. You can distribute SFML as is, then just let the programmer load their own soundfont as you let them load their own true type font and render it with SFML. Because basically .mid for music format is same as .odt for document format.

4.
Quote from: "Laurent"
It would also cause problems such as "my music, played by SFML, is not the same as when I created it" -- because the sound bank was a different one.


It is same case as distributing game with TrueType Fonts. The result may different for every computer, (if the font itself wasn't distributed with the game) but the programmer have more freedom to choose they desired font to distribute within their games.

5.
Quote from: "Laurent"
Same problem, I have to find a library. But if I remember correctly, there was one (libmodplug?). Don't remember if it was good, maintained and had a compatible license though.


libmodplug is actually based on OpenMPT, so currently  it is still maintained. It is very good library because libmodplug is used by many music player, for example Audacious to playback module music format.

According to its site, OpenMPT (since OpenMPT 1.17.02.53) is licensed under 3 clause BSD License that was compatible with SFML.

Tex Killer

  • Full Member
  • ***
  • Posts: 242
    • View Profile
Enhanced Music Control
« Reply #20 on: February 22, 2012, 10:22:37 am »
Laurent and Ryan Bram, take a look at my updated topic about the loop issue in the General Forum:

http://www.sfml-dev.org/forum/viewtopic.php?t=6213

Laurent, about the MIDI, what do you think of making a SFML "add-on" to the audio module? Can you make SFML detect if the add-on is present?

That way anyone would be able to make add-ons of different instrument banks they find, and the ones that do not want MIDI just do not use any of the add-ons, and they would get the current size of SFML.

I also think that would be a lot of trouble, but it seems to be a good solution...

iwflmt

  • Guest
Enhanced Music Control
« Reply #21 on: March 02, 2012, 02:42:11 am »
Quote
Same problem, I have to find a library. But if I remember correctly, there was one (libmodplug?). Don't remember if it was good, maintained and had a compatible license though.

DUMB: cross-platform, BSD-like license, no more maintained (2005), ~200Kb, IT/XM/S3M/MOD support.
libmodplug: cross-platform, public domain, actively supported, ~300Kb, 22 different mod formats, used by GStreamer/MPD/OpenMPT/VLC, the best one I guess (clean code but no doc).

Modules support could be very interesting, but MIDI support in SFML is just stupid (sorry).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Enhanced Music Control
« Reply #22 on: March 02, 2012, 07:52:23 am »
Quote
MIDI support in SFML is just stupid

Can you elaborate on this?
Laurent Gomila - SFML developer

iwflmt

  • Guest
Enhanced Music Control
« Reply #23 on: March 02, 2012, 01:10:11 pm »
MIDI libraries are bigger than SFML itself (plus instruments bank).
OK "stupid" was not appropriated, "unsuitable" is far better (imho).

Btw, you can reduce libmodplug library size dramatically if you just build it with XM, IT, S3M and MOD support only.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Enhanced Music Control
« Reply #24 on: March 02, 2012, 01:17:29 pm »
Quote
MIDI libraries are bigger than SFML itself (plus instruments bank).

I think that people who really need MIDI (and there are) don't care about that ;)
Laurent Gomila - SFML developer

Tex Killer

  • Full Member
  • ***
  • Posts: 242
    • View Profile
Enhanced Music Control
« Reply #25 on: March 02, 2012, 07:37:04 pm »
That is why it would be better to have optional MIDI support... As a SFML branch, or as an add-on.

Gez

  • Newbie
  • *
  • Posts: 4
    • View Profile
Enhanced Music Control
« Reply #26 on: March 05, 2012, 09:44:11 pm »
Since this topic is relatively recent...
Quote from: "iwflmt"
DUMB: cross-platform, BSD-like license, no more maintained (2005), ~200Kb, IT/XM/S3M/MOD support.


Has anyone successfully interfaced DUMB with SFML? I'm attempting to do something with it, but my flailing efforts are met with an amusing variety of problems.

What I've done is take the dumbout example program from DUMB, insert it as a function, and changed it so that it writes in memory instead of a file. Then I LoadFromMemory() into a sound buffer, and attempt to play it. Even if I got it working (rather than crashing or not playing any sound), it's not an optimal approach since it's not real-time anyway (first render the song, then play it).

If there are examples of working code interfacing the two, I'd like to see them. :)

Ryan Bram

  • Newbie
  • *
  • Posts: 6
    • View Profile
Enhanced Music Control
« Reply #27 on: March 14, 2012, 08:29:59 am »
Quote from: "iwflmt"
MIDI libraries are bigger than SFML itself (plus instruments bank).
OK "stupid" was not appropriated, "unsuitable" is far better (imho).


That's why I said that SFML should let its user to choose they desired soundfont (.sf2) instead of bundled SFML together with soundfont (or instruments bank), like SFML support for TrueType font which doesn't need for SMFL to be bundled together with TrueType Font itself (.ttf).

I think just for MIDI library alone isn't as big as you think, because SFML doesn't need all library to manipulate MIDI. It only need some parts of MIDI library for playback MIDI files like the other music formats. Example: OpenMPT, the MIDI and module music tracker together (and base of libmodplug) only need 1.7 MB in size (http://openmpt.org/download).

And, though including MIDI files support for SFML is stupid for you, but why SDL already support it, even far before SFML not already support MIDI files? Plus, SDL now already licensed its license under Zlib license which was as liberal as SFML license.

If SFML really want to compete with SDL, this feature is necessary and not optional, or SFML will be left by SDL.

Regards,
RyanBram

julen26

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
    • http://julen26.blogspot.com
Enhanced Music Control
« Reply #28 on: March 14, 2012, 10:25:07 am »
Quote from: "Ryan Bram"
If SFML really want to compete with SDL

I don't think SFML wants to compete with SDL, it just provides faster results on graphics API and an easier interface.

NinjaFighter

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
    • http://www.sebagames.wordpress.com
Re: Enhanced Music Control
« Reply #29 on: May 28, 2012, 11:32:11 pm »
Could be easy to do a only function "SetLoopStart(uint32 aLoopStart)"? without need to set LoopEnd, because, the SetLoopStart is more useful for music playback. The loop end, is useful for custom sound effects, like samples or whatever that can change his duration without have to change the pitch.
If OpenAL provides a way for set the loop start point, I think that SFML2 could set this parameter too, if not, I think that's too much unnecesary work. But I think will be very useful if I can set loop start, at least. :)
« Last Edit: May 28, 2012, 11:34:45 pm by NinjaFighter »

 

anything