Someone know a sound software to edit PoP sound?

Post Reply
OrSpeeder
Sheikh
Sheikh
Posts: 49
Joined: July 24th, 2005, 8:05 pm
Location: Valinhos

Someone know a sound software to edit PoP sound?

Post by OrSpeeder »

Plainly that: Poirot used a totally really old RIFF header format...

Now I tested already 6 software, all them failing to save natively in the format that PR saves, and all them failing to save natively in PR format after I use "sox" on them...

The results vary, but usually it is just random noise... I tried saving even with "windows recorder" on my XP, and it also saves with the new RIFF PCM header (that has a "FACT tag inside, that PR does not support... and even tough sox remove the FACT tag, the file remain non-working).

So, someone here that ever edited PoP sounds can point me what software on earth can I use?
User avatar
mickey96
Beylerbey
Beylerbey
Posts: 70
Joined: November 29th, 2008, 2:19 pm
Location: Nairobi, Kenya
Contact:

Re: Someone know a sound software to edit PoP sound?

Post by mickey96 »

2 years ago I tried to modify POP sound, and I've discovered something I'd like to share with you. There are some header bytes before the sound (Not to mention the Microsoft WAV header), this is the size of the sound.
Oh and for editing POP sounds, I recommend CoolEdit. If you can't find it, ask me for it (the author wants registration).
Refueled my car! Now I can keep going!
David
The Prince of Persia
The Prince of Persia
Posts: 2877
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Someone know a sound software to edit PoP sound?

Post by David »

mickey96 wrote:There are some header bytes before the sound
Yes, i've already discovered that.
For PoP1 sounds, the header is:

Code: Select all

1 byte: type of sound, 0=pcspeaker, 1=wave, 2=midi
The following appear only if wave:
	2 bytes: sample rate
	2 bytes: number of samples
	2 bytes: always 0
	1 byte: sample size, always 8
And for PoP2:

Code: Select all

1 byte: type of sound, 0=pcspeaker, 1=wave, 2=midi
The following appear only if wave:
	2 bytes: sample rate
	1 byte: sample size, 8 if not compressed, 255 if compressed (NISDIGI.DAT)
	2 bytes: number of samples, or 0 if compressed
	4 bytes: 0 for most sounds
	The following appears only if compressed:
		2 bytes: number of samples after decompression
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5786
Joined: April 9th, 2009, 10:58 pm

Re: Someone know a sound software to edit PoP sound?

Post by Norbert »

David wrote:
mickey96 wrote:There are some header bytes before the sound
Yes, i've already discovered that.
For PoP1 sounds, the header is:

Code: Select all

1 byte: type of sound, 0=pcspeaker, 1=wave, 2=midi
The following appear only if wave:
	2 bytes: sample rate
	2 bytes: number of samples
	2 bytes: always 0
	1 byte: sample size, always 8
David, there's something I'm trying to understand. In a related topic here, I tried converting a custom WAV file to the format used by the original game. Theoretically, this should work:

Code: Select all

sox in.wav -e unsigned-integer -r 11025 -c 1 -b 8 out.wav
However, when I use PR to import the file(s) of the DIGISNDx.DAT file that the WAV is a part of, the game doesn't play the sound effect(s). Does this mean that PR exports the WAV files without adding the header, but when importing the WAV files deletes the header data that's already in the DAT file? Because if it doesn't delete the headers and only writes the WAV content back, I would expect the custom WAV to work.
David
The Prince of Persia
The Prince of Persia
Posts: 2877
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Someone know a sound software to edit PoP sound?

Post by David »

When exporting, PR thinks that in the DAT file, everything after the first byte is part of the sound data, so the header is exported as if it was part of the the sound samples.
When importing, PR still thinks that in the DAT file, everything after the first byte is part of the sound data, so the place of the header is filled with the beginning of the sound samples. If it's a WAV that was exported with PR, then this will write back the header, but otherwise it won't.

Here is the sound in the DAT file: light green=checksum byte, red=sound header, green=samples
sound_dat.PNG
sound_dat.PNG (9.32 KiB) Viewed 5235 times
Here is how PR exports it: orange=part of WAV header, red=sound header (which shouldn't be here!), green=samples
sound_wav.PNG
sound_wav.PNG (10.94 KiB) Viewed 5235 times
Both at exporting and at importing, PR thinks that the "red" is part of the "green".
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5786
Joined: April 9th, 2009, 10:58 pm

Re: Someone know a sound software to edit PoP sound?

Post by Norbert »

Thanks for your comprehensive response, David.
I'll have to study it some time to fully understand it.
jeminacek
Scholar Scribe
Scholar Scribe
Posts: 4
Joined: August 17th, 2013, 5:35 pm

Re: Someone know a sound software to edit PoP sound?

Post by jeminacek »

Hi everyone!

I created a java program which adds the missing sound header to WAV files so they can be added to POP1 DAT file with PR!

You simply have to create your own WAV in your favourite SW, then convert it with SOX:

Code: Select all

sox in.wav -e unsigned-integer -r 11025 -c 1 -b 8 out.wav
And the next step is to use my little tool:

Code: Select all

java -jar PrinceSound.jar out.wav "touching a wall.wav"
That's it!
Attachments
PrinceSound.zip
Contains the JAR file and sources.
(16.89 KiB) Downloaded 224 times
David
The Prince of Persia
The Prince of Persia
Posts: 2877
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Someone know a sound software to edit PoP sound?

Post by David »

Good idea, but it would be better to fix PR.
I have just fixed my copy of PR, and it exports and imports the original sounds correctly, i.e. the red part is not in the wav files.

While at it, some names (in resources.xml) should be replaced with something else, because the current name is either
- meaningless (e.g. 10051: res10051.wav -> door opening in princess's room),
- hard to understand (e.g. 10012: taking a life to the enemy -> sword hits guard),
- or incorrect (e.g. 10007: drinking potion -> gate reached top).
I attached a table that lists some information about all PoP1 sounds, including the name fixes.
Attachments
pop1_sounds.zip
(1.46 KiB) Downloaded 224 times
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5786
Joined: April 9th, 2009, 10:58 pm

Re: Someone know a sound software to edit PoP sound?

Post by Norbert »

Until PR is fixed, this software will be quite useful. :)
I'll definitely add some custom sounds to my next mod.
Post Reply