Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Poll

What do you think of adding MIDI music to Liberal Crime Squad?

Yes, let's do this, retro MIDI music would go perfectly with this game's retro look plus it would be great for modding and hardly add anything to the game's disk space and be easy to disable and work on all platforms.
- 43 (81.1%)
No, because I don't want music added, period, even if there is an easy option to disable it and even if the file size for music files is incredibly tiny and even if it's cross-platform and even if modders can customize it with their own music.
- 2 (3.8%)
No, because I'm an audiophile and don't like the MIDI format, I prefer stuff like hi-fi lossless 5.1 surround sound, even if that means huge music files, it's either that or no music at all, and anyone who listens to MIDI music has bad taste.
- 3 (5.7%)
Maybe, I don't care, whatever, I have no opinion on this, leave me alone, I don't like having to answer these stupid polls and I could care less what you do with the game.
- 4 (7.5%)
Other, my opinion on this is different from any of the ones above, stop trying to pigeonhole me, I have a very unique, insightful viewpont on this which your poll failed to anticipate (leave details about your "Other" vote in a comment).
- 1 (1.9%)

Total Members Voted: 52


Pages: [1] 2 3

Author Topic: Idea: add MIDI music to LCS  (Read 8678 times)

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
Idea: add MIDI music to LCS
« on: August 09, 2014, 10:58:07 pm »

Alright so I'm a programmer on this game, I just wanted to suggest this idea to see what people's reaction is so I know whether or not implementing this is a good idea.

MIDI Music.

It's a music format with very small file size, the format has been in use for decades, much smaller than OGG or MP3, the exact sound of the instruments might be different depending on your system, but it sounds mostly the same. It has been implemented on pretty much all platforms, and was the most widely used music format back the days of DOS and Windows 3.1.

Advantages: we can add a LOT of music to the game, without significantly increasing the size of the game. The music files would be MIDI files with the .mid file extension, stored in the art directory. This would also make it possible for modders to customize the game by replacing the .mid files with their own MIDI files that they like better. There is a large amount of public domain or Liberally licensed MIDI music that has been released over the decades that would be 100% legal to use in a GNU GPL game, so we wouldn't even need to make any. The music would work on all operating systems that the game currently works on (Windows, Linux, Mac OS X, BSD, other UNIX, and even the HX DOS Extender that runs Win32 Console Applications in pure DOS supports MIDI music... oh yeah and as for the Android port, Android also supports MIDI with its own Java-based API).

Disadvantages: some people don't like music, or expect this game to be silent so that they can listen to other stuff while they play it. So we'd need to make it easy to turn the music OFF for people who don't want it. Also the sound quality of MIDI music isn't as good as other formats.

But it sounds very RETRO, very appropriate for a game with a retro-looking user interface that's text mode. It might be a LITTLE bit hard to implement but I'm sure it's doable... MIDI is about the easiest format in the world to support and plenty of other cross-platform GNU GPL software supports it so most of the code could just be copied from some other project under the same license that uses MIDI music (for instance, some other game under a GPL2+ compatible license, or perhaps a cross-platform audio framework under a GPL2+ compatible license). So many people have coded cross-platform MIDI interfaces in so many different projects under compatible licenses that we probably have hundreds of MIDI implementations to choose from, so no need for us to reinvent the wheel (we'd probably look for something super-simple that only works with MIDI and not any other formats, so as not to complicate the code too much).

Anyway, who WANTS MIDI music in Liberal Crime Squad, who DOESN'T CARE, and who thinks it's a BAD IDEA or HATES it? Or does anyone want to use some other format like OGG or something (personally I think using a different format would be a waste of disk space, for a nice small retro game like this, plus MIDI is lossless unlike MP3 and OGG and you can freely edit MIDI files using a MIDI sequencer without any loss of data and the file size is incredibly compact and the wide support on basically all operating systems is also a big plus).

