-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New pat files #5
Conversation
The missing patch files refers to the fact you don't have .pats for every existing instrument, but that was already the case with the old set. I'll check out your branch and check that midi playback works as expected. Thanks! |
The ones that are missing are instruments not present in the soundfont. I could fill in the blanks, in cases where a different piano is used. |
Thing is, it looks like the current instruments are never loaded by any of the .midi files. I think there's a mismatch between how the soundfont and diyedit match the game's samples to midi instruments. How to find out the difference though...I think this can only be done manually. |
I took a look for a little while and I'm not sure why it's trying to load those. What I was originally doing today was copying over instrument pat files that sounded similar, but I stopped. Yours is trying to load instrument 127 for one of the songs, which actually is the instrument for "Gunshot". (yeah, I don't think that's an instrument used in the records). The soundfont generator script in Ruby uses the piano noise as a fallback. What would be the best way to figure this out?
These all are questions that could help. I'd really appreciate your help, because this is bugging me and I want to see the soundfont working. |
Oh, I forgot to mention - the soundfont works fine with the exported MIDIs when I use it with MuseScore or fluidsynth. |
I'm pretty sure the soundfont is complete: DIY's editor only has 32 instruments, not counting the drum sets. Said instruments are a bit weird and don't map to the general MIDI instrument list very well. (For example, DIY's "baby voice" instrument doesn't exist at all in MIDI.) Both the soundfont and DIYEdit try mapping the DIY instruments to general MIDI's list, but the mappings obviously aren't the same. (In hindsight, it was a bit naive of me to think they'd match as-is.) Using the piano as fallback here would probably just use one instrument for everything and ruin every song, so it's not an option. I can try looking in the DIYEdit source code to see how it maps instruments, but as it's decompiled and without comments I can't guarantee success. #ReverseEngineering |
There's actually 48 instruments (6 sets) and 112 rhythm tracks (8 sets). Since MuseScore and fluidsynth read the song OK, so I'm wondering if the MIDI player in JS is trying to load all the wrong instruments? What happens when all the pats are present? Would only the piano play? I'm making a record right now with all the instruments. |
I tried the record with all the instruments, but the MIDI reduced it to 5 instruments because of the 5 tracks, it seems. They all are using the same piano type, even though the 1st track had 4 pianos in it. Just sent it to your Discord if you want to take a look at it. Is it even possible to use the soundfont? Please test what happens if you copy over the missing pats over. Or I could try and send the pats to fill in the missing instruments. I've spent enough time on this and I don't want this to fail, it was fun converting all the pats. |
For safekeeping. |
Got the mappings off DIYEdit quite easily:
A lot of different instruments are getting mapped to 80 at the end here, but that can be fixed. I'll try remaking those arrays to fit the soundfont and see where that gets us. You can look at the midi conversion code itself here as I had to get it out of DIYEdit to tweak it a bit; It is unreadable as expected, though. |
Nice. I didn't know that you could upload files on GitHub like that. This is great, I didn't see this in the code. It's still not clear why it was loading those .pat files, though. |
It wasn't loading them because it didn't need them; midis spat out by DIYEdit only use the instrument codes depicted above. Some of them do match, like piano or timpani, I tried dissecting the soundfont to map the instruments but it's a complete mess; Some instruments are in the drum section or outright missing. I think a proper soundfont should be remade out of the game before going further. |
Also, I recommend using SynthFont and Vienna to look inside the .sf2 file. |
I can use VGMTrans to extract the missing instruments (or extract everything), and convert them to .pat. The decompiled source code is really helpful. We had 59 .pat files, I guess some of them were for the drums and the others were other sounds? |
Yup, the drums are in their own space (header 128), while the instruments are in header 0. If you do extract everything into a new font, tell me how you map the instruments in it so I can modify the source code accordingly. The current DIYEdit mapping maps all the 8-bit instruments ( |
So I'm working on renaming the array with the correct instruments. Almost all of the filenames will be the same (moving stuff like the Yoshi one). It seems some of the instrument names in the soundfont are not quite right... |
OK, it was tedious and took a while to fix the array and rename a few things. Here's the fixed array:
I didn't find the 8-Bit sounds (I need a break), but there's some percussion instruments I moved (I only moved the percussion instruments that were not actually percussion). Want to help me do the 8-Bit and percussion? Here's the instruments that I didn't find used in any of the instruments: arachno-19.pat
arachno-38.pat
arachno-39.pat
arachno-61.pat
arachno-79.pat
arachno-80.pat
arachno-81.pat
arachno-82.pat
arachno-120.pat |
Re-rendered some midis with the new mappings: Loading them with libtimidity.js on the website still fails - I think it's not liking the .pats for some reason. Bleh. I tried loading them with the soundfont itself in SynthFont and it's definitely closer! psychoj-midis.zip I whipped out the NDS for the unknown instruments to try and figure it out:
I noticed your mappings were a bit of a mess past the base instruments, and that the DIYEdit instrument list has a bunch of instruments that aren't in the main game. Unused stuff, perhaps. I've listed my findings in an Excel document here: https://1drv.ms/x/s!AtJBOSoSCRPJgYsOWzL0VuNly8LJoA?e=f3GNbn . |
Hmm, I'm not sure why the .pat files aren't playing. Any errors in the console log? Could you explain the difference between "old map", "new map" and "suggested map"? |
Could you please try these .pat files? Maybe they'll work, I extracted the soundfont with a tool called "unsf". Just replace the .pat files only existing, not the whole folder, not everything's in here. |
Old map is the DIYEdit mapping, new map is yours, suggested map is what I found. |
I'm getting actual DIY samples to play in-browser now, so that's good.
|
|
I'm glad the pats are working now. I committed the replaced pats, as you can see. Are you sure you recompiled the jar? I don't understand why a few of those pats are missing. Like instrument 127 isn't used anymore in the array, so it shouldn't be loading it.' A few of the original pats remain after I copy them over though. (119, 121, 122, 125 and 126). I'm not sure what percussion numbers the drums map to, I didn't touch those, but they shouldn't be missing, just not working. I'm on vacation from this Saturday (tomorrow here) until Tuesday and won't have my laptop with me. Do you want to try using that tool to work with the percussion? It's not hard. |
I don't recompile the .jar currently, I'm just adding override string arrays in MidiServlet. Libtimidity's errors are super vague tbh, I'm also on vacation starting monday for 2w (and voluntarily cutting off my github access save for comments), so I might push a commit with the injected array in a separate branch, and that's about it for the time being. |
Alright, some updates: I fucked up my own instrument list when making that Excel file and most of your mappings were correct, so my deepest apologies about that. I tried to work on percussions a bit but DIYEdit's export array is twice the length of the actual drumsets in the game, so I don't know how it's actually mapping them to midi. It's probably not 1-to-1 like the base instruments. So instead, I switched the JS timidity implementation in DoujinSoft to a much newer one that actually works properly! It's in the diy-soundfont branch for now, alongside your fixed .pat files. I also updated the excel table with what's currently in the branch. I'll still occasionally tune in for comments 'n such during the next two weeks, but won't be able to do any dev work. |
What do we need to do to get this merged into master? The drums shouldn't be hard to do if you give me the numbers associated with the drumConversion array. I took a look at the 8-Bit stuff briefly using the WarioWare DIY Showcase BRSAR file, I could only find the Yoshi Boon-Boon sound. Kind of worried about this, what should we do first? |
The weird thing about drums is that the arrays don't match at all in size:
Still worth trying to map 'em up though. I recommend you use the diy-soundfont branch I made as a base. The 8bit instruments are much more important imo though as they're heavily used in a lot of records. It might be worth looking in the DS game instead of Showcase? |
I didn't find all of the 8-Bit instruments because there's hundreds of samples in the game. Would you want to take a look if I told you how to do it? I'm back in school, I still have some time but I did a good portion of the hard work with the soundfonts, help would be appreciated. |
I'm busy with a ton of other stuff as well sadly; It's fine if this is paused for a while tbh, it's not terribly important. |
I can try to do it then. |
Thanks to andrewk, I got the 8-Bit pat files. They're attached. The mappings:
Now to figure out the drum mappings... Are there any clues in the code to why there's so many drum instruments in the array? |
Alright! I've pushed the new samples to the diy-soundfont branch, will get a build up in a jiffy. The code that handles the drum conversion is here, starting around line 192. It seems to get 4 different drum values for the same block of data and then writes them sequentially? I really don't know much about how this part works. The mapping array for reference:
|
We got the percussion right, there's only 1 drumset that fits. The playback isn't perfect, but it's impressive. Everything's merged into master, so I'm gonna close this. |
Thanks a bunch for all the work you've put into this. |
I managed to convert the soundfont into individual .pat files by instruments. It was quite a bit of work.
Also, the JavaScript console says that there's "missing patch files", referring to the .pat files. I guess they're in the wrong directory? I don't see where in the JS file it loads the .pat files.
I really hope this works.