• Most people probably don't realise this, but this forum has had two editors for a number of years. One is the xenForo default editor, and the other is a custom editor I made years back I called BBCEd.

    All the settings for which editor you use was lost during the upgrade. You can find the setting under Account Settings > Preferences > Editor.

MIDI to ptcop converter [Release]

Sep 24, 2019 at 9:34 PM
Neophyte Member
"Fresh from the Bakery"
Join Date: Jul 18, 2018
Location:
Posts: 8
#1
hello! i thought i'd make this tool as there isn't anything like it and it might be quite useful to all the pxtone composers (i know you're out there). it does what the title says, plain and simple. while the midi file format has many nuances to it (at least, many more than what i know about it) and many features unsupported by pxtone, i've tested this tool with many different midis and i've had very good results with all of them, i dare even say almost as good as you can possibly get from this kind of conversion.
tempo changes are not supported (yet?). it might take me a while to figure this one out if i ever attempt it, though i don't think it's that much of a big deal. pitch bend is not supported as well, but i am almost positive i will add it some day or another.
there is no need to have only 1 note at a time per track; the tool will manage it and split the tracks when there are more notes playing at once.
type 0 midi files are not supported and i don't plan to add support for them as you can very easily turn a type 0 midi into a type 1 using any DAW and they aren't too common anyways.they are supported as long as they don't contain drums, but it's still much better if you turn it into a type 1 and then run the program on that.
when converting a midi, the tool will create one voice and one unit per track, plus one voice and one unit for every track that has to be split (tracks that contain more than one note playing at a time and drum tracks with more than one type of drum). the actual voice sound will be a random sound chosen out of the org210x waves or drums (chosen appropriately), which you are then free to change to more appropriate instruments. the voice names will begin with W for waves or D for drums, followed by the number of the randomly chosen wave (0-99) or drum (0-5) and the name of the respective midi track (sometimes cut short due to the 16 character limit for voice/unit names). units will just be numbered beginning from 0 and increasing by 1 for every unit. the program currently adds unnecessary units, and units which were originally a single midi track that was split don't share the same voice and their voices won't necessarily have the same instrument. i will fix these if you guys think they are big deals. also, the units originating from the same track should probably be in sequence, but who cares? they are still named properly so you can identify them.
if there is any midi the program doesn't convert, post it and i will do my best to fix it, but for the sake of my sanity please make sure that it is a proper, non-malformed midi (you can verify this if it has consistent behaviour across different programs). if instead there is anything in the resulting ptcop that you deem hasn't been converted properly or at all, just try to be as specific as possible with what doesn't seem right.
i don't guarantee anything for the so-called black midis or similar stuff. the program may crash, your pc may spontaneously combust or the FBI might raid your house. most likely, pxtone will refuse to open it as it went over one of the limitations of the ptcop format.
some pictures to showcase my program, which compare the resulting ptcop with the source midi on FL studio:
as you can see here, this sine-like volume change is no match for my program. it is precisely the same as on the midi. (from a midi of Go Straight from Streets of Rage 2)

nor is this volume change resulting from someone having a stroke on the mixer (from a midi of Slow Moon from Streets of Rage 2)

and this is Dragonforce's Through The Fire And Flames. from the picture you can only see that it has many units and that it's quite long, but there really aren't any issues with this kind of song either.


now, if in some cases it might appear to you that the events (volume, pan, etc) do not match the midi, you will find that they will at least always match when it is important for the notes being played in the unit. this is because while ptcop units can be considered the equivalent of midi tracks, there is no equivalent in the ptcop format for midi channels, so i had to (at least attempt) to work some black magic to make the midi features such as channel volume/pan change convert properly into the ptcop. this is why the events might seem incorrect at first glance in case the original midi had tracks containing notes with different channels. this is also the reason there is always a pan/volume change whenever a note starts playing, but don't worry, it's all good.
to use it just run it from console like this: midi2ptcop.exe midifile1.mid midifile2.mid ... for as many midi files as you'd like, or more simply drag all the midi files you'd like to convert on the program. all the output files will be in the same folder of the program named like the original files.
also, it should probably work on windows 10 32/64 bit, but i have reasons to believe it won't work on older windows (8, 7, xp, etc.) feedback is appreciated on this matter.

infinite thanks to Noxid for his great work with reverse engineering the .ptcop file format (https://www.cavestory.org/forums/threads/deciphering-ptcop-file-format.3786/)

latest version: 1.1.0
Code:
1.1.0:
- added this file
- program now waits for input before closing
- added support for RMI midi files
- added support for non entirely midi-compliant files
- added partial midi type 0 support (no drums)
- fixed dragging files onto the program
- much better starting tempo detection (not perfect yet)
- output files now have the same name as the input files
- added support for processing multiple files at once
 

Attachments

Last edited:
Sep 24, 2019 at 11:12 PM
Jade Online
Monster girl enthusiest
"Keep on rollin'!"
Join Date: Sep 22, 2012
Location: Hugging a tentacle monster
Posts: 438
#2
So is this more functional than pxtone box? If so, this might be super helpful for people like me that wanna make pxtone remixes.

Alright so upon testing, literally none of the midis I have on my computer work with this program, it always throws the "something has gone terribly wrong" error.
 
Sep 25, 2019 at 6:05 AM
Neophyte Member
"Fresh from the Bakery"
Join Date: Jul 18, 2018
Location:
Posts: 8
#3
Alright so upon testing, literally none of the midis I have on my computer work with this program, it always throws the "something has gone terribly wrong" error.
that's weird. can i have a couple of those midis?
 
Sep 25, 2019 at 2:44 PM
Perfectionist
CS Beta Content Discord Admin
CSE Discord Moderator
"Man, if only I had an apple..."
Join Date: Dec 26, 2014
Location: the back of their own hand.
Posts: 1494
Age: 119
#4
Will you make a feature to convert the other way around?
 
Sep 26, 2019 at 5:09 AM
Jade Online
Monster girl enthusiest
"Keep on rollin'!"
Join Date: Sep 22, 2012
Location: Hugging a tentacle monster
Posts: 438
#6
I can't be expected to import these in FL and then export these again, It should be compatable with a majority of the midis you can find on the internet, because that's what most people will use this kind of program for.
 

Attachments

Sep 26, 2019 at 5:21 AM
Perfectionist
CS Beta Content Discord Admin
CSE Discord Moderator
"Man, if only I had an apple..."
Join Date: Dec 26, 2014
Location: the back of their own hand.
Posts: 1494
Age: 119
#7
i think this should cover it (though i haven't tried it personally) https://github.com/yuxshao/ptmidi
>the drums
>>the DRUMS
by the way, did you try the program? does it work fine for you?
Yep, it works!
It gives the "horribly wrong" error for anything that contains tempo changes, like the MIDIs that OrgMaker2 exports, (they have 1 bar with a ridiculously fast tempo before the contents of the actual track) but it's easy enough to fix that.

P.S. velocity import doesn't work...?
P.P.S. nope it works, I'm just a fuckwit
 
Last edited:
Sep 26, 2019 at 8:16 AM
Neophyte Member
"Fresh from the Bakery"
Join Date: Jul 18, 2018
Location:
Posts: 8
#8
I can't be expected to import these in FL and then export these again, It should be compatable with a majority of the midis you can find on the internet, because that's what most people will use this kind of program for.
yes, i agree with you. it should be in fact compatible with what i think is the vast majority of midis, except for those features i mentioned in the op. about those midis, one of them is a type 0 midi; i might add support for them after all as it won't be that hard, but again i think they are quite rare (at least in my experience). another one of them is not being read by the library i use to open midi files, that's quite weird and i'll see if i can pinpoint the issue. the other one (e3m3.mid) gives me no issues whatsoever and converts just fine. can you tell me exactly what error it gives you? and if you have any other midi that doesn't work please put them up for me.
Yep, it works!
It gives the "horribly wrong" error for anything that contains tempo changes, like the MIDIs that OrgMaker2 exports, (they have 1 bar with a ridiculously fast tempo before the contents of the actual track) but it's easy enough to fix that.
can you upload the interested midis? it should still convert midis that contain tempo changes without errors, and i specifically tried it with midis exported from orgmaker and it worked just fine. while tempo changes aren't supported, the program doesn't take the first tempo in the midi, but the first tempo in the midi when notes are played, so on my end i fixed the ridiculously fast tempo issue you described.
 
Sep 26, 2019 at 10:37 AM
Perfectionist
CS Beta Content Discord Admin
CSE Discord Moderator
"Man, if only I had an apple..."
Join Date: Dec 26, 2014
Location: the back of their own hand.
Posts: 1494
Age: 119
#9
yes, i agree with you. it should be in fact compatible with what i think is the vast majority of midis, except for those features i mentioned in the op. about those midis, one of them is a type 0 midi; i might add support for them after all as it won't be that hard, but again i think they are quite rare (at least in my experience). another one of them is not being read by the library i use to open midi files, that's quite weird and i'll see if i can pinpoint the issue. the other one (e3m3.mid) gives me no issues whatsoever and converts just fine. can you tell me exactly what error it gives you? and if you have any other midi that doesn't work please put them up for me.

can you upload the interested midis? it should still convert midis that contain tempo changes without errors, and i specifically tried it with midis exported from orgmaker and it worked just fine. while tempo changes aren't supported, the program doesn't take the first tempo in the midi, but the first tempo in the midi when notes are played, so on my end i fixed the ridiculously fast tempo issue you described.
Nice special case for the absurd tempo thing!
Here's Last Battle, which is one of ~3 MIDI exports I tried. Last Battle_raw.mid is the export directly from OrgMaker2, while the other file has been re-saved through Anvil Studio (so that it will open in MuseScore3) and MuseScore3 (to remove the tempo change and extra bar).
 

Attachments

Sep 26, 2019 at 10:53 AM
Junior Member
"Fresh from the Bakery"
Join Date: Sep 23, 2019
Location: ????
Posts: 15
#10
I might keep my eye on this, considering it could save me a lot of work down the line.
 
Sep 26, 2019 at 2:03 PM
Perfectionist
CS Beta Content Discord Admin
CSE Discord Moderator
"Man, if only I had an apple..."
Join Date: Dec 26, 2014
Location: the back of their own hand.
Posts: 1494
Age: 119
#11
could save me a lot of work down the line.
Yep.

@Qloqk as the dev you'll probably never be able to appreciate how useful this tool will be to some random person who will save a heap of time and busy-work down the line with it.
 
Sep 26, 2019 at 2:14 PM
Neophyte Member
"Fresh from the Bakery"
Join Date: Jul 18, 2018
Location:
Posts: 8
#12
Yep.

@Qloqk as the dev you'll probably never be able to appreciate how useful this tool will be to some random person who will save a heap of time and busy-work down the line with it.
hey man, i do. that's why i'm eager to know the issues you guys are encountering. i have fixed the bug with your midi, it appears that it's not completely adherent to the midi standard and it made the library i'm using go nuts. now it clips values (in this case it was some notes' velocity, i believe) to the maximum allowed value when they are too high and it should make it compatible with many more midis.
i'll upload the new version when i've fixed the bug with Jade's midi, which turns out is not a bug, it's just some kind of weird midi called rmi or riff midi, for which adding support should be very easy. i'll edit this when i've uploaded
 
Sep 26, 2019 at 2:45 PM
Perfectionist
CS Beta Content Discord Admin
CSE Discord Moderator
"Man, if only I had an apple..."
Join Date: Dec 26, 2014
Location: the back of their own hand.
Posts: 1494
Age: 119
#13
hey man, i do. that's why i'm eager to know the issues you guys are encountering. i have fixed the bug with your midi, it appears that it's not completely adherent to the midi standard and it made the library i'm using go nuts. now it clips values (in this case it was some notes' velocity, i believe) to the maximum allowed value when they are too high and it should make it compatible with many more midis.
i'll upload the new version when i've fixed the bug with Jade's midi, which turns out is not a bug, it's just some kind of weird midi called rmi or riff midi, for which adding support should be very easy. i'll edit this when i've uploaded
When I say never be able to appreciate: I mean this will probably happen at some point in the future and you'll never find out. That sort of thing.
 
Sep 26, 2019 at 2:47 PM
Jade Online
Monster girl enthusiest
"Keep on rollin'!"
Join Date: Sep 22, 2012
Location: Hugging a tentacle monster
Posts: 438
#14
Another nice thing would be the ability to drag and drop the midi onto the exe.

Also if I were you I'd handle time signature changing by fitting all the notes into one measure or by shortening the measure to fit the rest of the measures and just chopping off the notes at the end.

I tried one last midi, this one ofc is one I made in pxtone originally, but I made a midi of it in FL using pxtone box's conversion.

This one works at the very least, hopefully the support update comes soon.
 
Sep 26, 2019 at 2:50 PM
Perfectionist
CS Beta Content Discord Admin
CSE Discord Moderator
"Man, if only I had an apple..."
Join Date: Dec 26, 2014
Location: the back of their own hand.
Posts: 1494
Age: 119
#15
Also if I were you I'd handle time signature changing by fitting all the notes into one measure or by shortening the measure to fit the rest of the measures and just chopping off the notes at the end.
This sounds like a terrible idea???

Another nice thing would be the ability to drag and drop the midi onto the exe.
I'm not sure if that's really feasible for a command-line application.
 
Sep 26, 2019 at 2:55 PM
Sleepyhead
"In Soviet Russia, graves keep YOU!"
Join Date: Jul 20, 2015
Location: Under sea level or something
Posts: 689
Age: 21
#16
I'm not sure if that's really feasible for a command-line application.
Pretty sure Jade means dragging onto the .exe, not the application window.
If it asks for a file at the start then its defenitely doable.
 
Sep 26, 2019 at 3:00 PM
Neophyte Member
"Fresh from the Bakery"
Join Date: Jul 18, 2018
Location:
Posts: 8
#17
Pretty sure Jade means dragging onto the .exe, not the application window.
If it asks for a file at the start then its defenitely doable.
i don't know if you guys tried it, but it works already (though the console closes instantly, i'll fix that in a minute). i just forgot to put it in the op. i'll edit it now.
nvm, that doesn't really work most of the time. fixing that as well.


alright, big update. i'm sure you guys will love this one. there are for sure more midis that will cause issues so keep them coming.
Code:
1.1.0:
- added this file
- program now waits for input before closing
- added support for RMI midi files
- added support for non entirely midi-compliant files
- added partial midi type 0 support (no drums)
- fixed dragging files onto the program
- much better starting tempo detection (not perfect yet)
- output files now have the same name as the input files
- added support for processing multiple files at once
 
Last edited by a moderator:
Sep 26, 2019 at 5:50 PM
Junior Member
"Fresh from the Bakery"
Join Date: Sep 23, 2019
Location: ????
Posts: 15
#18
This is looking mighty promising. Hopefully, I can make use of this someday.
 
Sep 26, 2019 at 7:06 PM
Perfectionist
CS Beta Content Discord Admin
CSE Discord Moderator
"Man, if only I had an apple..."
Join Date: Dec 26, 2014
Location: the back of their own hand.
Posts: 1494
Age: 119
#19
Sep 26, 2019 at 7:10 PM
Neophyte Member
"Fresh from the Bakery"
Join Date: Jul 18, 2018
Location:
Posts: 8
#20
Wait what???
HOW?????
it just means that that if for example a value exceeds the maximum the midi standard allows for it because for some reason the data got corrupted or whatever, it will be replaced with the maximum correct value possible. nothing particularly exceptional. it's what i said before regarding the midi you sent me
 
Top