The only REAL downside to MIDI music is, on some systems, certain instruments are louder than others, while it is different on other systems, and on some systems, certain instruments decrease in volume over time while others remain at constant volume as long as the note is played, and that implementation detail varies depending on which MIDI sequencer (typically a soft synthesizer although some computers use hardware synthesizers) you are using. So if you get it to sound really good in the built-in soft synthesizer MS Windows uses, and then play the same MIDI file on Linux or Mac OS X, as just one example, it is possible the melody track might be less loud than it should be and some background harmony track might be louder than it should be, making it not sound as good as it ought to. But this is not really that big of a deal unless you are some kind of perfectionist... if you have a well-made MIDI file where the melody track is at a higher volume than all the harmony tracks and you don't use overly long notes that last for multiple measures, it ought to sound perfectly fine on any system. So if a MIDI file doesn't sound good on all systems, it's just not a very good MIDI file, but this is easy to fix by editing it in a MIDI sequencer.

So, please answer the poll at the top and if you have any comments or questions on this idea please post them below. I'm interested in hearing from both other developers/programmers and from users/players of the game, before I decide whether or not this is something that ought to be done.
Logged
The Liberal Crime Squad wiki is your friend.

Quote from: Lielac
Edit: Figured it out via a little bit of trial and error and oH MY GOD WHAT IS THIS MUSIC WHAT IS THIS MUSIC WHAT THE HECK IS IT SPACEBALLS MUSIC? WHATEVER IT IS IT IS MAGICAL

MaximumZero

  • Bay Watcher
  • Stare into the abyss.
    • View Profile
Re: Idea: add MIDI music to LCS
« Reply #1 on: August 09, 2014, 11:04:56 pm »

Fuck. Yes.
Logged
  
Holy crap, why did I not start watching One Punch Man earlier? This is the best thing.
probably figured an autobiography wouldn't be interesting

Casei

  • Bay Watcher
    • View Profile
Re: Idea: add MIDI music to LCS
« Reply #2 on: August 10, 2014, 03:58:03 am »

I'm pretty open to it.

The next question is: how would the cues work? Event-based or playlist based?

I'd like the ability to use sound effects, a playlist, or both. The playlist plays Liberal Songs, but the events trigger Liberal Sound Effects (midi white noise pewpews for gunfire, a wolf-whistle when the LCS tries to drop a pick-up line, or a quick Liberal Bow-Chicka-Wow-Wow if someone becomes a love slave, for some examples), similar to the Soundsense DF utility.
Logged

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
Re: Idea: add MIDI music to LCS
« Reply #3 on: August 10, 2014, 06:28:43 am »

I have just looked at a LOT of different open-source libraries that can play MIDI music and examined them all in great detail. The best one is SDL_mixer. We will use that. Originally I'd concluded we should use Allegro, but then I examined things further and found that Allegro 4.x was the last version to support MIDI and doesn't work on recent versions of Mac OS X. Allegro 5.x doesn't support MIDI anymore but works on recent versions of all major operating systems. This makes Allegro unsuitable. The other libraries I looked at had needlessly complicated APIs where parsing a MIDI file and playing back a MIDI stream using your operating system's MIDI interface were totally separate operations and it would require many lines of code just to playback a file. The only library I've found that's any good for this is SDL_mixer, an addon to SDL. SDL_mixer on its main webpage confusingly says that it uses Timidity for software wavetable playback of MIDI using "a GUS compatible set of sound patches" that have to be in a certain location on your hard drive. Actually lower down on that same page it says how it natively supports MIDI playback using the operating system's MIDI interface. Timidity is just a backup system in case that doesn't work. Anyway it has quite a nice API of functions for playing music. And other open-source GNU GPL games use it to play MIDI music... even proprietary games that cost money use it, because SDL and SDL_mixer are under a permissive zlib license that allows them to be used in anything.

