Author Topic: FF7 PSX sound effects format  (Read 16185 times)

Phanoo

  • *
  • Posts: 35
  • Musician & Programmer
    • View Profile
    • FM Composer
Re: FF7 PSX sound effects format
« Reply #25 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), 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)
« Last Edit: 2018-04-27 00:18:42 by Phanoo »

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: FF7 PSX sound effects format
« Reply #26 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.
« Last Edit: 2018-04-27 11:18:36 by DLPB »

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: FF7 PSX sound effects format
« Reply #27 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.

Phanoo

  • *
  • Posts: 35
  • Musician & Programmer
    • View Profile
    • FM Composer
Re: FF7 PSX sound effects format
« Reply #28 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 :)

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 ;)
« Last Edit: 2018-04-27 21:28:25 by Phanoo »

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: FF7 PSX sound effects format
« Reply #29 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?
« Last Edit: 2018-04-27 21:57:31 by DLPB »

Phanoo

  • *
  • Posts: 35
  • Musician & Programmer
    • View Profile
    • FM Composer
Re: FF7 PSX sound effects format
« Reply #30 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 :/
« Last Edit: 2018-04-27 22:07:55 by Phanoo »

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: FF7 PSX sound effects format
« Reply #31 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.

Phanoo

  • *
  • Posts: 35
  • Musician & Programmer
    • View Profile
    • FM Composer
Re: FF7 PSX sound effects format
« Reply #32 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
« Last Edit: 2018-04-28 14:34:03 by Phanoo »

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: FF7 PSX sound effects format
« Reply #33 on: 2018-04-28 21:57:07 »
Looking forward to latest release.

Also, certain effects like the alarm in reactor 1 are stereo.
« Last Edit: 2018-04-29 17:37:07 by DLPB »

Phanoo

  • *
  • Posts: 35
  • Musician & Programmer
    • View Profile
    • FM Composer
Re: FF7 PSX sound effects format
« Reply #34 on: 2018-04-30 14:14:06 »
Latest version here : http://sdamo.io/ff7/ff7psxsfx_v0.2.zip

More commands, reverb added for the sounds asking for it, LFO problems fixed  ;)

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: FF7 PSX sound effects format
« Reply #35 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.
« Last Edit: 2018-04-30 18:06:07 by DLPB »

Phanoo

  • *
  • Posts: 35
  • Musician & Programmer
    • View Profile
    • FM Composer
Re: FF7 PSX sound effects format
« Reply #36 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.
« Last Edit: 2018-04-30 20:04:37 by Phanoo »

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: FF7 PSX sound effects format
« Reply #37 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.

Akari

  • *
  • Posts: 766
    • View Profile
Re: FF7 PSX sound effects format
« Reply #38 on: 2018-05-30 11:44:12 »

Phanoo

  • *
  • Posts: 35
  • Musician & Programmer
    • View Profile
    • FM Composer
Re: FF7 PSX sound effects format
« Reply #39 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
« Last Edit: 2018-05-31 14:19:55 by Phanoo »

Akari

  • *
  • Posts: 766
    • View Profile
Re: FF7 PSX sound effects format
« Reply #40 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.

blurayno

  • *
  • Posts: 6
    • View Profile
Re: FF7 PSX sound effects format
« Reply #41 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.



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

« Last Edit: 2018-08-22 11:16:42 by blurayno »

MysticLord

  • *
  • Posts: 79
    • View Profile
Re: FF7 PSX sound effects format
« Reply #42 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

codemann8

  • *
  • Posts: 55
    • View Profile
Re: FF7 PSX sound effects format
« Reply #43 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.

blurayno

  • *
  • Posts: 6
    • View Profile
Re: FF7 PSX sound effects format
« Reply #44 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
This one will expire in 6 months, just to force me to release updates!

Most of the AKAO opcodes 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
 The submarine minigame track!

h52_lb2.akao disasm data; 01_FLUTE,HORN,BELLS.txt
One Winged Angel - Channel 01 data - instruments used: h2E, h22, h32, h22, h32

h52_lb2.akao disasm data; 02_HORN,PF.txt ("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!
« Last Edit: 2019-01-23 21:05:02 by blurayno »