Doofus music

Discuss game modding
Post Reply
Malvineous
8-bit mega nerd
Posts: 292
Joined: March 17th, 2007, 6:40 pm
Location: Brisbane, Australia
Contact:

Doofus music

Post by Malvineous »

Hi all,

For anyone who's interested, I have recently managed to reverse-engineer the music format used in Doofus. It's called "The Bone Shaker Architect" (or at least that's the name of the program that created the files) and I think I have the songs playing pretty well.

Here's a sample of the level 1 music playing back through Camoto: https://www.youtube.com/watch?v=3BsN518nEEg I change one of the instruments slightly towards the end just to prove that it's a live playback :-)

I also found a new song I have never heard before, which I am assuming is the Finale music when you complete the game. The game is so difficult that I have only ever finished one level so I probably would never have heard this song otherwise! It's very short (30 seconds) but here it is if you'd like to hear it: https://www.youtube.com/watch?v=B1-yRLM98ec

I hope to have the code committed to the git repository soon, and I will see if I can release another Windows version after that if anyone wants to play around with it.
User avatar
Lunick
6-bit nerd
Posts: 77
Joined: March 2nd, 2013, 2:55 am
Location: Tasmania, Australia
Contact:

Re: Doofus music

Post by Lunick »

Edit: Wrong thread
Last edited by Lunick on October 7th, 2014, 2:53 am, edited 1 time in total.
Malvineous
8-bit mega nerd
Posts: 292
Joined: March 17th, 2007, 6:40 pm
Location: Brisbane, Australia
Contact:

Re: Doofus music

Post by Malvineous »

You did?!
User avatar
DOSGuy
Website Administrator
Posts: 1063
Joined: September 2nd, 2005, 8:28 pm
Contact:

Re: Doofus music

Post by DOSGuy »

Cool!
Today entirely the maniac there is no excuse with the article.
paranoidroid
Less than a nibble
Posts: 3
Joined: October 24th, 2018, 12:33 pm

Re: Doofus music

Post by paranoidroid »

I am trying to convert the Doofus music to MIDI files with Camoto, but it doesn't work.
Here's what I get:

Code: Select all

C:\Temp>"c:\Program Files (x86)\Camoto\gamemus.exe" 1-intro.bsa -n 09.mid -c mid-type0:test.mid
Opening 1-intro.bsa as type <autodetect>
File is definitely: The Bone Shaker Architect [tbsa-doofus]
File is definitely: Standard MIDI File (type-0/single track) [mid-type0]
[decode-midi] Unknown MIDI meta-event 0x54
[decode-midi] Unknown MIDI meta-event 0x58
Ignoring unknown MIDI controller 0x7
Ignoring unknown MIDI controller 0x7
Ignoring unknown MIDI controller 0x7
Ignoring unknown MIDI controller 0x7
Ignoring unknown MIDI controller 0x7
Ignoring unknown MIDI controller 0x7
Loaded replacement instruments from 09.mid
Wrote test.mid as mid-type0
I get a 33 bytes test.mid

I tried different mid files for the -n action, but none work.

Has anyone tried this? Anyone had any success?
I am trying to play this music with a good MIDI soundfont to see how it can be even better (the original is really good, but I just want to hear it this way too).
Malvineous
8-bit mega nerd
Posts: 292
Joined: March 17th, 2007, 6:40 pm
Location: Brisbane, Australia
Contact:

Re: Doofus music

Post by Malvineous »

You're close! Just missing one step.

If you use the -i option to list the instrument mappings you can see the problem:

Code: Select all

Channel map:
Track 0: OPL 0 [chan 0 @ chip 0] (inst: 5)
Track 1: OPL 1 [chan 1 @ chip 0] (inst: 5)
Track 2: OPL 2 [chan 2 @ chip 0] (inst: 5)
Track 3: OPL 3 [chan 3 @ chip 0] (inst: 10)
Track 4: OPL 4 [chan 4 @ chip 0] (inst: 13 15)
Track 5: OPL 5 [chan 5 @ chip 0] (inst: 6 10 13 15)
Track 6: OPL percussive bass drum (inst: 4 0 17)
Track 7: OPL percussive snare (inst: 2)
Track 8: OPL percussive tomtom (inst: 16)
Track 9: OPL percussive top cymbal (inst: none)
Track 10: OPL percussive hi-hat (inst: 3)
Here, each track is mapped to an OPL channel. Since MIDI files do not have OPL channels (they have MIDI channels) each track is lost during the conversion. The solution is to remap each track so that it is moved over to a MIDI channel instead of an OPL one, which will result in it being included in the output file:

Code: Select all