SDL_mixer supports sound effects too, such as the ones Casei proposed, and a variety of file formats; we'd probably use OGG Vorbis if we did sound effects since it's compressed (1/10 the size of WAV), better quality than MP3, and an open format without patents (MP3 and AAC are patent-encumbered), and it's what all the other open-source games use (except for a couple I've found that are dumb enough to use uncompressed audio like WAV files that waste disk space for no reason and sound exactly the same to the human ear of anyone but an extreme audiophile). But sound effects would be brief duration while MIDI music would play in the background and have long durations.

So I've figured out what to use to implement music and/or sound. As for Casei's ideas, those are all good, I like those suggestions for sound effects, although if we had sound effects we'd obviously have more than just those few. Now as for my thinking about the music, I think which MIDI file plays would depend on what is going on in the game, like there'd be dating music for when you're on a date, car chase music during car chases, interrogation music during interrogations, etc. Various locations would have their own specific music. Regular site mode would have its own music. There'd be music for the beginning when you're setting up the game settings and your character. There'd be victory music if you win the game and loss music if you lose the game. There'd be a fighting song, possibly more than one, for stuff like siege mode, being at a site when conservatives are alarmed or there's a massive response or moderates or everyone is alienated. These are just some examples. It's fairly typical for games to have the music depend on what type of situation you are currently in in the game and what is going on, where you are, so that's how I am thinking it would work.

We could have more than 1 possible song for each situation/location so that it would cycle through a playlist, either randomly or in order (I would compromise between randomly and in order by choosing a random order and then going thru in that order and if it reaches the end continuing in that same order in a loop). There could be a standard for the filenames, so that modders could add any number of MIDI files to be played for a certain location/situation as long as it's at least one. For instance if car chases have their own music it could be CarChase01.mid, CarChase02.mid, CarChase03.mid, etc., and the game would detect how many of these exist by starting at the first filename and looping thru to see how many of them exist in numerical order, and then it would play from however many of those exist. A modder could delete all of those except the first one and put any MIDI file they want as the first one. Or they could make up to 99 of them all in numerical order and the game would play all of those in some random order that would be repeated. I have noticed one minor problem with doing this in SDL_mixer. Mix_HookMusicFinished(), which can be used to set a function to run when the music stops playing, doesn't allow you to call an SDL_mixer function ("NOTE: NEVER call SDL_Mixer functions, nor SDL_LockAudio, from a callback function." is what it says.) This is a minor issue because having it start a new song when the old song ends could easily be implemented this way, and having it prohibit this makes it a bit harder. But I am sure there is some other way to implement it. SDL_mixer's API is way nicer than any of the other libraries I looked at for this sort of thing, except maybe Allegro's, which is also nice, but we can't use Allegro because only the old version of Allegro plays MIDI but the old version doesn't work on some new operating systems.

SDL has some other useful stuff, like cross-platform integers of specific sizes that work on different compilers. This could fix the problem of the game using types like short, int, and long, and their unsigned variants, which are of indeterminate size since C/C++ doesn't standardize how many bits its integer types take up, at least not until C++11 which lets you use the C99 types int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, and uint64_t, defined in stdint.h. One benefit of this is the game would work exactly the same on 32-bit and 64-bit systems and the variables would be the same size. Also it would allow use of 64-bit variables on 32-bit systems, to store larger numbers than 2 billion or so. So SDL is good to have, it doesn't just let us play music and sound but lets us use bigger numbers too.
« Last Edit: August 10, 2014, 09:44:51 am by Liberal Elitist »
Logged
The Liberal Crime Squad wiki is your friend.

Quote from: Lielac
Edit: Figured it out via a little bit of trial and error and oH MY GOD WHAT IS THIS MUSIC WHAT IS THIS MUSIC WHAT THE HECK IS IT SPACEBALLS MUSIC? WHATEVER IT IS IT IS MAGICAL

KA101

  • Bay Watcher
    • View Profile
