libertyernie / LoopingAudioConverter

A converter frontend for loopable audio formats
180 stars 17 forks source link

Support for PlayStation PSF files (PSF, PSF2) #100

Open martin-braun opened 3 months ago

martin-braun commented 3 months ago

Please add support for PSF(2) files from the PlayStation (2) era.

Sample games are Final Fantasy 7 to 10.

libertyernie commented 2 months ago

I don't think PSFs contain information that says "loop at this specific point" - I think they're actually PlayStation program code. This would make them similar to GBS files, which I've never been able to support. If you can find a Windows program that takes in a PSF and outputs a WAV along with some indicator of when the loop starts and ends, then I could add it.

martin-braun commented 2 months ago

@libertyernie You are right in a sense that this are small code files, since they tried to feature some stunning music with a lot of creativity as well as nuanced loop-cues on a limited system.

Header specification: https://gist.github.com/SaxxonPike/a0b47f8579aad703b842001b24d40c00

Thus, it's not like a MIDI, but rather a specialized encoding that had almost no tooling as the composers programmed machine code to build PSF files, and unlike the *.psf, the *.minipfs require additional *.psflib files, such as in the case of FF7 and FF8. Those need to have the right name and sit in the same directory in order for the playback to work. These are definitely rather mini programs. Programs or not though, they contain loop instructions that make it possible to playback those files other than on the system itself.

In fact, foobar2000 is able to play PSF files using a PSF decoder plugin that can be downloaded here: https://www.foobar2000.org/components/view/foo_psf

It plays those files back with proper loop, but when exporting the files to wav in the program itself it would not allow me to setup any loop count or desired length, making the export useless. It cuts off right at the loop cue, so that I couldn't even import the exported WAV into Audacity to just stich things further together. It doesn't go a second over to make the transition in Audacity smooth enough.

Would the Decoder linked above help you?

libertyernie commented 1 month ago

I would need a way to determine where the loop starts, and I'm still not sure the PSF format can do that.