The forum about vgm files
It is currently 2022-12-01, 18:19:18

All times are UTC + 1 hour [ DST ]

Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: 2021-03-02, 20:44:50 

Joined: 2021-02-24, 23:58:53
Posts: 7
I originally posted this on Zophar's forum. Not sure if/when I will get a reply, as it is very quiet over there these days.

I just used the modified XM6 build to export all of the midi music from Akumajou Dracula (Sharp X68000).

I am currently working on getting good sounding midis of the SNES Castlevanias.

I spent the past few days ripping Castlevania 4 using spc2midi English R2. I have a CV4 soundfont that fairly accurately listed the actual (MIDI) instruments used in the game (loaded in Polyphone soundfont editor). I had to change a few to other instruments in my own list for better sound. I made an excel spreadsheet and played each SPC track of the game in spc2midi to find out which instruments (hex code) each track used. Then I made a cross reference to the correct MIDI instrument. spc2midi defaults all tracks to piano and all percussion to bass drum, so this was a long tedious process. Once the spreadsheet was done, I could quickly load each track, change the instruments, and export the midi file.

I now have a complete MIDI version of the soundtrack. Most of it sounds really really good. However, a few of the tracks are missing some notes (flute) and a few tracks have incorrect frequencies (strings).

I want to use VGMtrans to make alternate versions of said tracks, but it assigns track instruments based on a custom soundfont that you can create from the SPC itself, and starts at channel 1, so if you play it with any other soundfont, it sounds like garbage.

I am looking for a way to modify these "new" VGMtrans midi file instruments easily. On my first test, track 7a, which is missing flute notes with spc2midi, has all the notes with VGMtrans. The beginning notes are all cut short, but I may be able to easily fix that in my midi editor, Anvil Studio.

Anvil Studio can change instruments, but can not do it globally. Meaning, say a piano in wrong, and each track switches between many instruments over the course of the song, you have to manually find every piano and change it individually.

Kanto Audio Editor is *so close* to doing it, but the software has major design flaws with the instrument list and how you select the new instrument. Names are inconsistent, and there are no MIDI instrument numbers, so it's a ton of guesswork to pick a current instrument, change it, back out to the previous menu, then listen to the whole song again to get to the part where that instrument plays to see if you got it right, or have to do it again. And again... and again.

Sooooo, I guess my main question is:
Easy way to change midi instruments?
- or -
Even better way to convert SPC to midi?

I'd be more than happy to share my final results for all to enjoy.

