Original Post

Hey everyone,

this is my first GameHero post release. As I already mentioned, I programmed a simple Midi-Player that plays all of the music in my game. I cleaned up the code and removed all of the game logics. Whats left is the basic midi player and some debug output. The zip file includes a binary as well as the complete source code.

The Midi-Player is pretty close to what HorvatM did with his Soviet Union 2011 sound engine, even though our projects are totally unrelated. Actually, our projects are that similar, that I was able to copy most of his introduction text to my project. However, there are major differences in how we handle timing of notes. It basically comes down to this:

– If you want to have sounds in your game you should go with the Soviet Union 2011 sound engine

– If you want to play music in the background you may want to use the GameHero Midi Player

The Midi2VB converter (which is going to be released soon) supports both projects, so the choice is yours.

Even tough both projects look similar, they work together very well. I attached a version of the SU Sound Engine that is able to play sounds as usual but also can use the GameHero MidiPlayer to play music in the background. Therefore, I basically changed nothing in both of our codes. I only used channel 5 for the Midi-Player to avoid interferences.

If someone finds time (not me) it would be a good idea to combine the strength of both systems.


Ohhh… and I am not used to program c so don’t wonder if my code sometimes looks strange (damn pointers).

43 Replies

Thanks, great release! I find it strange though that you used channel 5 for MIDI playback and suggest using the other channels for sound effects. Shouldn’t it be the other way round? Brings me to my next question, is the converter/player able to play multi instrument MIDIs using multiple channels?

The SU sound engine dynamically uses channel 1 to 4 to play multiple sounds at the same time. The GameHero Midi-Player defines for each song which nodes are played on which channel. To make both work together i simply set all notes to channel 5, so they do not interfere with the SU sound engine. But yes, it should be the other way around.

The midi player is indeed able to play multiple channels at the same time. If multiple notes are played at the same time, the converter will set those to different channels. However, the converter can only convert one track of the midi file. It does not work for all midis though but it works pretty good with melody and piano tracks.

In theory it should be able to play multiple songs/tracks at the same time. However, it is not implemented. Right now there is only one array that defines the timing, which then is used for all channels.

The Midi-Player is able to use different instruments (credits go to DanB), however I always used the piano. I am not sure if it is possible to use more then instrument at the time.

In my ongoing attempt to make the world a better place for all of us I have been working on this project again.

Attached to this post you will find a new demo of the Midi Player. You might notice that the quality of the music improved.

I’m not done yet though.

Tell me if you like the results.


This is Really Impressive. I for one can’t wait to see what’s next for this developement maybe someday we’ll have music for homebrewers like we hear in Red Alarm. I do have basic criticisim but not being a programmer I really don’t have room to talk or a leg to stand on. Kudo’s Thunder I just listen to it over and over again.

Wow… this music sounds amazing! Nice job.

Benjamin Stevens wrote:
Wow… this music sounds amazing!

That’s the reaction I was hoping for. It actually wasn’t that much work. I still feel like I could do better though. Seems like I have to do a “GameHero 2” when I’m done with Fishbone.

Yeah… the first thought that hit my mind as I was listening to it was “I hope he makes an update or sequel to Game Hero.”

After hearing this I went back and flashed Game Hero to my flashboy and played the same track…needless to say, I also thought something like “Game Hero: Redux” would be phenomenal.

It sounds AMAZING!

wazzal wrote:
It sounds AMAZING!


I will try to do use the Midi-Player in Fishbone first. the current quality should be more then ok for that game. There is still some stuff I have to fix/change, so it is not as easy as it might sound.

After that I probably going to do “GameHero 2”. I could just replace the music in GameHero but not polishing the graphics at the same time would be a shame. Therefore I would use my current engine anyway… so there is no difference to just do a completely new game.

However, here is what I changed since the last iteration:
– Notes do now fade at the end (This can still be improved)
– Dynamic timing for all channels
– Dynamic volume for every note
– Different instruments per channel
– Timing using interrupts
– Replay for every channel
– Fixed Midi-Converter to support new player
– Converter adds pause at end of each channel to enable synchronous replay

I only tested this for one song but it should work for the others as well.

Not to side-track this thread or remove any “thunder” from Thunderstruck. But since your redoing Game Hero would you consider making the perspective 3rd person like the Guitar Hero games instead of side view or birds eye like the previous Game Hero game? You have made an awesome game that we all love so I hope you don’t take it as too much criticisim.

morintari wrote:
… would you consider making the perspective 3rd person like the Guitar Hero games instead of side view or birds eye like the previous Game Hero game?

Maybe, maybe not. We will see what happens when I actually start.

Great, my internet-router just died. This will definitly slow down the development.

Finally the Internet is back. I started coding a simple GUI for the Midi-Converter so that is easier to use. That’s a pretty dull and boring work but it has to be done.

I also think there is still a Bug in the replay of the Midi player. If I let it run for long enough it sounds like the tracks are not in perfect sync anymore.

Ok, I have been busy programming a GUI for the Midi converter. I just finished the first version. It is not perfect but functional. I still have to change some stuff in the converter which will result in changes to the GUI as well.

I also have to add some more checks to prohibit misconfiguration. However, I attached a screenshot so… have fun looking at it… I guess.


Ok, I figured out why the tracks are not in perfect sync when I replay a song. I didn’t really solve the problem but build a workaround that should fix the problem for now.

I also added some additional checks and features to the converter to avoid broken configurations.

The next thing to do is to calculate the tempo in a different way. Right now the converter calculates it the way that it works for the old Midi-Player. As I changed everything to a interrupt based system I now have to calculate the bar-length instead of the tempo. I simply calculated this by hand for the Zelda-Music demo so I already know how to do that… I just have to implement it.
However, I also have to change some stuff in the Midi-Player to make this more flexible.

OK, I changed the Midi-Player and the Converter to use the bar length. This way the system should work for all of the other Midis as well.

The next step is to clean up the Midi player to make it easier to add new songs. At the same time I can test the conversion of some other Midis.

I cleaned up the Midi-Player today. It is now way easier to add/choose/play songs from code. I also added a feature that analyses volume changes to save some space.

I converted some other Midis to check out the results. I think the conversion went ok but it does not sound as good as the Zelda track. I think this mainly caused by the quality of the Midis I converted.

The next thing to do is to integrate the SU sound engine for sound effects. Therefore I need to switch the libgccvb which is always tedious.

Glad to hear that you’ve been making good progress with this. Do you plan to include all the original songs from the first GameHero in the new game, but with the updated sound and extra sound channels? That would be so great.

Benjamin Stevens wrote:
Glad to hear that you’ve been making good progress with this. Do you plan to include all the original songs from the first GameHero in the new game, but with the updated sound and extra sound channels? That would be so great.

That’s the plan. However, it depends on how good the Midis convert. I will of course include new songs as well.

I started integrating the SU Sound Engine today. Switching the libgccvb was a pain but I found an acceptable way. The SUSE is now part of the Midi-Player and can be used for playing the sound effects. It now uses my methods for setting up the sound, playing notes and so on. I also added a feature so that the volume can be set within in the sound definitions.

I still need to fix the channel selection though. The SUSE dynamically picks a free channel while the Midi-Player assigns a channel to a specific track. Shouldn’t be to complicated to fix this.


Write a reply

You must be logged in to reply to this topic.