Re: Idea: add MIDI music to LCS
« Reply #4 on: August 10, 2014, 09:58:05 pm »

Needs to be an option, and have the files changeable too.  Seems like it'd just add more dependencies to the compiling list, too, but wev.
Logged

SuicideJunkie

  • Bay Watcher
    • View Profile
Re: Idea: add MIDI music to LCS
« Reply #5 on: August 10, 2014, 10:52:37 pm »

I'd suggest having an art file to include metadata about the tracks so the game can make certain tracks more or less frequent based not only on the site, but also overall public levels of liberalism, site alarm state, squad heat and so forth.

EG: the military base should sound different if you're ghosting it with clean-sheet solo thieves than if you've been rolling in with heavy armor and assault rifles all game.
Logged

Capital Fish

  • Bay Watcher
  • "Hi Mister Dog!"
    • View Profile
Re: Idea: add MIDI music to LCS
« Reply #6 on: August 11, 2014, 07:55:47 am »

I tend to mute game soundtracks and listen to my own music when playing; so as long as there's an option to mute, I'm all for this.
Logged
Find the errors in the above post and win a prize!

FinetalPies

  • Bay Watcher
  • Even on the battlefield.
    • View Profile
Re: Idea: add MIDI music to LCS
« Reply #7 on: August 12, 2014, 12:02:18 pm »

Midi is the right format. I'm more concerned aboot what the music will sound like? I want it to be appropriately atmospheric and good and stuff.
Logged

SlatersQuest

  • Bay Watcher
    • View Profile
Re: Idea: add MIDI music to LCS
« Reply #8 on: August 12, 2014, 03:47:32 pm »

I, personally, prefer my own music while playing LCS, but if it's easily disabled, that's not an issue! :)
Logged

Duuvian

  • Bay Watcher
  • Internet ≠ Real Life
    • View Profile
Re: Idea: add MIDI music to LCS
« Reply #9 on: August 13, 2014, 03:05:41 am »

I can donate a small bit of music. It's really easy to convert normal music files to .midi in Fl studio if the song doesn't use a lot of samples. Depressingly I lost most of my song files and all the up to date ones a couple of restore from images ago but I can convert some of what I can find on transfer cds to midi. I can also make some more but that takes a lot longer than converting what I already have.

When I convert song files to midi I can click one button and FL studio uses the same note patterns and changes all the instruments to a midi output synthesizer. I go through each of these synthesizers and pick a midi compatible sound (like a grand piano note) built into the synthesizer instrument that replaced the old instrument. This means that the song will be using different midi sounds playing in the same note patterns as in the original song. This makes it midi export compatible and the most time consuming part is picking the right instruments for the patterns to sound good again which isn't that much time when compared to building a song from nothing.

Unfortunately I don't know how to transfer a final export .mp3 or .ogg into a .midi file or I could use the final versions I had before I lost my latest song's FL files as well as using the older beats I have. The internet suggests that it's not possible, though there is a paid for program that the review says works for songs without a lot of instruments or for vocals.

EDIT: FL studio demo version, which is free, should be enough to allow you to export compositions in .midi . You just won't be able to open your FL save files. If you need help setting up the midi ports so you can export I can give you step-by-step directions to convert your composition to midi.
« Last Edit: August 13, 2014, 03:36:30 am by Duuvian »
Logged
FINISHED original composition:
https://app.box.com/s/jq526ppvri67astrc23bwvgrkxaicedj

Sort of finished and awaiting remix due to loss of most recent song file before addition of drums:
https://www.box.com/s/s3oba05kh8mfi3sorjm0 <-zguit

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
Re: Idea: add MIDI music to LCS
« Reply #10 on: August 14, 2014, 11:10:57 am »

