Ancurio / mkxp

Free Software implementation of the Ruby Game Scripting System (RGSS)
GNU General Public License v2.0
512 stars 130 forks source link

Proper method to convert .mid audio? #33

Closed hanetzer closed 10 years ago

hanetzer commented 10 years ago

I had previously converted the midi audio for RMXP to ogg for the sake of my PlayOnLinux wrapper script, but it seems mkxp doesn't like the way I did it. I don't suppose you have any suggestions?

Ancurio commented 10 years ago

Hard to give any suggestions when you're not telling me how or what exactly you did =P

In general, doing what the Readme says should always work, ie. placing the converted ogg with exactly the same name as the midis (sans extension) in the path where the game expected the midis.

hanetzer commented 10 years ago

Well, the first time I did the conversion was probably a year or two ago, so I have not a clue exactly what I did, some timidity stuff. This go around I did like so: timidity source.mid -Ow -o dest.wav oggenc dest.wav (Note: I used a for loop in bash to do it all, lol. No way in hell I'm doing that amount manually) then I deleted the midi and intermediary wav files, still no joy. I get an SDL error, unsupported format. If it makes a difference I'm on arch linux and as such my libs may be newer and expect different things than is expected.

Ancurio commented 10 years ago

Did you compile mkxp yourself? If yes, did you make sure SDL_sound was compiled with ogg support?

hanetzer commented 10 years ago

Yep, I compiled mkxp myself. I'll have to recompile SDL_sound; I was hoping to avoid that, but since creating the pkg-config file, while allowing it to compile properly with qmake I guess that patch does a bit more than I expected.

Ancurio commented 10 years ago

The patch itself doesn't do much besides pkg-config support and making sure the sound headers are installed to SDL2/ instead of SDL/. What's important is that you compile it with --enable-ogg.

hanetzer commented 10 years ago

pkg-config is great aint it? Alrighty, next time I get access to my arch box I'll give it another shot. And for the record, this is sdl, not sdl2, sound correct?

cremno commented 10 years ago

If you want to do it the easy way, just install this AUR package: https://aur.archlinux.org/packages/sdl_sound-patched-hg/

It works for me.

hanetzer commented 10 years ago

excellent, PKGBUILD's make stuff so damned easy :D Far easier to write a PKGBUILD than to make a debian package. hmm. --enable-ogg should end up in the ./configure step, yes?

hanetzer commented 10 years ago

On another note, I've done midi work in a project I was working on, basically the same idea as mkxp, mayhaps I'll fiddle with this and get you a nice pr for midi ;) Also, I notice you compile a font right into the executable; perhaps one should do the same with an agreed upon default/fallback soundfont

Ancurio commented 10 years ago

hmm. --enable-ogg should end up in the ./configure step, yes?

Yes, the flag is for the configure step, but looking at the dependency list, it should already be compiled in in the arch package.

On another note, I've done midi work in a project I was working on, basically the same idea as mkxp, mayhaps I'll fiddle with this and get you a nice pr for midi ;)

Cool! You might want to check out #6 for reference. I'm always open for discussion.

Also, I notice you compile a font right into the executable; perhaps one should do the same with an agreed upon default/fallback soundfont

Hm. All soundfonts I have come across so far were in the 20-50 MB range, which would blow up the executable immensely for a feature that might not even be wanted.

hanetzer commented 10 years ago

oh ouch... mayhaps some form of external shared library instead then. Also, I'm curious as to how you actually embedded the font into the executable; I've seen xpm images used (most notably in the xscreensaver's xmatrix binary for the glyphs) but this is the first time I've seen a ttf font embedded.

Ancurio commented 10 years ago

I mean, if we could find a sfont on the scale of 1-2MB, it would certainly make sense to bundle it with mkxp (if license allows, of course). But this is a small problem compared to midi decoding support itself =)

Also, I'm curious as to how you actually embedded the font into the executable

xxd -i will spit out an unsigned char[]'ed version as a C header for any file you give it, giving you a compile time equivalent of allocating a buffer and reading the entire file into it.

hanetzer commented 10 years ago

Interesting indeed. I'll see what I can do regarding getting midi to work; the rubyland command line options should have a soundfont config file added in, and if none is assume a fallback.

hanetzer commented 10 years ago

Note: with patched SDL_sound with --enable-ogg the files I had previously converted to ogg worked. Working on a SDK type thing for doing mkxp on windows, wish me luck.