Skip to content

Ripping Castlevania music to midis

Technical discussion which is not directly related to VGM files. Talk about Hardware and Software.

Moderator: Staff

  • quattj Offline
  • Posts: 8
  • Joined: 2021-02-24, 23:58:53

Ripping Castlevania music to midis

Post by quattj »

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! )
  • User avatar
  • ValleyBell Offline
  • Posts: 4768
  • Joined: 2011-12-01, 20:20:07
  • Location: Germany

Post by ValleyBell »

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.
  • quattj Offline
  • Posts: 8
  • Joined: 2021-02-24, 23:58:53

Post by quattj »

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.
Attachments
Untitled-1.jpg
  • quattj Offline
  • Posts: 8
  • Joined: 2021-02-24, 23:58:53

Post by quattj »

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.
Attachments
screenshot.jpg
  • quattj Offline
  • Posts: 8
  • Joined: 2021-02-24, 23:58:53

Post by quattj »

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:
Attachments
screenshot.png
  • quattj Offline
  • Posts: 8
  • Joined: 2021-02-24, 23:58:53

Post by quattj »

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 midi.org, 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!
Attachments
MIDIMIS_Logo.png
MIDIMIS_Logo.png (8.8 KiB) Viewed 5694 times
Loaded File
Loaded File
Editing
Editing
After Edit/Save
After Edit/Save
  • quattj Offline
  • Posts: 8
  • Joined: 2021-02-24, 23:58:53

Post by quattj »

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
Attachments
01 - Loaded.png
02 - Edit W Bank.png
03 - Reload GM.png
04 - Reload GS.png
05 - Percussion Sets.png
06 - XG SFX.png
  • quattj Offline
  • Posts: 8
  • Joined: 2021-02-24, 23:58:53

Re: Ripping Castlevania music to midis

Post by quattj »

I was recently reminded of this topic by another forum user, so super huge update: I finished CV4 long ago, and have been working on other soundtracks as well, and my MIDI-MIS program for modifying instrumentation in MIDI files has also been massively updated since my last post.

SNES MIDI Remaster Project

I have been working on a project for the last several years remastering my favorite soundtracks from the Super Nintendo Entertainment System (SNES) as high quality GS MIDI Files, and uploading the completed soundtrack videos to YouTube, as well as having the MIDI files available for download.


The full SNES MIDI Remaster Project playlist can be found here:

https://www.youtube.com/playlist?list=P ... CZzPP29Frw


Soundtracks currently remastered:

Axelay https://youtu.be/rkDPkR6QuHc

Legend of Zelda: A Link to the Past https://youtu.be/IknXcaQYxaY

Prince Of Persia https://youtu.be/cFp1Dos_ltM

Super Double Dragon https://youtu.be/6ICJpRNXzaM

Super Castlevania IV https://youtu.be/r0-P66UJDzY

Super Castlevania IV (Prototype) https://youtu.be/PPQJMg3UVng

Super R-Type https://youtu.be/3ApAJHJDjc4


More info about the project/documentation can be found at

https://drive.google.com/drive/folders/ ... drive_link

with additional per-soundtrack info located in the video descriptions, and a link for MIDI-MIS in the project documentation.
Post Reply