Yes, yes it would be easy to disable the music and/or sound effects, for people who listen to other stuff while playing like KA101 and Capital Fish and SlatersQuest. Glad to hear FinetalPies agrees MIDI is the right format, and I agree the music has to be appropriate to the situation, but luckily MIDI files are easy to replace so if we get it wrong it's easily fixable. Duuvian's helpful offer to (maybe) provide some music from FL Studio is very nice. SuicideJunkie's idea is good but would make it a bit more complicated to implement.

Anyway KA101 has a good point about dependencies. That's actually one of the harder things for me to deal with. We'd be adding both SDL and SDL_mixer as dependencies. I haven't actually added large dependencies like that to a project before so it would be my first time trying it. SDL is a dependency for libtcod too (libtcod being a superior alternative to curses that is used by other games including Jonathan S. Fox's Zombie Survival Squad). I am sure some other programmers know a lot more than me about how to add dependencies like this and do it the right way so it compiles, links, and builds correctly on all the different platforms. I'm kinda a novice at that. But regardless of how it's done it would probably make compiling and building the game take a bit longer and be a bit more complicated.

But yeah this thread is mostly about a proposed feature for MIDI music and how it might be implemented. I don't think this feature will be implemented very soon, at least not if I'm the only one working on it... we are mostly brainstorming here about how we might do it... both me and everyone here who responded with a comment. By "very soon" I mean in the next month or two... not likely to get implemented in Liberal Crime Squad in that time frame. This is more of a long term goal for the project, along with supporting libtcod... both SDL_mixer and libtcod depend on SDL... SDL_mixer would be for music and/or sound effects, while libtcod would be for text-mode-ish graphics that are actually implemented using graphics rather than using a console like curses uses (way more colors and characters available as well as other advantages like being able to put in actual graphics). And these could be disabled using #defines; both the audio and using libtcod... to go back to the original/current behavior of using curses for text-mode "graphics" and not having any sound or music.

So yes since it's a little bit complicated and it's better to do things the right way than do them as fast as possible this probably won't be implemented very soon but I am hoping it will be implemented eventually. I don't yet have quite enough knowledge to know how to implement it at the moment, specifically I have trouble understanding the details of including a dependency like SDL or SDL_mixer, although maybe some of the other programmers know that stuff. And yes I have seen the tutorials about it and looked at some source code of other projects that include it, but I still don't quite get it. The source code of projects that include it seems way too neat and tidy and it is hard to see where it is actually being included as a dependency or how the linking process works for when it gets compiled. In fact I see SDL header files #included in source code of other projects, when those header files aren't present in those projects in any of the directories, and don't understand how the compiler can find them. I need to research this more before it will make sense to me... in other words I'm not yet ready to even start implementing this since I don't understand all the stuff I need to know just yet.

Also I am somewhat confused how SDL 2.0 is under the zlib license while SDL 1.2 and earlier are under the GNU LGPL... as far as I know, those 2 licenses are not compatible in that direction and the only way the license could be changed in that way is if EVERY contributor to SDL agreed on the license change. Then again the project seems to have one primary maintainer so maybe he has the authority to do that without getting permission from all the other contributors, I'm not sure how this works. Linus Torvalds has said that the Linux kernel will stay on GNU GPL version 2 and NOT later because changing the license to allow later versions like GNU GPL 3 would require the consent of every programmer who has ever contributed anything at all to the Linux kernel. This game Liberal Crime Squad of course is on GNU GPL 2 or later meaning you can use it under GPL 2, GPL 3, or any future GPL version (so if some future GPL version is really bad this could affect all sorts of stuff including this game). Here is an example of how someone could change a future GPL version to allow anything at all:

