fbpx
Skip to main content

MIDI Forum

Midi file normalize...
 
Notifications
Clear all

Midi file normalizer? Midi file humanizer?

11 Posts
3 Users
0 Reactions
8,063 Views
Jason
Posts: 424
Honorable Member
Topic starter
 

I'd be interested in doing two things with some midi files.

Number one: I have a utility that converts assorted video game music to MIDI. However, it does not give you any options, so you get what you get. Every one of the files comes out super quiet. Is there a piece of software that will "normailze" a midi file similar to how you would normailze an audio clip in a sound editor? So you give it the midi file, and it adjusts all of the volumes in the file to make the overall file louder up to a certain set limit.

Number two: is there a piece of software that will "humanize" a midi file? To make it sound more natural, like tweaking timings, volumes, etc with slight variations to make it sound more "human"?

 
Posted : 04/10/2021 5:18 pm
Sema
 Sema
Posts: 180
Reputable Member
 

Sounds like all this can be done with a simple script.
Can you attach some samples?

 
Posted : 04/10/2021 9:17 pm
Geoff
Posts: 1039
Noble Member
 

Regarding the volume level, I'd suspect that 'normal' for the music to go with a game may not be THAT loud. So the midi file is just reflecting the relative level of the original sound. What sort of file is the original, I wonder how much information there is in that about the relative levels. Maybe there is something that can make that louder before you do the conversion. That aside, if you've got the midi data, then it's just a matter of increasing the velocity data, which could be between 1 and 127. If the current data shows as, say, between 1 and 60, then you could add 67 to everything, this would retain the relative levels. Also, note what any Master Volume settings are, maybe that might allow a better adjustment.

As for the 'humanising', if the music is little more than background music, it could have been over-limited (reduced dynamic range), so as well as increase the overall volume you might need to increase the dynamic range (i.e. make the quieter notes quieter and the louder notes louder). Again, this depends on what the original music actually sounds like. If the present process has spotted the Note On events, and calculated the Note Offs then this could have produced something overly mechanical? And lost a LOT of the feeling in the music. Again, depends on the nature of the original data.

Some of the better sequencer packages have options to Quantise the music, and un-quantise (i.e. humanise) it, and these options have various parameters that can be experimented with to get the sort of result (sound) that you want. Ideally, the changes should take account of the beat of the music, as well as the original levels?

Again, it would be interesting to hear an original file, and the midi file created from it.

Geoff

 
Posted : 05/10/2021 2:39 pm
Jason
Posts: 424
Honorable Member
Topic starter
 

In this particular instance, I am working on converting Super Nintendo SPC music in to MIDI. The SPC format is somewhat similar to MIDI in terms of how it works, but does not have things like fixed pitch. The music is all sample based, and the pitch of notes is based off of the pitch of the sample. So if there was a piano, and the sample was recorded as an A, then the notes would be referenced to that A. The there may be another sound sampled as a D, and the pitch of those notes would also be referenced relative to the D. So the software makes a "guess" as to how those notes covert to a standard scale by running the sample through a filter and guessing based on the highest/most prominent frequency present in the results. There is no "standard" way that Super Nintendo games produced their sound. It was up to the individual game manufacturers to write their own sound engines. The SPC file format is actually a rip of the sound engine from the game, and then the MIDI-like note data that goes along with it.

I can sort of provide a sample, though this particular one doesn't seem to be that different volume-wise from what I've seen with some others. It may be as you say that in the game it is quieter to begin with.

https://www.zophar.net/music/nintendo-snes-spc/super-castlevania-iv Track #29 is the original ( the files are downloadable if you want to also download a player for them :p )

scv4-22.mid - is converted with spc2midi, which has options for selecting instrument, volume, reverb, chorus, pitch bend, pitch (for correcting wrong pitch guesses), ADSR attack, and ADSR decay, and choosing whether a particular sound is instrument or percussion. Instrumentation was deduced/selected in the converter (still working on determining best GM1 instruments before I convert to GM2/XG/GS). This program was last modified in 2005. Strangely, if I disable pitch bend, the pitch actually changes by maybe 1/4 of a tone during playback. Not sure if this is the converter or the actual MIDI playback that is causing it.

Beginning_mod.mid - is converted with vgmtrans, which has NO options. Instrumentation was just quickly modified from its defaults with my instrument editor (MIDI-MIS!) to try to match the other one for demo purposes. vgmtrans is under current development, forked from an older project, but the MIDI output portion has not changed much in quite a while. One benefit of this program is that you can create a soundfont from the original game samples. Unfortunately, all instruments are assigned starting from 1 until the maximum sample number, with no way in the program to change which instruments they are mapped to, or adjust any other settings in the process.

It's a very time-consuming process to go through all of the files in the spc2midi MIDI converter to select instruments and figure out what sounds best for each. It wasn't until the past week or so that I realized I could adjust the pitch outside of their pre-defined -36 to +36, which is sorely needed in one particular game, where almost every track has different values for almost every instrument (one as low as -94!). Since I figured that out I've been much more happy with the results. It fixes some things where I thought the notes were all missing, when in reality they were either at much too high or low of an octave to be either audible or reproducible. I've been making an Excel spreadsheet so I have everything ready to go when I make the final files. I attached a partial screeshot.

