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

Phanoo

  • Fast newbie
  • *
  • Posts: 35
  • Karma: 9
  • 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

  • No life
  • *
  • Posts: 9064
  • Karma: 273
  • For I realized that God's a young man, too.
    • 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

  • No life
  • *
  • Posts: 9064
  • Karma: 273
  • For I realized that God's a young man, too.
    • 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

  • Fast newbie
  • *
  • Posts: 35
  • Karma: 9
  • 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

  • No life
  • *
  • Posts: 9064
  • Karma: 273
  • For I realized that God's a young man, too.
    • 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

  • Fast newbie
  • *
  • Posts: 35
  • Karma: 9
  • 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

  • No life
  • *
  • Posts: 9064
  • Karma: 273
  • For I realized that God's a young man, too.
    • 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

  • Fast newbie
  • *
  • Posts: 35
  • Karma: 9
  • 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

  • No life
  • *
  • Posts: 9064
  • Karma: 273
  • For I realized that God's a young man, too.
    • 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

  • Fast newbie
  • *
  • Posts: 35
  • Karma: 9
  • 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

  • No life
  • *
  • Posts: 9064
  • Karma: 273
  • For I realized that God's a young man, too.
    • 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

  • Fast newbie
  • *
  • Posts: 35
  • Karma: 9
  • 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

  • No life
  • *
  • Posts: 9064
  • Karma: 273
  • For I realized that God's a young man, too.
    • 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

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

Phanoo

  • Fast newbie
  • *
  • Posts: 35
  • Karma: 9
  • 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

  • Freak
  • *
  • Posts: 761
  • Karma: 26
    • 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.