gamemus ... -k 0=m0 -k 1=m1 -k 2=m2 -k 3=m3 -k 4=m4 -k 5=m5 -k 6=m6 -k 7=m7 -k 8=m8 -k 9=m10 -k 10=m11 -i
It's a bit verbose but here each track is being mapped to a MIDI equivalent, except we are skipping MIDI channel 9 as this is the percussive channel (it's normally channel 10 when you count from 1, but gamemus counts from 0 making it channel 9 instead.) The -i option is placed after all the -k ones so that an updated channel mapping is shown:

Code: Select all

Track 0: MIDI 0 (inst: 5)
Track 1: MIDI 1 (inst: 5)
Track 2: MIDI 2 (inst: 5)
Track 3: MIDI 3 (inst: 10)
Track 4: MIDI 4 (inst: 13 15)
Track 5: MIDI 5 (inst: 6 10 13 15)
Track 6: MIDI 6 (inst: 4 0 17)
Track 7: MIDI 7 (inst: 2)
Track 8: MIDI 8 (inst: 16)
Track 9: MIDI 10 (inst: none)
Track 10: MIDI 11 (inst: 3)
This produces a 29 kB working MIDI file for me.
paranoidroid
Less than a nibble
Posts: 3
Joined: October 24th, 2018, 12:33 pm

Re: Doofus music

Post by paranoidroid »

Malvineous, thank you so much! I will try this later and report back. :)

EDIT:
My gamemus.exe doesn't know -k switch. I tried replacing it with -e, but it didn't work:

Code: Select all

C:\Temp>"C:\Program Files (x86)\Camoto\gamemus.exe" -k
gamemus: unrecognised option '-k'.  Use --help for help.

Code: Select all

C:\Temp>"C:\Program Files (x86)\Camoto\gamemus.exe" 1-intro.bsa -n mid-type0:00.mid -c mid-type0:test.mid -e 0=m0 -e 1=m1 -e 2=m2 -e 3=m3 -e 4=m4 -e 5=m5 -e 6=m6 -e 7=m7 -e 8=m8 -e 9=m10 -e 10=m11 -i
Opening 1-intro.bsa as type <autodetect>
File is definitely: The Bone Shaker Architect [tbsa-doofus]
[decode-midi] Unknown MIDI meta-event 0x54
[decode-midi] Unknown MIDI meta-event 0x58
Ignoring unknown MIDI controller 0x7
Ignoring unknown MIDI controller 0x7
Ignoring unknown MIDI controller 0x7
Ignoring unknown MIDI controller 0x7
Ignoring unknown MIDI controller 0x7
Ignoring unknown MIDI controller 0x7
Loaded replacement instruments from 00.mid
Wrote test.mid as mid-type0
Renamed instrument 0 as m0
Renamed instrument 1 as m1
Renamed instrument 2 as m2
Renamed instrument 3 as m3
Renamed instrument 4 as m4
Renamed instrument 5 as m5
Renamed instrument 6 as m6
Renamed instrument 7 as m7
Renamed instrument 8 as m8
Renamed instrument 9 as m10
Renamed instrument 10 as m11
Loop return: Order 0
Channel map:
Track 0: OPL 0 (inst: 5)
Track 1: OPL 1 (inst: 5)
Track 2: OPL 2 (inst: 5)
Track 3: OPL 3 (inst: 10)
Track 4: OPL 4 (inst: 13 15)
Track 5: OPL 5 (inst: 6 10 13 15)
Track 6: OPL percussive bass drum (inst: 4 0 17)
Track 7: OPL percussive snare (inst: 2)
Track 8: OPL percussive tomtom (inst: 16)
Track 9: OPL percussive top cymbal (inst: none)
Track 10: OPL percussive hi-hat (inst: 3)

Listing 18 instruments:
 #0: MIDI patch 14 "m0"
 #1: MIDI patch 73 "m1"
 #2: MIDI patch 46 "m2"
 #3: MIDI patch 29 "m3"
 #4: MIDI patch 33 "m4"
 #5: MIDI percussion note 41 "m5"
 #6: MIDI percussion note 44 "m6"
 #7: MIDI patch 118 "m7"
 #8: MIDI percussion note 42 "m8"
 #9: MIDI percussion note 38 "m10"
 #10: MIDI patch 30 "m11"
 #11: MIDI patch 81
 #12: MIDI percussion note 46
 #13: MIDI patch 0
 #14: MIDI percussion note 75
 #15: MIDI patch 100
 #16: MIDI patch 113
 #17: MIDI patch 55
Result is once again a 33 byte .mid
Malvineous, where did you get your gamemus.exe?
I got the 2015 version from here: http://www.shikadi.net/camoto#Windows

EDIT2:
I just saw that I should have used -m and not -e instead of -k:

Code: Select all