Code: [Select]
                    GNU GENERAL PUBLIC LICENSE
                   Version 666, 19 January 2038

 Copyright (C) 2038 Free Software Foundation, Inc. <http://fsf.org/>,
 a wholly owned subsidiary of Microsoft Corporation <http://www.microsoft.com/>.

 This software is property of Microsoft Corporation, which owns all
 copyrights, patents, trademarks, intellectual property rights, copying
 rights, modification rights, distribution rights, and all other
 unspecified rights relating to it, as well as any larger project it is
 a part of. Possession of the source code of this software by any person
 who is not a Microsoft employee is punishable by death, as is piracy of
 this software, attempts to reverse-engineer this software, or even just
 saying anything bad about Microsoft. All of those will result in a swift
 execution by Microsoft paramilitary corporate mercenary commandos.

 THIS SOFTWARE IS PROVIDED BY MICROSOFT CORPORATION "AS IS" AND ANY EXPRESS
 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 IN NO EVENT SHALL MICROSOFT CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 The views and conclusions contained in the software, documentation, and this
 license itself are those of its original authors and should not be interpreted as
 representing official policies, either expressed or implied, of Microsoft Corporation.

                      GNU GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. Microsoft Corporation has permission to do anything it wants with
  this product.
  1. You do not have permission to do anything at all with this product,
  unless either A) You are Microsoft Corporation, or B) You have paid
  Microsoft Corporation for permission.
  2. Any violation of these license terms is punishable by death,
  unless the violation is done by Microsoft Corporation, in which case
  it shall not be considered a violation.
  3. Microsoft Corporation reserves the right to execute you or do
  anything else to you even if you follow the terms of this license.
  4. Your consent with all the terms of this license is implied even if
  you don't use this software and even if you click "No" when asked
  if you consent to this license, because "No" means "Yes" and "Yes"
  also means "Yes".
  5. How are you gentlemen !! All your base are belong to us. You are
  on the way to destruction. You have no chance to survive make your
  time. Ha ha ha ha ...
  6. License terms subject to change without notice. All future changes
  will be made by Microsoft Corporation. Nobody else may change the
  license under any circumstance.

That is just an example of what might happen, which I guess is why some projects like the Linux kernel don't allow themselves to use any future GNU GPL version, just in case something like that happens in the future.

But anyway, I've taken all your views into consideration and also looked into how to implement this and I don't think I'm quite ready or have it all figured out just yet. I think this feature will probably be implemented eventually but I'm not ready yet.

Also feel free to use the above GNU GPL version 666 in any of your software, and don't bother to pay any attention to any of the clauses of the license that might mention you being executed or stuff like that. It's a perfectly good license, just use it, don't even bother reading it, just trust me on this. ;)
Logged
The Liberal Crime Squad wiki is your friend.

Quote from: Lielac
Edit: Figured it out via a little bit of trial and error and oH MY GOD WHAT IS THIS MUSIC WHAT IS THIS MUSIC WHAT THE HECK IS IT SPACEBALLS MUSIC? WHATEVER IT IS IT IS MAGICAL

SuicideJunkie

  • Bay Watcher
    • View Profile
Re: Idea: add MIDI music to LCS
« Reply #11 on: August 14, 2014, 05:45:53 pm »

I suggest that the implementation abstract away the song selection to a function that can get passed location details and whatever else as needed.
It can start out as just random from a few sub lists, and be made smarter after it the system is implemented and working.
Logged

Duuvian

  • Bay Watcher
  • Internet ≠ Real Life
    • View Profile
Re: Idea: add MIDI music to LCS
« Reply #12 on: August 16, 2014, 12:13:27 pm »

I'll get to finding my song files and re-installing FL studio sometime within the next week, should have at least a few .midis by next week.
Logged
FINISHED original composition:
https://app.box.com/s/jq526ppvri67astrc23bwvgrkxaicedj

Sort of finished and awaiting remix due to loss of most recent song file before addition of drums:
https://www.box.com/s/s3oba05kh8mfi3sorjm0 <-zguit

Duuvian

  • Bay Watcher
  • Internet ≠ Real Life
    • View Profile
Re: Idea: add MIDI music to LCS
« Reply #13 on: August 25, 2014, 07:21:42 pm »

