siMMpLified - put your own tunes into Out Run

cmonkey

Active member
vacBacker
Feedback
4 (100%)
Credits
1,658CR
Hi

Seems like a long time since I posted anything here.....

Welcome to siMMpLified, a slightly easier way of putting your own tunes into Out Run. This project was bourne out of a comment that paulcan69 made on the Out Run Music Extender thread a couple of months ago about the possibility of porting Winning Run from Super Hang-On to Out Run. I investigated the possibility at the time and realised that it was indeed possible to port it, with the addition of a few minor enhancements to the OR audio engine, so I set about it.

In the process of porting it I figured it would be nice to give other people a fighting chance of putting their own composition(s) into OR so I created the siMMpLified helper kit to (hopefully) make it easier for people to do this.

The archive contains everything you need to get started on putting your own tunes into the game, including a very extensive readme explaining how tunes in OR work, how to use the audio engine to its fullest and also several examples showing off the various features of the OR audio engine and also the full 'source' to Winning Run (as ported to work in OR). Feel free to play around with the samples and the Winning Run 'source'. You'll need pasmo 0.6.0 to assemble things (other macro assemblers will probably work with minor alterations to the source of the macros/defines files).

The package also includes the pre-assembled Winning Run tune ORG'ed at two different addresses ($20c8 to stomp over Splash Wave and $3d5f to stomp over Magical Sound Shower) so that you can quickly paste it into the OR audio rom and try it out. You'll need to do a few patches (36 bytes) to the audio program to add support for a feature that's missing in OR (but present in SHO). The tune will play without the patches to the audio program but it won't sound as good as it does when played in SHO. Details of the patches required to the audio program are in the readme.

This is what Winning Run in OR sounds like :-


You can also do crazy stuff like this (source for this is in the archive) :-


I hope this helps at least one person put their own composition into OR. If it does then it's worth the time I spent on creating it.

Have fun and let me know what you think of Winning Run in OR. Do you think it fits into the game? And let me know if you need any help in getting your own tune into the game and I'll be happy to help, as best as I can.

https://www.ukvac.com/forum/data/uploads/1497/siMMpLified.zip
 

smarty

Ready Player One
vacBacker
Feedback
12 (100%)
Credits
1,291CR
Awesome work Ade!

Great to see you coding Arcade stuff again.

Winning Run's a great tune, always the one I choose in SHO.

I'll have a good read of your attached docs when I get a chance.

smiley20.gif
 

xga

Newbie
Feedback
2 (100%)
Credits
79CR
Incredible work, cmonkey!

I might have missed it referenced in the readme file, but is there a reason why Last Wave no longer plays when the game ends?

Would be great to see this work in conjunction with the music extender board too.
 

cmonkey

Active member
vacBacker
Feedback
4 (100%)
Credits
1,658CR
Thanks for the kind words guys!
smiley1.gif


xga said:
Incredible work, cmonkey!

I might have missed it referenced in the readme file, but is there a reason why Last Wave no longer plays when the game ends?

Would be great to see this work in conjunction with the music extender board too.

I'm not sure what you mean? Last Wave plays every time for me, when the game ends, as long as I make it onto the high score table.
 

xga

Newbie
Feedback
2 (100%)
Credits
79CR
cmonkey said:
Thanks for the kind words guys!
smiley1.gif


xga said:
Incredible work, cmonkey!

I might have missed it referenced in the readme file, but is there a reason why Last Wave no longer plays when the game ends?

Would be great to see this work in conjunction with the music extender board too.

I'm not sure what you mean? Last Wave plays every time for me, when the game ends, as long as I make it onto the high score table.

My bad.
smiley9.gif
 

dj_yt

Active member
Feedback
3 (100%)
Credits
787CR
Great project and documentation on this one Ade.

I haven't had time to digest it fully yet, but can't wait to have a play around with it when I have time!
 

dj_yt

Active member
Feedback
3 (100%)
Credits
787CR
Second comment - any idea why the 3DS tunes are so big?

