Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Phanoo

Pages: [1] 2
1
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

2
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.

3
Latest version here : http://sdamo.io/ff7/ff7psxsfx_v0.2.zip

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

4
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

5
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 :/

6
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 ;)

7
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)

8
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.

9
Here is the current version : http://sdamo.io/ff7/ff7psxsfx.zip

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



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.

10
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

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 ?

12
I understand your feelings, it's hard to keep the motivation up after most of the fun work is done. The last % are the hardest, as always !

13
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.



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 !

14
Work in progress  :)



It can already play some sounds, although most of them are garbage since not all commands are understood at this point.

15
It's a shame he didnt gave the access to someone else. It's community work, not only his work, so that's very disrespectful for everyone

16
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..

17
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.

18
Oh wow that sucks :/

19
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.

20
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

21
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

Code: [Select]
A1 00 A5 06 B1 2E A4 08 0C 08 A0... creates this sound : 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.

22
Hello,

Just in case since nobody seems to notice it (really ?), the qhimm wiki gives 403 error, all pages can't be accessed anymore

23
UPDATE : the format is mostly understood at this point, check the work here : 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.

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
Or all the sounds directly extracted here : 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 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).

24
General Discussion / Extraction
« on: 2005-05-03 15:57:42 »
i think psound can rip the sound files, it works for ps1 games but i don't know for the ps2 games

25
General Discussion / I need a ff9 savegame on epsxe plz
« on: 2004-08-09 16:12:25 »
thank you !!!

Pages: [1] 2