I've converted a songfile to .midi and can upload the initial version of it in .midi format. It took a little while fixing some notes (notably notes that with the original instruments distort one another) that sound different in midi format due to the patterns being initially for the previous non-midi instruments. I'm still not done yet. The good news is I found a song file only a few versions back so it's quite complex and has good potential in .midi to keep improving as I go through and slowly alter beneficially or failing that re-compose the sour notes or sequences one by one. I'll release more versions in the future. I'm also using speakers instead of headphones due to mine breaking. Once I get some headphones again I'll be able to be more precise, but this initial version should be enough to see whether it will work or not.

I also need to know if whatever LCS will use for the .midi playback if it can play it at the correct tempo. This song is written to tempo 25; I downloaded a free midi player which only plays at 50 tempo (twice as fast as the song was made for) which reminded me of the potential issue of whatever LCS uses to play back the midi not being able to match the very low tempo this song is set to.

Box.com can't playback .midi files and you can't export FL studio midi instruments into a .mp3 or it's at least beyond my abilities currently if you can.

The .midi file is 36.2KB I just need to figure out a trustworthy site I can upload the midi file for playback. Any recommendations?
« Last Edit: August 25, 2014, 07:50:00 pm by Duuvian »
Logged
FINISHED original composition:
https://app.box.com/s/jq526ppvri67astrc23bwvgrkxaicedj

Sort of finished and awaiting remix due to loss of most recent song file before addition of drums:
https://www.box.com/s/s3oba05kh8mfi3sorjm0 <-zguit

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
Re: Idea: add MIDI music to LCS
« Reply #14 on: August 25, 2014, 11:06:42 pm »

MIDI implementation is complete! Now the game has an integrated MIDI playback engine, and plays back MIDI files from the art directory that have specific names. You can mod the game by replacing those files with any midi files you want as long as the filenames are the same.

It is all done in revision 836. Revision 836 also fixed several bugs from recent revisions that made it not compile correctly, and made various other improvements. You can toggle the music on or off from the title screen, from the review/move equipment menu in base mode, and from the settings menu in site mode, so it's fairly simple to toggle music on or off at any point in the game.

It is done using SDL 2.0.3 and SDL_mixer 2.0. If your system cannot compile correctly with them you can uncomment the #define DONT_INCLUDE_SDL line in common.h and that'll make the game revert to its prior behavior of not having MIDI music and not having SDL dependencies. However the menu items on the screen for enabling and disabling sound will remain there... you can toggle music on and off in a build that has SDL disabled, and then if you load your savegame in a build that has SDL and music enabled, it will remember your settings.

All of the MIDI music is public domain. It is all from long enough ago that nobody holds any copyright on it so it's entirely in the public domain. Most of it is classical music because that is the music that is old enough to be free of any intellectual property restrictions. I tried to make a good selection of songs. The only song that is composed recently enough that it would be POSSIBLE to have it be copyright is the Soviet/Russian national anthem (stalinized.mid in the art directory); however, the post-Soviet Russian government has explicitly passed legislation making that music public domain. Specifically, Article 1259 of Part IV of Civil Code No. 230-FZ of the Russian Federation of December 18, 2006 states that state symbols such as the national anthem are not subject to copyright, and under international law, the Russian Federation is the successor state to the Union of Soviet Socialist Republics and has thus inherited all its intellectual property rights, and that legislation has released the Soviet anthem and many other things into the public domain. Everything else I have as MIDI besides the Soviet national anthem is older than that, way older, old enough so that even if the creators wanted to they wouldn't be able to extend copyright this long, since everything else is over 100 years old and automatically public domain under international copyright law.

Of course what might not necessarily be public domain are MIDI wavetable instruments used in MIDI synthesizers, so if you make a WAV/OGG/MP3 etc. recording of any of these MIDI files, the instrument samples may be subject to copyright depending on how you do it. But there are plenty of public domain SoundFonts as well as public domain Gravis Ultrasound patchsets that can be used for MIDI synthesis to create wavetable recordings that are still entirely public domain.