My ultimate goal is to have the MIDI files sound as good as or better than the original source material. I am playing them back using the Timbres of Heaven soundfont as well as some others (like an 8-bit NES soundfont). I have at least 52 soundtracks that I regularly listen to, and I'd like to convert most of them.

De-quantizing sounds interesting, now at least I have a term that I can further investigate. This wasn't necessarily related to the video game music, just a general curiosity I had.

 
Posted : 06/10/2021 1:20 pm
Jason
Posts: 424
Honorable Member
Topic starter
 

A better example of the kind of results I'm looking for, as this is the most recent game I've been examining, and I like how it's coming along. This is good and doesn't need the normalizing or anything (at least, not at this point in time!)

https://www.zophar.net/music/nintendo-snes-spc/super-r-type
track #8 National Anthem Of Bydo Empire

https://drive.google.com/file/d/19k6isjZAVmbLPRdMNR8-Dru5me5ALW5f/view?usp=sharing
Converted MIDI file using spc2midi

https://drive.google.com/file/d/1sHgxoiI3lBX_xJr5n-4rHppisUGj2sdl/view?usp=sharing
How it sounds playing back on my computer!

 
Posted : 06/10/2021 1:47 pm
Sema
 Sema
Posts: 180
Reputable Member
 

Both files need a lot of cleanup.
In addition scv4-22.mid has some of invalid messages "80 ff 14"

 
Posted : 06/10/2021 6:49 pm
Jason
Posts: 424
Honorable Member
Topic starter
 

[quotePost id=11190]Both files need a lot of cleanup.
In addition scv4-22.mid has some of invalid messages "80 ff 14"[/quotePost]Yeah, I ran the first one through your tester when I made it and it has some issues. I actually was going to write my own software to do the conversion after I couldn't find anything better, but reality sank in after I started working on my MIDI instrument editor 😉 I have run one of them through the repair option in Anvil Studio, and it seemed to clean it up pretty well, but I haven't taken a good look at it yet, as I am still MILES away from being at the point where it will matter. 😀

 
Posted : 07/10/2021 9:12 am
Sema
 Sema
Posts: 180
Reputable Member
 

If you want something done right, do it yourself! 😀

 
Posted : 07/10/2021 10:23 am
Geoff
Posts: 1039
Noble Member
 

Just out of technical interest, I've just played the scv4-22 midi. Hm?? If I was trying to play a game with this in the background, I'd go mad. And MUTE it!

Yes, I accept that it's been converted from another system entirely, and I suppose it's pretty impressive to have got anything that sounds even a bit like 'music'. I also understand that this is a 'work in progress'?

I was playing it using SynthFont, which uses the Timbres of Heaven SF2 data. The file loaded OK, there was no complaint that I could see. A range of channels are implemented, but clearly the setting of suitable instrumentation is incomplete, so there's still a LOT of 'acoustic piano', but some things have been changed from acpno which I assume was the original setting for everything?

There seems to be a disproportionate use of certain effect, i.e. 'expression', relative to the small number of Note On/Off events on each channel. I'd wonder if events that should refer to separate (and different) notes has been mis-interpreted as a single note with variations of expression (etc)?

The piano roll display looks strange. This shows the same preponderance of long/sustained notes.

In addition to this, almost no notes start at the beginning of a bar, most start well into the first quarter, some not until nearly half way in. I'm wondering if the timing is out? The discrepancy between the notes and the bars is somewhat regular, so if all the music was moved a little to fit the bars, then the vast majority would look OK on the piano roll display - even if a few were still out.

Intersting though???

Geoff

 
Posted : 07/10/2021 3:03 pm
Jason
Posts: 424
Honorable Member
Topic starter
 

Hmm, interesting indeed. When I play it I do not get any piano at all (except one that is set to Bright Acoustic Piano). It sounds decent in both Winamp and Midi Player, albeit with several instruments whose pitch is wayyyyy too high. It very well may be a product of invalid data in the generated file. Give this one a test. I ran it through Anvil Studio's repair and removed extra piano tracks that it added during the repair. It removed a bunch of pitch bends, pan pots, one FineChannelVolume, and 3 note off events.
"Removed 3 unnecessary NoteOff events.
Moved 16 ProgramChange after Reset events.
Removed 34 unnecessary MIDI Controller events.
Removed 347 unnecessary pitch-bend events."

You can see the actual game if you want it in context
https://youtu.be/jd7P7niYimk?t=3888

 
Posted : 07/10/2021 9:28 pm
Jason
Posts: 424
Honorable Member
Topic starter
 

Also note that the SNES has 8 sound channels, and none of them are dedicated to percussion. spc2midi keeps all note data on the same channel as in the original game file except for items that are marked as percussion during the conversion, which get moved to the percussion channel. Because everything in the original game music is a sample, all effects can be applied to all sounds, unlike MIDI where percussion has restrictions. For example, a drum sound might be played in the original with various different pitches, which could only be done in GM using one of the "instrument" percussions, like Timpani, Melodic Tom, etc. Many game sounds are also just small blips of the longer sound samples, so one "tuba" might be responsible for creating 4 or 5 different musical sounds for the game.

While I'd love for the conversions to create a fully compliant, legible, and nice looking quantized files, I'm probably going to be left with things that are "good enough" for my purposes.

 
Posted : 07/10/2021 9:45 pm
Share: