Qhimm.com Forums

Miscellaneous Forums => Scripting and Reverse Engineering => Topic started by: Phanoo on 2018-04-16 03:20:36

Title: FF7 PSX sound effects format
Post by: Phanoo on 2018-04-16 03:20:36
UPDATE : the format is mostly understood at this point, check the work here : http://sdamo.io/ff7/index.php (http://sdamo.io/ff7/index.php)


Hello

This always puzzled me, the PC version using hundred of megabytes worth of wave files for sound effects, while the PSX version only used a tiny 50Kb file (EFFECT.ALL).
After some searches, there seems to be nobody interested into reverse engineering this, please correct me if I'm wrong ?

I just did an attempt this evening, to get a better understaning of this format. I'm interested in sound synthesis, in fact I'm the developer of a music software called FM Composer (http://fmcomposer.org).

So, here's my findings.


The data from byte 4 to 2829 is an offset table for each individual sounds. Each entry is 2-byte long. Some entries are "0xFFFF", I don't know why, let's say we ignore them. After byte #2829 there is an empty block made of 0xFF bytes then the actual sound data. Following this table I can extract 936 sounds from the file.
You can extract them with this little code I made, you need to put EFFECT.ALL in the same dir and create an 'out' folder. Compiled version here : http://sdamo.io/ff7sfx.zip (http://sdamo.io/ff7sfx.zip)
Or all the sounds directly extracted here : http://sdamo.io/ff7/out.zip (http://sdamo.io/ff7/out.zip)
Code: [Select]
int main()
{
FILE *fp=fopen("EFFECT.ALL", "rb");
fseek(fp,8,SEEK_SET);
vector<int> offsets;

offsets.push_back(0);
unsigned short temp;

printf("Analyzing...\n");

int endcount=0;
do
{
fread((char*)&temp,2,1,fp);

if (temp == 0xFFFF) {
endcount++;
continue;
}
else
endcount=0;

offsets.push_back(temp);

}while (endcount<3);

printf("%d sounds found.\n",offsets.size());
printf("Extracting...\n");

fseek(fp,4096,SEEK_SET);

char *sound_data;

for (unsigned i = 0; i < offsets.size()-1; i++)
{

int size=offsets[i+1]-offsets[i];
if (size<=0)
continue;


sound_data = (char*)malloc(size);

fread(sound_data,size,1,fp);

FILE *fp2=fopen(string("out/"+to_string(i)).c_str(), "wb");
fwrite(sound_data, size, 1,fp2);
fclose(fp2);
free(sound_data);

}

fclose(fp);
printf("Done.\n");
}


All sounds seems to finish with an '0xA0' byte.

Okay it's nice but the hardest part is to figure how the format works. I've messed with the first sound of the file (which is the menu beep sound), by modifying random bytes directly in the ISO image, then restarting the game with an emulator, and yeah I've got more or less interesting results !

Check this : http://sdamo.io/ff7/sounds.zip (http://sdamo.io/ff7/sounds.zip) It's the altered beep sounds, depending on which bytes i modified (naming : chk-[bytes modified])

Some results are really interesting, with some delays, pitch or noises...

Anyone interested in helping me to find how those parameters works ? (basically, which bytes/values affects which sound parameter).
Title: Re: FF7 PSX sound effects format
Post by: DLPB_ on 2018-04-16 16:18:02
I am very interested in this....  Been waiting for someone to tackle it, as I am sadly at a loss.  No idea where to start with it.  But kudos for you delving in.

It's amazing that after all these years the effects data file in psx version is so poorly understood.

Title: Re: FF7 PSX sound effects format
Post by: Phanoo on 2018-04-16 17:12:01
Yes, i'm really surprised nobody wrote some tools to deal with them.

Some more investigation with the menu beep sound, here's its contents :
Code: [Select]
A1 01 A5 05 A4 05 0F B1 2C 81 A0 A1 00 A5 06 B1 2E A4 08 0C 08 A0
As I said, A0 is the end marker for each sound, but this one has an A0 right in the middle. It means the final sound is made of two sounds layered (played at the same time) :
EDIT : I was wrong, there is no layering thing in the sounds itself. The menu beep is just two independent sounds, that are triggered at the same time.

Code: [Select]
A1 01 A5 05 A4 05 0F B1 2C 81 A0... creates this sound : http://sdamo.io/ff7/beep_1st.wav (http://sdamo.io/ff7/beep_1st.wav)

Code: [Select]
A1 00 A5 06 B1 2E A4 08 0C 08 A0... creates this sound : http://sdamo.io/ff7/beep_2nd.wav (http://sdamo.io/ff7/beep_2nd.wav)

About this A0 byte, it seems to follow the opcodes discovered here for the AKAO frames : http://archive.is/0PE01

The page lists other opcodes, which may help :
Code: [Select]
0xA0 (Finish Channel)
0xA1 (Load Instrument)
0xA3 (Volume Modifier)
0xA5 (Pitch Divider)
0xA8 (Channel Volume)
0xAA (Channel Pan)
0xC8 (Loop Point)
0xCA (Return to Loop Point)
0xE8 (Tempo)
0xEA (Reverb Depth)
0xC2 (Turn On Reverb)

Maybe the SFX engine and music engine share the same code, the SFX simply having more advanced opcodes for doing complex time-based things and modulations.
Title: Re: FF7 PSX sound effects format
Post by: DLPB_ on 2018-04-16 17:19:51
the problem ishow do you faithfully recreate the sounds from that alone. the psx sound chip needs emulating too?
Title: Re: FF7 PSX sound effects format
Post by: Phanoo on 2018-04-16 17:29:39
ATM i'm directly replacing the hex contents in my FF7 iso image, then run the game from an emulator (ePSXe) so I can hear how my changes affects the sound.

If we manage to guess the whole format, I dunno how hard it would be to create some rough emulation so a software could play the sounds. In fact i didnt thought about emulation, more like a little sound engine written from scratch (not sounding perfect but just to give an idea), with an editor allowing to have fun with parameters and a save feature. I know nothing about emulators, but i'm not bad at dealing with MIDI, sound synthesis and such things
Title: Re: FF7 PSX sound effects format
Post by: Phanoo on 2018-04-16 21:19:17
Mappings for the A1 xx command which is the waveform select  :)

Some of them points to INSTR.ALL samples while some others appears to be synthsized, or stored elsewhere. I've recorded those 'custom' waveforms as wave files. Samples from INSTRL.ALL can be extracted with PSound !

Code: [Select]
A1 00 => sine
A1 01 => bright_sine
A1 02 => pulse02.wav
A1 03 => pulse02-3.wav
A1 04 => INSTR.ALL_0000
A1 05 => INSTR.ALL_0001
A1 06 => INSTR.ALL_0002
A1 07 => INSTR.ALL_0003
A1 08 => pulse5.wav
A1 09 => INSTR.ALL_0004
A1 0A => INSTR.ALL_0005
A1 0B => same as 02
A1 0C => pulse3
A1 0D => pulse4
A1 0E => INSTR.ALL_0006
A1 0F => INSTR.ALL_0007
A1 10 => INSTR.ALL_0008
A1 11 => INSTR.ALL_0009
A1 12 => INSTR.ALL_0010
A1 13 => smooth_square.wav
A1 14 => smooth_saw.wav
A1 15 => smooth_triangle.wav
A1 16 => smooth_pulse.wav
A1 17 => INSTR.ALL_0011
A1 18 => INSTR.ALL_0012
A1 19 => INSTR.ALL_0013

Values greater than 19 doesn't seems to exist in the file, although i didnt checked them all.
Title: Re: FF7 PSX sound effects format
Post by: DLPB_ on 2018-04-16 21:37:15
This is impressive work :)   I can't remember if PSX was able to synth sounds...  I bet it could do simple sine etc
Title: Re: FF7 PSX sound effects format
Post by: Phanoo on 2018-04-18 19:02:23
Ok the format is complex, it's a bit inspired from MIDI since I discovered there are Running Status commands. That means, if you choose the command 0xB1 for example, you can put after as much parameters as you want until you put another command byte.

Eg : B1 52 34 65 02 31.... will play some notes with the select waveform.

It's a nice thing to save space.

The VERY annoying thing is that several parameters are merged into ONE byte. A single byte after the B1 command is enough to set the pitch, the duration and the release rate. It makes the thing quite annoying to reverse engineer  ;D

For the octave selection (A5 command), it has some annoying things too. When you reach a high pitch the next value isn't making it higher again, instead it starts from a lower note, and the next values produce other various pitches. I think maybe the note frequency is bit-shifted or something, making strange results at some point.

I may not success at writing a program that replays and allow to edit the sounds from the PSX game. But i'll release a document with my findings anyway.

The guy who developed this system can be proud of him, it's very clever work. I wonder how was the editor that Square used to design all the sounds.
Title: Re: FF7 PSX sound effects format
Post by: DLPB_ on 2018-04-18 22:16:14
That's the million dollar question....  how did they create these sounds.  I mean... is it possible they had something that could convert a real sound of a fire into code? Akao created this sound system and he clearly intended to make it as small as possible because his experience was with small cartridges and not CD.  In early ff7 days it was going to be on N64.

It makes sense now that he's used every bit.
Title: Re: FF7 PSX sound effects format
Post by: Phanoo on 2018-04-18 23:40:26
Yes it clearly seems designed for a low memory system, such optimization makes no sense for a CD-Rom game. I guess they re-used some code they made for the SNES.

I don't think they had a tool converting real sounds into synthesized ones, it's a very, very complicated task. The pitch variations are often complex in the sounds, maybe they had a way to draw the lines that get converted into the appropriate commands..
Title: Re: FF7 PSX sound effects format
Post by: luksy on 2018-04-19 19:42:10
The SNES SPU was manufactured by Sony, in fact the PS1 and SNES SPUs are quite similar so I'm guessing Akao just ported a lot of his existing code straight over.
Title: Re: FF7 PSX sound effects format
Post by: Phanoo on 2018-04-21 13:24:53
Work in progress  :)

(http://sdamo.io/ff7/ff7sfx.png)

It can already play some sounds, although most of them are garbage since not all commands are understood at this point.
Title: Re: FF7 PSX sound effects format
Post by: Phanoo on 2018-04-22 13:37:31
I was wondering why most of the noise-based sounds in my engine didn't sounded like the original ones, it's because FF7 sound engine is able to use the noise generator from the sound chip, instead of simply using the sampled noise-like waveform in INSTR.ALL. The one from the sound chip has a very low-fi sound to it, because it's 4-bit resolution (=16 steps) and the frequency only changes the rate at which the new random value is generated. Fortunately it's easy to emulate, using the standard C rand() function creates identical sounds !

I've also added the support for LFO (low frequency oscillator), it's triggered with the B4 command, and is quite complex because it uses several patterns.. They are all 32-steps lengths, i've implemented the first seven of them. Magic sounds makes heavy use of them !

The first version of the sfx player will be soon available... it's not accurate but already quite fun.

There are still commands I don't understand at all. All the Cx commands. They seems to be related to some looping or re-triggering of other commands. Weird.

(http://sdamo.io/ff7/ff7sfx2.png)

Green highlighted parts are the understood commands :) (more or less accurately since the engine is written from scratch from my guessings, it's not an emulation)


EDIT : found what C8 and C9 means :)  C9 jumps to C8 like a loop point. The number of time it repeats depends on the parameter just after C9 !
Title: Re: FF7 PSX sound effects format
Post by: luksy on 2018-04-22 19:30:21
This is some cool stuff, looking forward to seeing (& hearing) the player!
Title: Re: FF7 PSX sound effects format
Post by: Phanoo on 2018-04-25 11:51:04
Thanks, i'll release the first prototype soon !

Please guys give me some motivation to keep working on this :) It has been very fun to guess most of the format but now it's taking a lot of time to get it right (especially, reverse engineering all the LFO patterns, frequency ramps and such is exhausting). Would you be interested in a program allowing to modify the sounds and re-exporting the EFFECT.ALL file ?
Title: Re: FF7 PSX sound effects format
Post by: Kaldarasha on 2018-04-25 12:22:09
It would be interesting to see, if we can implement your tool into the game to play the sound. It is also interesting for FF9. And I'm pretty sure FF8 has also problems with playing the correct sound effects even though nobody has complained about it yet.
Title: Re: FF7 PSX sound effects format
Post by: Phanoo on 2018-04-25 12:32:53
I could look at FF8/FF9 sound data to see if the format is compatible, but the files are packed into a single .IMG file. Is there a way to extract the separate files, modify them, and rebuild the whole thing ?
At least I'd need an offset to look at, because SFX data doesn't have any magic string that helps identifying it
Title: Re: FF7 PSX sound effects format
Post by: DLPB_ on 2018-04-25 16:46:30
I'm really looking forward to seeing even a semi working program that can decipher the audio
Title: Re: FF7 PSX sound effects format
Post by: luksy on 2018-04-25 20:08:11
Thanks, i'll release the first prototype soon !

Please guys give me some motivation to keep working on this :) It has been very fun to guess most of the format but now it's taking a lot of time to get it right (especially, reverse engineering all the LFO patterns, frequency ramps and such is exhausting). Would you be interested in a program allowing to modify the sounds and re-exporting the EFFECT.ALL file ?

Being able to export the pure, unadulterated ps1 effects would be great, I'm not sure if you're aware but the PCM sfx used in the PC version are often terrible. DLPB has been working on replacing them but I can't remember how far he got.
Title: Re: FF7 PSX sound effects format
Post by: DLPB_ on 2018-04-25 20:28:43
I've recorded all of them from Mednafen... and looped any that need looping.  The audio replacement mod is done.  But Aali's driver code - and not having direct mode set up with my new mod method - is holding Reunion up.

I want to make The Reunion integrated properly  with direct file mode.  Since Aali has done the leg work... it should be fairly simple for me to change his code.  I'm going to have a go.
Title: Re: FF7 PSX sound effects format
Post by: Phanoo on 2018-04-26 01:31:17
Here is the current version : http://sdamo.io/ff7/ff7psxsfx.zip (http://sdamo.io/ff7/ff7psxsfx.zip)

There is still a lot of inaccuracies in the playback, don't mind  :D

(http://sdamo.io/ff7/ff7psxsfx.png)

You get a list of the commands being played, and the nice thing is I managed to read the samples directly from INSTR.ALL and INSTR.DAT. I've found that even the simpliest waveforms are sampled. PSound didn't extracted them when I scanned INSTR.ALL, that's why I initially thought those waveform were generated. Probably they were too short to trigger its detection system.
Title: Re: FF7 PSX sound effects format
Post by: Kaldarasha on 2018-04-26 04:11:44
C2 could be the pan or the marker if it is a stereo or mono effect. At last I can't see in the list that this is handled somewhere.
Title: Re: FF7 PSX sound effects format
Post by: Phanoo on 2018-04-26 08:54:27
From what I understood, all sounds are mono, but the engine can play two of them at the same time, achieving a stereo effect. The sound themselves don't seem to know about their panning

Some currently unknown commands :
C2, C6, B6, BA, D0, D1, DA, DC, DD, DF
Most of them seems to have no parameters, I even tried to remove C2 from some sounds and it didn't make any hearable difference  :?

If you want to try things with the sounds you can edit the FF7 disc1 iso, set the bytes from 0x1066c8 to 0x1066d2 to 0xA0, and write the sound data you want at 0x1066d3 (no size limit). It will play your sound when you move the cursor on the title screen. To do fast edits/tests, make a savestate before the Squaresoft logo shows up (it loads the sound data here), and toggle FPS limit with F4 (on ePSXe) to go faster.
Title: Re: FF7 PSX sound effects format
Post by: DLPB_ on 2018-04-26 12:20:56
i have a good audio setup. if u want to run by me 2 versions with different codes i can tell you if i hear a difference
Title: Re: FF7 PSX sound effects format
Post by: DLPB_ on 2018-04-26 22:25:52
This is seriously impressive....  you can make out exactly what sounds they are.  It's taken over 20 years for someone to tackle it.

Kudos!

Should be noted that some effects should loop indefinitely and perhaps thats what one of the missing opcodes does?
Title: Re: FF7 PSX sound effects format
Post by: Phanoo on 2018-04-27 00:08:17
Thx ! Yeah it puzzled me no one already did that. It's not that hard btw, having some previous MIDI / sound synthesis knowledge helps a lot.

If you want to play more with my program please re-download it (same url : http://sdamo.io/ff7/ff7psxsfx.zip (http://sdamo.io/ff7/ff7psxsfx.zip)), I noticed I forgot to initialize a variable for the noise generator, creating very loud static sound instead of the actual noise... I hope no ears has been damaged, that should be fixed now  ;)

You're right about the looping sound effects, there may be a command for that ! Do you know which sounds are looping so I can check them ? I was thinking about the alarm or elevator sound, but have no idea what are their ID (0...760)
Title: Re: FF7 PSX sound effects format
Post by: DLPB_ on 2018-04-27 09:40:00
I tried to locate - but I couldn't work out if the IDs are in order.  The first ones appear to be.  If in order, I will get you a list tonight.

The looping section doesnt have to be from start...  often I see what seems to be a flange effect that decays and then a looping section that can last up to a few seconds.  Loops can last much longer.

Also, you should be aware that there is a random effect operation too.  For example, birds will cheep looped, but never in a fixed pattern. It may be that it can play more channels at same time?  Though I find that unlikely.
Title: Re: FF7 PSX sound effects format
Post by: DLPB_ on 2018-04-27 17:36:10
Bug:  See effect 617.  If you play more than once, the pitch isnt being reset.  Other things may not be being reset to default on new start.
Title: Re: FF7 PSX sound effects format
Post by: Phanoo on 2018-04-27 21:23:53
Ok i'll look at that ;)

I've found that the infinite loop command is CA. Sounds that use infinite looping finish with CA instead of A0, so I didnt detected them since I checked for the A0 termination before adding them to the list ! Sound count is now 888, don't try with your version to match the numbers with FF7PC you'll get an offset due to that...

https://www.youtube.com/watch?v=p6BrxvR-x54 (https://www.youtube.com/watch?v=p6BrxvR-x54) :)

I've also added the support for few commands :


- B5 : frequency LFO depth set
- B6 : stop frequency LFO
- BA : stop volume LFO
- DC : set the duration for all upcoming notes
- DD : frequency LFO depth fade

I'll release the updated version in the next days ;)
Title: Re: FF7 PSX sound effects format
Post by: DLPB_ on 2018-04-27 21:41:51
Impressive! 

Do you think the sound will ever get v. close to the actual PSX sound?

The thing to remember also is PSX adds its own variety of reverb - but I've noticed that only on certain effects.  I don't remember cursor sfx having it - but many effects do.  You can always tell because a no reverb effect always shows a hard stop in wave form... and a reverb doesnt.

So one of the ops will be reverb maybe?
Title: Re: FF7 PSX sound effects format
Post by: Phanoo on 2018-04-27 22:04:26
I could add it yeah. Taking an existing PSX reverb code if a open source one is available, or taking the reverb I already made for my music software.

As for the sounds itself, I'm not sure they will get close to the originals. Some already are, but some others are really hard to get right, especially when they make extensive use of LFO's :/
Title: Re: FF7 PSX sound effects format
Post by: DLPB_ on 2018-04-27 23:22:12
Very likely C2 is reverb.

I know that cursor and error don't have it, but cancel and menu do (before looking at code).  And so far that is indeed how it looks in your program.
Title: Re: FF7 PSX sound effects format
Post by: Phanoo on 2018-04-28 11:34:04
You seem right ! Although it doesn't work on the title screen which has no music (maybe the reverb gets disabled ?). I tested on the train scene and using C2 makes the sound reverbered like the music, while C3 stops making it reverbered
Title: Re: FF7 PSX sound effects format
Post by: DLPB_ on 2018-04-28 21:57:07
Looking forward to latest release.

Also, certain effects like the alarm in reactor 1 are stereo.
Title: Re: FF7 PSX sound effects format
Post by: Phanoo on 2018-04-30 14:14:06
Latest version here : http://sdamo.io/ff7/ff7psxsfx_v0.2.zip (http://sdamo.io/ff7/ff7psxsfx_v0.2.zip)

More commands, reverb added for the sounds asking for it, LFO problems fixed  ;)
Title: Re: FF7 PSX sound effects format
Post by: DLPB_ on 2018-04-30 17:48:39
Considering effect 120 is this (I assume) https://drive.google.com/file/d/1XHBMkZN2JLVl_OHpNDJptD3oeVNwL0oB/view?usp=sharing

Perhaps C6 changes pitch somehow?


Effect 144 is missing final note:

https://drive.google.com/file/d/1gYQSgYIXII31xT-5fvIRhYqvdxLYdxzq/view?usp=sharing

Also, since 117 seems to be alarm sound..  pitch slide might be pan slide?  Alarm has stereo difference.

Another note:  There are only 1-731 effects in the game.
Title: Re: FF7 PSX sound effects format
Post by: Phanoo on 2018-04-30 19:46:03
I guess the number 731 come from the pc version, maybe it's due to the fact that some of the layered sounds of the psx version (like the 1st and 2nd sound both makes the menu sound ) are already mixed into a single sound for the PC ?

Also the total sound count increased in the last version because I numbered the empty sounds effect.all has. The only purpose is to keep track of them so the application can re-write a correct effect.all file (I guess the file won't work anymore if I save it without those 'dummy' sounds)

BTW, thank you very much for your involvement, it helps a lot and gives me more motivation to finish this project !

I wrote a document describing how the format works, the list of command and everything else here : http://sdamo.io/ff7/index.php
It's not 100% up to date and subject to change.
Title: Re: FF7 PSX sound effects format
Post by: DLPB_ on 2018-04-30 20:32:07
Even in the PSX version, the sound test is the same.  So if it's mixing, each ID is still its own ID 0 but mixed from 2 sources?

This is super impressive stuff.
Title: Re: FF7 PSX sound effects format
Post by: Akari on 2018-05-30 11:44:12
Hope this helps you:
https://github.com/Akari1982/q-gears_reverse/tree/master/ffvii/documents/akao
https://github.com/Akari1982/q-gears/tree/master/utilities/ffvii_sound_dumper/src

And this folder have files with "sound_" at start. This is psx sound system reverse. Not completed but may help a little.
https://github.com/Akari1982/q-gears_reverse/tree/master/ffvii/DISC
Title: Re: FF7 PSX sound effects format
Post by: Phanoo on 2018-05-31 14:09:41
Hey thanks !

We could merge our opcodes lists, from what i see in your code you have some unidentified ones that I've already understood, and you have some others that I weren't aware of.

http://sdamo.io/ff7/
https://github.com/Akari1982/q-gears/blob/master/utilities/ffvii_sound_dumper/src/AkaoParser.cpp

I'm especially interested by the LFO table, which is too much work to reverse engineer by ear. Can you confirm it's your "akao_wave_table" array ?

I currently have a totally custom engine that playbacks the sound, but for accuracy it would be better to use some real PSX emulation so I can focus on the sound parsing a bit like you did. I'm pretty sure you could play the sounds with your engine with minor tweaks (implementing the commands that are used in SFXs like the noise generator), since the format is close to the one used for the songs. The note handling is probably different too, since for the SFXs the pitch and duration are merged into the same byte
Title: Re: FF7 PSX sound effects format
Post by: Akari on 2018-06-14 07:58:21
I just finished reverse almost all the opcodes. I write them down later. You can see them here (https://github.com/Akari1982/q-gears_reverse/blob/master/ffvii/DISC/SCUS_941_akao.cpp). This is all code that handles sound sequenses in FFVII. SPU and DMA library are separate and comes from PSYQ. You can search opcodes by names like "AKAO_opcode_f2"
 
Opcodes in sounds and in music are the same and do same things. Difference is that music uses a lot of channels with separate sequence for each channel. I think you can adapt your player to play music.

Quote
I'm especially interested by the LFO table, which is too much work to reverse engineer by ear. Can you confirm it's your "akao_wave_table" array ?

Yes. This is LFO table. You can use values from c++ files. They taken from binaries and used in PSX version.

If you have question about specific opcode feel free to ask. I look at them more closely and reverse it deeper.
Title: Re: FF7 PSX sound effects format
Post by: blurayno on 2018-08-07 21:14:44
Hello everyone.
I see you guys have already reversed almost everything regarding the FF7 music engine, good job and thank you  :)

I've had a similar project about figuring out the opcodes and studying how to actually insert music into the PS version of the game, so maybe I should contribute to your project too.
My documentation is very compact and incomplete in some parts so I still need to tidy it up before posting, but here's the table for the note values.

I'm sorry about the way I chose to present it, but if you're okay with sheet music it should be quite fast to use.

(https://preview.ibb.co/hKEgTz/FF7_PS_Note_chart_small.gif) (https://ibb.co/erugTz)

Here's also a plain text "disassembly" from the first track of the boss battle music. The link will expire in february and hopefully gets obsolete before that.
I don't have the know-how to create converting software. Deciding the output format still has to be standardized too. Plaintext could be the best choice because of the specific capabilities of the engine, I think.

h0B_chu akao disasm data; 01_ORGAN1,STRINGS2.txt (https://pastebin.com/3J7DX5SB)

Title: Re: FF7 PSX sound effects format
Post by: MysticLord on 2018-08-29 20:03:58
Guy at FFH looks like he needs info on midi synthesizers. He's making a mod bootloader for the PSP version.  Looks like it will be technically excellent; this is the best right way to do things.

http://ffhacktics.com/smf/index.php?&topic=12035
Title: Re: FF7 PSX sound effects format
Post by: codemann8 on 2019-01-20 06:47:52
I took a backup of the text file from 2 posts ago, since he said the link will expire this month.  Just hit me up if you want it.  This is great work happening in this thread, I'd hate to see progress fall short due to an expired link.
Title: Re: FF7 PSX sound effects format
Post by: blurayno on 2019-01-22 02:14:20
Hello again! It's great to see other people too who are still interested.
Haven't updated for a while since others working on this seem to be pretty inactive lately.

I don't even know how many opcodes (Akari, I think I need your help..) and other tidbits I'm still missing out but here are my notes anyway.

INSTR.DAT and INSTR.ALL information (https://pastebin.com/b9qdvdac)
This one will expire in 6 months, just to force me to release updates!

 Most of the AKAO opcodes (https://pastebin.com/PmEi5AHm) Partially translated from a Japanese source which had a lot of incorrect information. Lots of question marks here.
Expires in just one month.


These following all expire in 6 months just to make sure, though they're all probably 99% complete and in the final format already.

SENSUI.SND (h59_sensui.akao) disasm data (https://pastebin.com/L2V6SuqU)
 The submarine minigame track!

h52_lb2.akao disasm data; 01_FLUTE,HORN,BELLS.txt (https://pastebin.com/icjra2Zp)
One Winged Angel - Channel 01 data - instruments used: h2E, h22, h32, h22, h32

h52_lb2.akao disasm data; 02_HORN,PF.txt (https://pastebin.com/QGXNJ0g2) ("PF" being the name used for instrument "Low Piano" in PC version MIDI files)
One Winged Angel - Channel 02 data - instruments used: h22, h28, h22, h28


I've also extracted and uncompressed all 99 samples (instruments and voices) from the final release and 78 samples from the beta release, along with the loop points. I'll share a spreadsheet file later along the uncompressed samples.
ADSR data is also there but currently I have no idea how to use it easily. For example "Sine Wave 1" instrument uses an attack rate of h06 but in practice the attack rate even has key tracking, meaning the lower notes use natural envelope of the sample and higher notes use increasingly softer attack rate.

It's funny how there are a few instruments which most probably had been intended to use bi-directional looping, but it doesn't seem to be working and instead they loop normally, sounding weird :D
I'll post more about this when I'm able to demonstrate it in effect with some sound effects.


Also the biggest obstacle when recreating the instruments using other synthesizers and workstations seems to be that how to create a filter and envelope that reproduces the same sound out of the same raw sample that PSX does. FF7 sound engine is also able to create envelopes with quite fast modulation (refresh rate) which might be troublesome to imitate. Easier approach could be multisampling the instruments out of an SPDIF modified console OR to create a software synth which uses the original sound engine or something like that. Maybe a VST plugin, anyone?


And something funny from the technical point of view, track number h42 named "wind" consists of all sixteen channels, all playing the "White noise" instrument h05 ;D 8-)
Looking forward notating that one out!