I haven't decompiled them yet, but I like to hope they don't offer 'proper' looping and waste a lot of space, due to not having to work on real hardware.

Ideally I'd like to decompile them, rewrite them, and squeeze the 2 extra tracks into a standard 64k EPROM that can be used on original hardware without the extra PCB.

It's a shame DefleMask isn't open source, so that OutRun specific support could be added...
 

cmonkey

Active member
vacBacker
Feedback
4 (100%)
Credits
1,658CR
Thanks Chris. Coming from someone who I consider to be the God of Out Run's codebase that means a lot to me.
smiley4.gif


I haven't studied the 3DS tunes in great detail so I just had a quick look at Camino-A-Mi-Amor and, as you've already suspected, it doesn't make use of loops in the way the original tunes did, I'd imagine Cruising Line is the same. I guess back in '86 they were coding for limited resources and hence had to make every byte count, not something they'd have had to worry about when creating the new tunes on 3DS, hence the lack of loops. Also, it looks like there's quite a lot of unused track data in Camino, from my quick scan of the tune I found at least one partial FM track and one partial PCM track which don't appear to be used, I guess these are leftovers from dev which they didn't bother to remove.

The sizes of Camino's FM tracks are :-

track 0 - 1710

track 1 - 2031

track 2 - 1730

track 3 - 2938

track 4 - 654

track 5 - 832

track 6 - 1430

track 7 - 946

The 5 PCM tracks weigh in at 7436 bytes in total (which is as big as the entire tunes of Passing Breeze and Last Wave together!). Camino uses 19 FM patches at 53 bytes per patch.

The tune data lends itself quite well to compression, Camino squeezes down from 22631 to 10056 bytes using the popular zx7 compressor. The OR version of Winning Run squeezes down from 5527 to 2493 bytes. I did some tests on decompression times using a 6Mhz Z80 (50% faster than OR's) and it took about 13 frames to decompress Winning Run from rom into 8kb of work ram on my test platform. Unfortunately that's not going to be an option on OR due to the lack of work ram.

Looking at the binary data for the FM tracks it's quite easy to spot repeating patterns of ASCII chars that would be much better suited in loops. It's not as easy to spot repeating patterns in the PCM tracks due to the fact that the bytes used in those tracks are generally outside the printable ASCII char range which would make picking out patterns in a hex editor easy.

I know that you'd studied the OR audio engine and tune format in some detail when you created Cannonball many years ago so what I've provided here in siMMpLified probably won't be much new to you but it might make reversing the 3DS tunes a little quicker than without it.

It certainly is a shame that DefleMask isn't open source, the authors of it could learn a lot from you and what you did with Cannonball. Maybe Delek would be open to discussion on adding OR specific support one day but the focus of the devs appears to be on the mobile versions these days, the desktop version hasn't had updates for a long time.
 

dj_yt

Active member
Feedback
3 (100%)
Credits
787CR
That's excellent news regarding the 3DS tracks. The dream would be to cram 3 more tracks into the extra 32k. I could write some sort of debugging heuristic into the CannonBall engine to output which sections of the track are used, unused and duplicated.

I have this project on the backburner at the moment, but I will look into it when I have the illusive combination of time and motivation. As you've probably noticed, my output isn't quite as prolific these days, although time is improving as the kids are getting a little older!
smiley1.gif


There are a bunch of other enhancements I'd like to bring over to the Enhanced Edition ROMs too. This work will certainly help extensively.

It's great to see you're still tinkering with arcade stuff from time to time.
 

minwah

Active member
Feedback
3 (100%)
Credits
238CR
This looks amazing! I'm a bit snowed under at the moment but would love to have a go at making a tune, or perhaps try to squeeze down the size of Camino-A-Mi-Amor to fit.

Are there any instructions around for getting the tune data out of 3DS Outrun? Presume it's just a case of knowing which positions to look in the rom file?

It's been a while since I put myself through the torture of writing music in a hex editor...last time was 1942 thanks to cmonkey's reverse enginnering efforts. Still very greatful for that!
 

cmonkey

Active member
vacBacker
Feedback
4 (100%)
Credits
1,658CR
minwah said:
This looks amazing! I'm a bit snowed under at the moment but would love to have a go at making a tune, or perhaps try to squeeze down the size of Camino-A-Mi-Amor to fit.

Are there any instructions around for getting the tune data out of 3DS Outrun? Presume it's just a case of knowing which positions to look in the rom file?

It's been a while since I put myself through the torture of writing music in a hex editor...last time was 1942 thanks to cmonkey's reverse enginnering efforts. Still very greatful for that!

You'll only need a hex editor for pasting the finished tune into the OR audio rom, the actual creating of the tune is done in a text editor and assembled with pasmo 0.6.0.

I used to have all the offsets for the new tunes in the 3DS binary but I can't find the doc now. If you want the extracted tunes drop me a PM and I'll sort you out.

I still remember your great tune making skills in 1942, considerably better than the stock 'tune' that shipped with the game. Looking forward to hear what you can do with 13 channels to play with.
 

cmonkey

Active member
vacBacker
Feedback
4 (100%)
Credits
1,658CR
dj_yt said:
That's excellent news regarding the 3DS tracks. The dream would be to cram 3 more tracks into the extra 32k. I could write some sort of debugging heuristic into the CannonBall engine to output which sections of the track are used, unused and duplicated.

I have this project on the backburner at the moment, but I will look into it when I have the illusive combination of time and motivation. As you've probably noticed, my output isn't quite as prolific these days, although time is improving as the kids are getting a little older!
smiley1.gif


There are a bunch of other enhancements I'd like to bring over to the Enhanced Edition ROMs too. This work will certainly help extensively.

It's great to see you're still tinkering with arcade stuff from time to time.

After studying Camino in more detail it turns out that they've structured it a little differently to the 4 original tunes of OR. With Camino they put all the subroutines BEFORE the track data, whereas the original tunes put the subroutines AFTER the track data. This accounts for what I originally thought was unused track data (it's not unused after all).

