May 20, 2013

OpenRGSS Progress Report - Sound & Music

I'm still doing a lot of behind the scenes work, so nothing really new since last time except for the addition of sound and music, which was kinda piece of cake as compared to the graphics engine. So this time you get to watch a small video to see how all this blends together (please watch in HD).



Comments in the video say it all I guess. If you listen carefully, however, you might notice that the music sounds a bit different than what you are used to. So you might wonder what I did to those music files to improve their quality. Well, nothing actually, and that leads me to a very interesting fact I'd like to point out.

You have surely noticed that MIDI files (.MID) tend to have poor quality. On the other hand, they are tiny in size, but then many people wrongly assume that there's a link between the two. This is true for sound files, like .WAV of .MP3 files, because the bigger they are, the more information they have, and thus the better the quality. Well then, a MIDI files does not contain sound. It's merely like a sheet music, it just stores what note it's supposed to play at what time using what instrument, and that's the reason why it takes so little space. This is also why you can easily tweak pitch, tempo, volume, instruments... track by track, using the proper editor, while sound files are somewhat "merged", raw sound, with no concept of notes or instruments in the first place.

So you're probably going to wonder, how do I get to hear a MIDI file then? Well, you just need to have a synthetizer to read the sheet music and play it back. It will do so using a sound bank, in which samples for each instrument are stored - meaning, if you followed me, that if you use another sound bank, your MIDI file will start and sound differently all of a sudden. This is very much like using a character font for text - the text data remain the same, but it's rendered differently according to which font you pick. What I previously called sound bank is sometimes referred to as soundfont, by the way.

So the reason why your MIDI files sound bad is because the default synth featured with your system has a crappy sound bank. Get a good synth and they will sound better just like magic, with no addition or tranformation whatsoever to the files themselves. The good news is that it is possible to replace Windows's default synth with another one that supports soundfonts, then you get to choose the soudfont most fitted to your taste and computer performances. The bad news is that MIDI files will still sound crappy in RPG Maker. This is because RPG Maker does call the system synth, but rather uses its own, internal synth, which sticks to the crappy sound bank, and there's nothing you can do about it. But then again, another good news is that, of course, OpenRGSS does call for the system synth to play back MIDI files, which means it does support soundfonts as long as you have a software synth installed, which supports them itself.

For this video, that's exactly what I did - downloaded a software synth (namely Coolsoft VirtualMidiSynth), downloaded a soundfont (Merlin Gold v4.10), set the synth to use the soundfont and use it as default synth for MIDI playback. Now all MIDI music that will play on my system, wherever it might come from (except for RPG Maker of course) will use the soundfont and sound nice. Note that this applies only to MIDI files, though, and that it depends on the user's system - meaning if you install the synth and soundfont to get your MIDI to play nicely, it will still sound as bad as always on the computer of someone who hasn't.

I couldn't resist recording a few pieces using either the RPG Maker playback, or the synth/soundfont combo, so that you can hear the difference. I'd like to insist that those renderings were obtained using the exact same MIDI file with no adds or modifications whatsoever.

RMXP playbackOpenRGSS playback
using VirtulMIDISynth & GeneralUser GS FluidSynth v1.44 soundfont
001-Battle01.mid
RMXP
012-Theme01.mid
RMXP
026-Town04.mid
RMXP
034-Heaven01.mid
RMXP
039-Dungeon05.mid
RMXP
044-Positive02.mid
RMXP
062-Slow05.mid
RMXP
GRABBAG.mid
Duke Nukem 3D
STALKER.mid
Duke Nukem 3D
ALIENZ.mid
Duke Nukem 3D
EXRUM.mid
Monkey Island 2
LARGSTAB.mid
Monkey Island 2
HITGM.mid
War Wind

So, I hope this post shed some light on the MIDI format and gave you a better opinion of it. More progress to be shared soon, so stay tuned and have a nice listening-to-better-MIDI experience in the meantime.

May 4, 2013

OpenRGSS Progress Report - Graphics Engine & Windows

Hey guys,

Not so long ago I made an announcement regarding my upcoming project, OpenRGSS, and told you what it was all about. Since then I've made a lot of progress, and because a picture is worth a thousand words, I'm going to share some screens with you today.


Ring any bells? Yep, this is RMXP's default title screen, except that it is run not from its featured Game.exe, but from the OpenRGSS launcher. Not impressed, are you? Want something a lil' more ground-breaking?


So, how about getting the same screen to a 800x600 resolution instead? We can do so through the built-in options menu OpenRGSS projects can access anytime pressing the F1 button.



This menu will replace the Game.exe options menu and will eventually feature control changes and stuff like that. Also, since it is part of the Ruby scripts, it means that you will be able to tweak it, and even script your own options.

Note that windows and background sprites can be set up to automatically adapt to the new resolution.

Also, you might wonder what that troublesome lil' arrow is doing in the middle of the screen. Well, that, my friends, is the mouse cursor. Of course you will be able to customize its appearance and disable/re-enable it at will.


But the interesting part about it is that windows can now be browsed using the mouse. It's as simple as what you'd expect it to be - just point & click to select an option. This is featured by default only in standard selectable windows, as shown above, but the OpenRGSS functions allow you to easily give mouse support to other window types with minimal code.


This last screenshot sums up about everything I've added to the OpenRGSS engine so far, including windows and text management, and it's all pretty self-explanatory. I should give a word about the composite windowskin feature (bottom-right window), though. The thing is I've grown tired of being always required to make edits to windowskins pictures because I liked this background and that bordersand wanted them together. So since I'm scripting my own engine, I thought it was about time I did something to improve this aspect. So what OpenRGSS does is that you can have a variety of backgrounds, borders, cursor graphics, and so on... to choose from and the engine will render windows from your choice. It is still possible to select a single windowskin picture, as you are used to, but then what OpenRGSS does is that it extracts each component from the picture and add them to its library of windowskin parts. So what I did there was to select the custom windowskin for the bottom-right window, then tell it to pick the default windowskin's borders. Also, note that windowskin components can have an arbitrary size, for example it doesn't matter if your custom background has a size that differs from 128x128, which is RMXP's standard. Though it's not implemented yet, it is planned to add support for RMVX windowskins as well.

Oh, and regarding the cut-out text in both bottom windows, it's not a glitch - it's merely that the chosen height for this screen (600) isn't divisible by 32. It's an issue with the screen size, not an engine malfunction.

Hope you liked what you saw and see you next for more updates!