Advertisement

MIDI for Browser-Based Game

Started by September 11, 2002 05:20 PM
9 comments, last by Wyndo 22 years, 2 months ago
We''re getting close to the StarLock launch (January 1st - http://www.prowler-pro.com/starlock) and wouldn''t you know it, I''ve hit a snag. The cool MIDI I''ve done for the game sounds wonderful on some computers, adequate on others, and downright loud and obnoxious on others. I can play-back through my sound card (which plays perfectly for the intended effect) and end up with MP3 duplicates, but I hate to do this for several reasons. One, a MIDI is perfect for a browser-based game -- they''re 15k to 32k or so, will download fast, and browsers (at last MSIE) are preconfigured to play MIDI without a plug-in. The MP3 equivalents are 1 to 2 MEG in size (horrible for the web - would become an option only for people who buy the game Starter Kit on CD), and you need a plug-in for most browsers. Is there truly no way to get consistent (or near-consistent) sound outside of restricting composition to a base few instruments from the GM master set, and then testing on a dozen different systems for tweaking to the best effect? I''m not overlooking something with SoundFonts am I? As far as I can tell, MIDI sacrifices consistency in favor of portability, and that''s not really going to work too well. Having 2-meg music files won''t work too well either (this is probably why browser games shy away from music). Is there something I''m overlooking that might be ideal in this situation? Mike Snyder Prowler Productions
You could make several midis, and have a frame where the user can choose between those midis (or none at all). Or, you could make the mp3s available for download, and leave it up to the users to download it and play them. Or you could drop the music entirely. Whatever you think would work best
Advertisement
quote: Original post by Wyndo
As far as I can tell, MIDI sacrifices consistency in favor of portability, and that''s not really going to work too well.

Well, it''s not so much that ''MIDI'' makes any sacrifices as such, it''s just that MIDI is just a set of instructions, as you probably know. It would be like complaining that English sacrifices appearance for the sake of portability if you came across someone with bad handwriting MIDI is really just an interfacing standard and is designed for operating music hardware as opposed to creating any given sound. The quality of the music output all depends on the hardware in the target PC, and there''s nothing you can do about that. Soundfonts won''t help as they are only supported by a subset of cards, and they are likely to be significantly bigger than the MP3 track anyway.

Make sure you provide a volume control for the players.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files | My stuff ]
There is no volume control on imbedded background MIDI. Well, there is I suppose - it's the yellow "speaker" icon on the task tray. Easy enough. The primary thing is the on/off control within the game, which will be highly useful.

Yep, I know how MIDI works - I was just disappointed to find such drastic differences in interpretation from soundcard to soundcard. I was thinking maybe there is something I've overlooked, or a set of guidelines to use that can help songs avoid the worst of these playback issues (for instance, I mistakenly thought that very very low-pitch brass beats could simulate a "heartbeat" in one of the tunes, only to find out that it actually sounds like a very very low-pitch brass instrument on my new system instead of a spooky thump-thump as it did on the old one). Maybe I just need to make sure the tunes themselves don't rely on those kinds of effects (have also run into problems relying on track volumes to by high or low when this causes instruments to sound almost mute, or at times overpoweringly loud on other systems).

Are there no good, usable rules regarding the various GM instruments? I may just normalize as much as possible, then hope for the best. :-/

Mike Snyder
Prowler Productions

[edited by - Wyndo on September 12, 2002 10:52:04 AM]
I don''t know of any rules, good, bad or otherwise. As far as I know, the GM specification just gives the name and the patch number, and unfortunately cheap hardware is limited in how it can best meet the demands of the patch name. In my experience, piano and string sounds are usually of a high quality... plucked and wind sounds usually sound good but aren''t all that authentic... synth sounds vary a lot but are also decent. Percussion is often very poor. Additionally, I find that bass notes are generally of higher quality than treble notes on the poorer sound cards.
I thought that I posted a reply to this subject... I guess it didn''t go through...

If you want, you might be able to convert your songs to .xm or .s3m files. These kind of files imbed the sounds that you use in the files. I don''t know if you can stream the files over the internet however. There is a cross-platform Java player that I think can stream files called Jah-sing (I think). WinAmp also supports the .xm or .s3m files (.mod files.) How much music are you talking about? How many sounds did you use? These are all considerations. You should be able to get the .xm files down to a very small size still preserving quality. Another option is to downsample the .mp3 files. I think you can downsample them, or save your .mid files as say 22khz 8-bit mono samples instead of 44.1 khz 16-bit stereo samples. It will effect the sound quality, but will cut down the file size. I think either of those solutions could work. Another option, I guess, is using direct music producer, which embeds the sound, but those files are rather large and I don''t think can stream over the internet.

devinmaxwell
Advertisement
Thanks for the suggestions. I hadn''t heard of those things. The ironic thing is, if I had known I''d end up using MP3, I could have done more with sounds, sampling, etc (Magix does more than just MIDI). Right now there are around 22 songs. I anticipate 50 or so when finished.

Part of the problem I''ve having now is in the volume. I usually leave my speakers turned about 20% up (pretty low) and the volume in Windows at 100%. This usually sounds fine, and I turn the volume up or down as needed, using the knob on the speaker (I''m usually watching TV while I work on other things, and don''t want sound from the computer). Because of this, I built all the MIDI to run tracks at 100% volume, with note volumes at 100 or sometimes higher. I''ve been inspecting other MIDI files and I find that the track volumes are set at 100% alright, but the note volumes are much lower. I made the mistake of basing things on how I handle my own speakers.

I think that what I''ll do is lower all the volumes on notes inside the tracks, leave tracks at 100% volume, turn the speakers up, and make sure it sounds okay. Doing that, I may even be able to avoid some of the drastic volume problems I''ve seen on other computers, since there won''t be such large variations when the whole thing is built to be quiter. I''m optimistic that I may be able to take care of some of these self-made problems, so that the differences in instrumental interpretation won''t be such a problem.

Thanks for the replies!

Mike Snyder
Prowler Productions
You know if you realy downsample your MP3''s and make them short, you could probably go under a meg or even half a meg. The quality would not drop too much. The people with good MIDI cards would miss out, but the quality on poor MIDI cards would be much better.

Do not meddle in the affairs of moderators, for they are subtle and quick to anger. ANDREW RUSSELL STUDIOS
Cool Links :: [ GD | TG | MS | NeHe | PA | SA | M&S | TA ]
Got Clue? :: [ Start Here! | Google | MSDN | GameDev.net Reference | OGL v D3D | File Formats | Go FAQ yourself ]

I think that''s what I''ll end up doing -- MIDI (however it turns out) for people playing strictly online, but the option of MP3 for those who have the CD and have problems with the MIDI. Thanks for the replies!

Mike Snyder
Prowler Productions
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/behaviors/reference/time_dmusic_entry.asp

^ Highly underused, but very powerful way of using DirectMusic formats online. You can make a DLS instrument set out of your current midi bank and have it be used with a DMSegment when you play it online. The only problem is the user needs Direct X 8, so they need to be running windows in order for them to hear it.

--------------------
Matthew Calabrese
Realtime 3D Orchestra:
Programmer, Composer,
and 3D Artist/Animator
"I can see the music..."

This topic is closed to new replies.

Advertisement