I've now fully reversed FM track 0 of Camino and verified it against the original 3DS version. It uses 4 of the 18 patches (originally thought to be 19 patches but one of them is borked and unused). I must say that reversing tunes is a joy with the help of the siMMpLified kit, doing track 0 only took about 2 hours. It's assembled at Splash Wave's address and ready to paste into the rom at $20c8. I haven't studied the track in great detail to look for potential loop points but listening to it does seem to yield certain parts which *might* be loop-able. It may turn out to be harder than was first thought to squeeze it down to sub 16kb though. I'll probably have a look one of the PCM tracks next as they looked to be huge and potentially a candidate for looping sections and space saving.

It's certainly going to be a challenge to lose 14Kb out of the combined size of Cruising Line and Camino to squeeze them into the top 32Kb of a 64kb rom!

I hear you on the 'illusive combination of time and motivation' thing, and I don't have a wife and kids to keep happy either!

https://www.ukvac.com/forum/data/uploads/1497/camino_fm0.zip
 

minwah

Active member
Feedback
3 (100%)
Credits
238CR
cmonkey said:
You'll only need a hex editor for pasting the finished tune into the OR audio rom, the actual creating of the tune is done in a text editor and assembled with pasmo 0.6.0.

That sounds like bliss, will have a good read of the docs when I get a minute.

I used to have all the offsets for the new tunes in the 3DS binary but I can't find the doc now.  If you want the extracted tunes drop me a PM and I'll sort you out.

Cool thanks!

I still remember your great tune making skills in 1942, considerably better than the stock 'tune' that shipped with the game.  Looking forward to hear what you can do with 13 channels to play with.

Blimey 13! Suspect it will be good fun messing around but quite a challenge to make a decent tune that can make the most of those channels...minwah2019-11-07 00:09:44
 
Top