( If this isn't appropriate for vgmrips, let me know, but it technically is a video game music rip, right? :P If there's another forum that would be a good place to ask, I'd also appreciate that, thanks! )

 Post subject:
PostPosted: 2021-03-02, 21:47:14 

Staff Staff
Programmers Programmers
Musicians Musicians
Contributors Contributors
Reverse engineers Reverse engineers
User avatar

Joined: 2011-12-01, 20:20:07
Posts: 4299
Location: Germany
To be honest - for such things I usually just use a hex editor.
It's not that hard, and for instrument changes it is also highly unlikely to break anything.

You subtract 1 from the channel and instrument numbers first.
Then you make the MIDI command number by adding C0 to the channel.
You get "Cx ii" (x = channel, ii = instrument) as codes to search/replace.

In order to change MIDI channel 1 instrument "2 Bright Piano" to "74 Flute", you:
  • search for C0 01
  • replace with C0 49
This is a pretty safe method. It may not work for consecutive patch change events with MIDIs written by some MIDI editors though. (some editors omit the command byte when multiple commands of the same type+channel are following each other)

I also moved the topic from "General VGM Discussion and Software" to "Non-VGM Technical Discussion", because that's the correct subforum for stuff unrelated to the VGM format.

 Post subject:
PostPosted: 2021-03-17, 5:49:30 

Joined: 2021-02-24, 23:58:53
Posts: 7
I've taken the knowledge you provided, and used that to do some research, and am now using it to make my own utility to do bulk change instruments. I tried hex editing one file, but the sheer quantity of files I am working with plus the unknowns of not having a list of which instruments are in each file would make for a suuuuper tedious process.

Currently, I have the ability to load a MIDI (type 1 I believe, standard multi-channel), parse it for instruments, save the locations of all the instrument changes, display all of the instruments in the file (currently as a graphic, working on the text portions) and change all occurrences of that instrument to another, and save to a new file with the changes. Several things are hard-coded right now, but will progress as I work on it more. I started two days ago, and have made great progress, considering I don't like programming :p I'm currently making it using Game Maker Studio, and may attempt to port it to C++ when it's in a good state.

Untitled-1.jpg [ 200.82 KiB | Viewed 3375 times ]
 Post subject:
PostPosted: 2021-03-25, 7:16:35 

Joined: 2021-02-24, 23:58:53
Posts: 7
Here's a screenshot of the progress on my midi instrument editor.
I have the classic dmed.mid (Castlevania Dracula Medley) by Atsushi Jibiki loaded.

Instruments in the file are displayed by name at the top, sorted by track number.
The bottom is a visual grid of all the instrument channel locations.

Instruments can be changed individually per channel or globally per instrument using the toggle in the upper right corner.
Currently the highlighted instrument can be changed using the left/right arrow keys. Drop-down menus are on the agenda.

screenshot.jpg [ 210.28 KiB | Viewed 3247 times ]
 Post subject:
PostPosted: 2021-03-29, 23:41:40 

Joined: 2021-02-24, 23:58:53
Posts: 7
Almost done! Just need to do a few tweaks. Plus maybe add some extra bonus convenience features. Then I can tweak my Castlevania midis 'til my heart's content :beer:

screenshot.png [ 93.35 KiB | Viewed 3158 times ]
 Post subject:
PostPosted: 2021-04-12, 4:16:38 

Joined: 2021-02-24, 23:58:53
Posts: 7
The deed is done.

Unfortunately, much more complicated than simple search and replace. Fortunately there's this little thing called "the internet" that helps when you need to know things!

My program can change instruments in any standard midi file, either on a single channel or across all channels. It can change based on the instruments as originally present in the file, or based on any changes you have made.

I got a ton of helpful info from the folks over at, plus here and a whole plethora of video game and midi programming sites. It took slightly less than a month to build as I learned along the way.

Here are some screenshots of the final product (currently in BETA, as nobody but me has used it).

This doesn't help me RIP the Castlevania midis from my original post, but it definitely helps me with the results of what current tools can produce.

Send me a PM if you'd like to try it out!

MIDIMIS_Logo.png [ 8.8 KiB | Viewed 3030 times ]
File comment: Loaded File
before.png [ 63.69 KiB | Viewed 3030 times ]
File comment: Editing
editing.png [ 92 KiB | Viewed 3030 times ]
File comment: After Edit/Save
after.png [ 68.16 KiB | Viewed 3030 times ]
 Post subject:
PostPosted: 2021-05-23, 23:21:50 

Joined: 2021-02-24, 23:58:53
Posts: 7
I've been working on it since the initial release. I downloaded tons more publicly available MIDI files for testing. I found and fixed several bugs, and am in the process of:

- Adding complete bank support (a doozy!)
- Adding SYSEX reset switching (for example, original file was clearly made on a Roland GS device, but the file is saved as GM)
- Adding missing program changes to files with none (track has notes, no program change)

- Now has a preview option to load the current file in your default midi player
- Supports percussion on all channels (custom per midi file format)
- Now has track name display

This version is not complete yet. However, I wanted to share some progress screenshots. The initial release took about a month to make. This version has been in development since then (about 5 additional weeks so far). I am hoping to find a few people willing to test it out (besides myself) when it is complete.

1 - XG file loaded
2 - Editing instrument via menu
3 - XG file reloaded as forced GM
4 - XG file reloaded as forced GS
5 - Editing percussion via menu
6 - XG SFX channel

01 - Loaded.png
01 - Loaded.png [ 87.86 KiB | Viewed 2443 times ]
02 - Edit W Bank.png
02 - Edit W Bank.png [ 101.99 KiB | Viewed 2443 times ]
03 - Reload GM.png
03 - Reload GM.png [ 96.63 KiB | Viewed 2443 times ]
04 - Reload GS.png
04 - Reload GS.png [ 72.74 KiB | Viewed 2443 times ]
05 - Percussion Sets.png
05 - Percussion Sets.png [ 171.73 KiB | Viewed 2443 times ]
06 - XG SFX.png
06 - XG SFX.png [ 77.9 KiB | Viewed 2443 times ]
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC + 1 hour [ DST ]

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
[ Time : 0.041s | 17 Queries | GZIP : On ]