C:\Temp>"C:\Program Files (x86)\Camoto\gamemus.exe" 1-intro.bsa -n mid-type0:00.mid -c mid-type0:test.mid -m 0=m0 -m 1=m1 -m 2=m2 -m 3=m3 -m 4=m4 -m 5=m5 -m 6=m6 -m 7=m7 -m 8=m8 -m 9=m10 -m 10=m11 -i
Opening 1-intro.bsa as type <autodetect>
File is definitely: The Bone Shaker Architect [tbsa-doofus]
[decode-midi] Unknown MIDI meta-event 0x54
[decode-midi] Unknown MIDI meta-event 0x58
Ignoring unknown MIDI controller 0x7
Ignoring unknown MIDI controller 0x7
Ignoring unknown MIDI controller 0x7
Ignoring unknown MIDI controller 0x7
Ignoring unknown MIDI controller 0x7
Ignoring unknown MIDI controller 0x7
Loaded replacement instruments from 00.mid
Wrote test.mid as mid-type0
Mapping track 0 to MIDI 0
Mapping track 1 to MIDI 1
Mapping track 2 to MIDI 2
Mapping track 3 to MIDI 3
Mapping track 4 to MIDI 4
Mapping track 5 to MIDI 5
Mapping track 6 to MIDI 6
Mapping track 7 to MIDI 7
Mapping track 8 to MIDI 8
Mapping track 9 to MIDI 10
Mapping track 10 to MIDI 11
Loop return: Order 0
Channel map:
Track 0: MIDI 0 (inst: 5)
Track 1: MIDI 1 (inst: 5)
Track 2: MIDI 2 (inst: 5)
Track 3: MIDI 3 (inst: 10)
Track 4: MIDI 4 (inst: 13 15)
Track 5: MIDI 5 (inst: 6 10 13 15)
Track 6: MIDI 6 (inst: 4 0 17)
Track 7: MIDI 7 (inst: 2)
Track 8: MIDI 8 (inst: 16)
Track 9: MIDI 10 (inst: none)
Track 10: MIDI 11 (inst: 3)

Listing 18 instruments:
 #0: MIDI patch 14
 #1: MIDI patch 73
 #2: MIDI patch 46
 #3: MIDI patch 29
 #4: MIDI patch 33
 #5: MIDI percussion note 41
 #6: MIDI percussion note 44
 #7: MIDI patch 118
 #8: MIDI percussion note 42
 #9: MIDI percussion note 38
 #10: MIDI patch 30
 #11: MIDI patch 81
 #12: MIDI percussion note 46
 #13: MIDI patch 0
 #14: MIDI percussion note 75
 #15: MIDI patch 100
 #16: MIDI patch 113
 #17: MIDI patch 55
It doesn't work.
I have to try linux version too.

EDIT3: Silly me. :)

This way it worked:

Code: Select all

C:\Temp>"C:\Program Files (x86)\Camoto\gamemus.exe" -m 0=m0 -m 1=m1 -m 2=m2 -m 3=m3 -m 4=m4 -m 5=m5 -m 6=m6 -m 7=m7 -m 8=m8 -m 9=m10 -m 10=m11 -i 1-intro.bsa -n 00.mid -c mid-type0:test.mid
The resulting MIDI has most instruments wrong though... Have to find a better sample for my 00.mid
Malvineous
8-bit mega nerd
Posts: 292
Joined: March 17th, 2007, 6:40 pm
Location: Brisbane, Australia
Contact:

Re: Doofus music

Post by Malvineous »

Sorry I forget the Windows version is so far behind the git version. I had to rename the option to -k, so that I could use -m to set song metadata in the latest version.

You will never get a good set of instruments with the conversion as there's no way to set them "properly". Using -n to load the instruments from another file is just a workaround. At the moment you'll need to load the output MIDI file in a sequencer such as Rosegarden and set the instruments yourself one by one.

The code itself can replace all the instruments to exactly what you want, there's just no way of doing this through the gamemus command line yet.
paranoidroid
Less than a nibble
Posts: 3
Joined: October 24th, 2018, 12:33 pm

Re: Doofus music

Post by paranoidroid »

OK, does than mean that it could be done with linux version of Camoto? Or would we have to wait for gamemus to be able to do it?
Malvineous
8-bit mega nerd
Posts: 292
Joined: March 17th, 2007, 6:40 pm
Location: Brisbane, Australia
Contact:

Re: Doofus music

Post by Malvineous »

From memory Camoto Studio can do it, remapping each instrument to the MIDI one you want, but because it's so many years out of date now it may prove too difficult to get going. But if you want to try, the basic process is to open Camoto and configure MIDI support, then once that works create a new project for Doofus, double-click on the song, adjust every instrument to be the MIDI equivalent (should be able to do this while the song is playing) then export the song. Would recommend exporting it before you do too much fiddling just to make sure it's going to work because there could still be issues that have since been resolved, but are still problems because that version is so old.
Post Reply