Musically speaking...

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
spankyquinton
DCEmu Newbie
DCEmu Newbie
Posts: 1
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Tue Feb 18, 2003 7:15 am
Has thanked: 0
Been thanked: 0
Contact:

Musically speaking...

Post by spankyquinton »

Hey ! Just wondering if anyone has a good idea of how to implement MIDI music into a DC game ? Is it possible using libdream or should I upgrade to KOS ? Thanks...
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

You'd be better off using KOS all around - it's faster, has more features, and just works better than libdream.

KOS doesn't have anything to read MIDI files by itself, but you can use SDL and SDL Mixer to play MIDI files. I don't know how to do this on a Dreamcast, but it should be possible. Bero's ports of Doom, Heretic, Hexen and Rise of the Triad all use MIDI music.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5661
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Post by BlueCrab »

In order to play MIDI music you're really gonna need to use SDL and SDL_mixer as BlackAura already said. SDL comes with version 1.1.9 of KOS, and you can get SDL_mixer from my site.
Be warned, implementing MIDI music will severely bloat your game due to the fact that you have to include a set of MIDI patches which totals up to about 17MB. That being said, I'd just use a program like ModPlug Tracker, and change the MIDI's over to MOD's, you can still use SDL_mixer to play them, or you can use stuff that is already in KOS
Warmtoe
DC Developer
DC Developer
Posts: 453
Joined: Thu May 16, 2002 8:29 am
Location: ice88's house
Has thanked: 0
Been thanked: 0
Contact:

Post by Warmtoe »

I've been wondering about this - I want to play some background music
in BLOOP - don't want to use SDL as I'm based on KOS 1.1.8 at the moment - what are the built in formats I can use?

I'm familiar with .mod (old Amiga modules) - so if they can be simply played I'd go that route - or MP3 perhaps?

Any help?

-W-
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5661
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Post by BlueCrab »

KOS has supported MOD's for as long as I can remember, through libmodplug, but I've never used it. MP3's are also supported but if you use them, your program will be infected by the GPL. WAV files are supported also, but they are fairly large. Also you can use ADPCM. All sound that I've done in any games has been OGG Vorbis files.

So to sum it up, you can use MOD's, MP3's, WAV's, ADPCM WAV's, or OGG Vorbis files for sound.
ragnarok2040
DC Developer
DC Developer
Posts: 462
Joined: Wed Oct 17, 2001 7:44 pm
Has thanked: 0
Been thanked: 0

Post by ragnarok2040 »

KOS's libmodplug, I've been looking at it and although it defines mod-type midi's, there're no midi load functions. I suggest getting modplug tracker and saving your midi's into either .it format or .xm, they seem to sound the best, and import the midi instruments from your soundcard's dls file (it's usually located in C:\windows\ or C:\windows\system).

Other than that, use ogg vorbis, it can compress music files a lot smaller than mp3 and still sounds great, but, you'll need a music application that supports a midi software synthesizer so you can convert them. Awave Studio has one, not sure what else does.
crt0
DC Developer
DC Developer
Posts: 290
Joined: Wed Oct 17, 2001 7:44 pm
Has thanked: 0
Been thanked: 0

Post by crt0 »

MP3's are also supported but if you use them, your program will be infected by the GPL.
Don't spread more FUD where it's not needed. I'd venture to say that whatever MP3 library KOS uses is under the LGPL, which would mean you don't have to open up code that links to it, only changes made to the library.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5661
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Post by BlueCrab »

Nope, the MP3 library in KOS is xingmp3, which is covered by the GPL.
Dan Potter, in the KOS FAQ file wrote:0.2

Q) What is the GPL license? What exactly do its terms mean?

Q) Can I make a proprietary / "closed source" program using XingMP3?

Q) Can I distributed "forked" versions of XingMP3?

A) The GPL says (again, in layman's terms) that if you make a derivative
work (e.g., use its code in your program), then your program must be
distributed under the terms of the GPL. Note that this does not mean you
must change your license, as some people would say (excellent example:
the Linux kernel contains BSD-licensed code, and BSD's kernel contains
_optional_ GPL'd kernel modules). It does, however, mean that you must
follow the GPL's terms for distribution. Additionally, if you make
significant changes to the XingMP3 library (a direct derivative) then
you must make the result licensed under the GPL.

I use XingMP3 as the example here because it is going to be the one
people have the most encounters with in their own programs. Genromfs is
distributed along with KOS (aggregated) but is not part of it. XingMP3,
however, is also "aggregated" but becomes a part of your program if you
link the MP3 playback library. So if you want to do this, pay attention.

This example is most analogous to the BSD kernel situation. They have a
GPL'd math library that may be linked with the BSD kernel, but the
resulting binary must always be accompanied by all of its source code
(i.e., distributed under the terms of the GPL). The same is true with
your own programs. You may not use the MP3 library without following
similar restrictions: you may license it under any GPL-compatible
license, but you may not distribute any part of it as a proprietary
application.

You may distributed "forked" versions of XingMP3, following the same
restrictions. They must be licensed under the GPL license. You may add
entirely new files to the library, licensed under a different license,
but they must be distributable under the GPL's terms.

Now then, if you don't like those restrictions, you are free to replace
the XingMP3 engine with something else. In fact I would be overjoyed if
someone provided me with a BSD-licensed MP3 engine. But for now, those
are the breaks. Sorry.

Also, to keep you safe from accidentally linking GPL'd code into your
program, 100% of this code is located inside the "xingmp3" tree in the
"addons" tree. All headers in the global "headers" tree are either ours
or otherwise BSD-style licensed.
I just wanted to state that it would infect the code since many people do not like releasing the source to their programs, and I just thought that I'd make it known that they'd have to... Sorry if I've offended anyone
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

I used modplug in nxDoom, and it works fine. I can only play MOD, S3M, IT and XM format songs, which are produced by some kind of tracker program, as common on the Amiga. It can't play MIDI-style songs unless you convert them first.

And the MIDI patches library I have (which can be used with Timidity, which SDL uses) is only about 4MB.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5661
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Post by BlueCrab »

I must have the larger set of patches. I have the entire timidity patch set.
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

I have another which is 18MB, and I know of others that are much, much larger (40MB+).
Post Reply