Well I do need some help with one thing: I need some Linux and/or Mac OS X developers to get the makefiles working with these new SDL2 and SDL2_mixer dependencies. I've managed to get the Code::Blocks and Microsoft Visual C++ projects set up so they both work (hopefully... I don't have Microsoft Visual C++, only Code::Blocks, so I've only been able to confirm that it works on Code::Blocks, but I manually edited the Visual C++ project file which was in a simple easy-to-read XML format and I'm fairly certain I did it correctly so it should compile and build properly).

So what I need now is some Linux or Mac OS X or other UNIX, maybe even *BSD people, to get the makefiles working with these new dependencies. It ought to be a little simpler on Mac OS X than Linux, and simpler on Linux than *BSD... because Mac OS X has native MIDI support, Linux has support of its ALSA sound subsystem but probably needs a bit of extra stuff for MIDI (FluidSynth is recommended for highest sound quality), and *BSD uses OSS instead of ALSA so you also have to install JACK for the audio to work. Mac OS X might be originally based on *BSD, but its audio subsystem CoreAudio is quite a bit better than the old, outdated OSS audio subsystem in *BSD, and *BSD can't use ALSA because they avoid GNU GPL stuff and only use BSD licensed stuff.

Oh yeah and for ordinary users I'd recommend you try out the latest revision, revision 836. There are quite a lot of changes between revision 835 and 836. Revision 835 had no sound, SDL, or MIDI stuff at all in it, but in revision 836 it's all completely implemented. Anyway I have a detailed changelog here: http://sourceforge.net/p/lcsgame/code/836/. Actually that changelog isn't even remotely detailed enough to describe all the stuff I did. If I actually described everything I did in that revision the changelog would be 10 times as long. Oh yeah and you might notice that the title screen has more stuff on it... like along with being able to toggle music on and off it also has links to this website and the LCS wiki added to it... so that's 3 lines of text added to it... so there's a bit less whitespace between lines but still plenty, still more than enough for everything to fit nicely. Oh yeah and if you use one of the .exe files, for now it's best to use a Debug build, it seems some of the optimizations I use with GCC on Release builds (namely, compiling at the "-Ofast" level that's even faster than "-O3") make it just a teensy weensy bit unstable. Not that there's anything wrong with those optimizations, no of course not... it's just that, if you integrate code compiled with them with code from SDL that was compiled in a different way, well the SDL code is what crashes, not my code. In fact I even had to patch a bug in one of the SDL 2.0.3 header files to get it to compile properly on MinGW-GCC, as mentioned in the changelog. I am hoping that SDL and SDL_mixer put out more stable releases soon to fix some of the bugs they have (since by looking at their source code repositories I can see they've fixed a number of bugs since their last stable releases but they haven't released those bugfixes as stable releases to the rest of us which they ought to do because it would be the nice, friendly, helpful thing to do).

So yeah... MIDI music... DONE. If you want to play it, you can download it off SourceForge, follow the packaging instructions in the README, and use the Debug build, not the Release one. Release ones used to work without strange random crashes prior to SDL but it seems SDL changes some stuff once you include it. Of course SDL can easily be disabled by defining the DONT_INCLUDE_SDL macro, which I was careful to implement throughout the code so that you can still compile it without SDL or audio the old-fashioned way.
« Last Edit: August 25, 2014, 11:19:19 pm by Liberal Elitist »
Logged
The Liberal Crime Squad wiki is your friend.

Quote from: Lielac
Edit: Figured it out via a little bit of trial and error and oH MY GOD WHAT IS THIS MUSIC WHAT IS THIS MUSIC WHAT THE HECK IS IT SPACEBALLS MUSIC? WHATEVER IT IS IT IS MAGICAL
Pages: [1] 2 3