pcm encoder

List your programs here (game-related or other software).

Moderators: scallenger, Rebel, madppiper, TresCom Support Team

User avatar
Rebel
-=TresCom Developer=-
-=TresCom Developer=-
Posts: 6112
Joined: Sun Nov 10, 2002 10:26 pm
Location: That country nobody likes (you know the one)
Contact:

pcm encoder

Post by Rebel »

Mainly, this is a test utility and it can only encode mono (single channel), 16bit 22050 pcm waves. As said, it's a test to create a trespasser compatible ima/dvi adpcm wav, import it and have it play all the way through in-game. I tested a few of the longer voice overs and 1 music clip that I converted to single channel (22050 sample rate) using cool-edit. They all played satisfactory but the encoding isn't 100% accurate as of yet.

For more info, see the read_me file. Also, beyond trying to figure out how to utilize this class and writing out the wav file, I take no credit for this. That belongs to a J.D. Medhurst (aka tixy) who wrote and made the class available. You can visit his website here.

See temp_page (on sig) for download
User avatar
RexHunter99
Albertosaurus
Albertosaurus
Posts: 2197
Joined: Mon Apr 24, 2006 12:12 pm
Location: Australia
Contact:

Re: pcm encoder

Post by RexHunter99 »

When this is perfected we could use it as a default import option for Audio :D unless we need quality over storage ;)
~ They told me humans weren't real... I proved them wrong.
ImageAnthropology ~ A beautiful tale.
EpicZen
Carnivores Hub ~ Need the full games without all the hassle of torrents or viruses? Run on over to EpicZen's Carnivores Hub!
Dragonlord
Compsognathus
Compsognathus
Posts: 1070
Joined: Fri Jan 04, 2008 12:14 am
Location: Switzerland
Contact:

Re: pcm encoder

Post by Dragonlord »

Uhm... why not just use "Audacity" and be happy?
Image
Leader, Head Programmer: Epsylon | Drag[en]gine ( Wiki )
User avatar
machf
T-Rex Killer
T-Rex Killer
Posts: 12368
Joined: Thu Apr 24, 2003 11:20 pm
Location: Lima, Peru
Contact:

Re: pcm encoder

Post by machf »

Hmmm... has anyone tried IMA ADPCM files saved with Audacity and imported into a TPA file? I remember someone tried using IMA ADPCM WAV files in the past (can't remember what program was used), but they wouldn't play well once imported...
Rebel wrote:it's a test to create a trespasser compatible ima/dvi adpcm wav, import it and have it play all the way through in-game.
Visit The Carnivores Saga - a forum devoted to modding Action Forms' Carnivores, Carnivores 2 and Carnivores: Ice Age games
Tres WIP: updated T-Script Reference and File Formats documents
Sound name listings for the Demo (build 117), Retail (build 116), Beta 103, Beta 99, Beta 97, Beta 96, Build 55, PC Gamer Alpha (build 32) and E3 1998 Alpha (build 22) TPA files
Dragonlord
Compsognathus
Compsognathus
Posts: 1070
Joined: Fri Jan 04, 2008 12:14 am
Location: Switzerland
Contact:

Re: pcm encoder

Post by Dragonlord »

I would be astonished if this is a problem. If though it is one simply use SoX. There's nothing SoX can't do and it's command line so you can embed it into scripts to automatize your production pipeline.
Image
Leader, Head Programmer: Epsylon | Drag[en]gine ( Wiki )
User avatar
Rebel
-=TresCom Developer=-
-=TresCom Developer=-
Posts: 6112
Joined: Sun Nov 10, 2002 10:26 pm
Location: That country nobody likes (you know the one)
Contact:

Re: pcm encoder

Post by Rebel »

Sox, eh? Never tried it, though I know cool_edit created ima/dvi wavs don't work. They play a second or two & then cut off, just as I expected they would. The devil is in the details, as the saying goes. True audio programs can handle a wide range of audio formats and variations. Tres isn't an audio program though, it's a game and as such has strict requirements for its audio loader to work. It was never designed nor intended to accommodate any other audio formatting, block alignments or sampling rates other than what it was designed for and the Devs really had no reason to make allowances for it to do that.
Dragonlord
Compsognathus
Compsognathus
Posts: 1070
Joined: Fri Jan 04, 2008 12:14 am
Location: Switzerland
Contact:

Re: pcm encoder

Post by Dragonlord »

I'm rather sure it should work. Just tell me what exact format parameters the WAV has to be like and I'll see if Audacity or SoX can do it.
Image
Leader, Head Programmer: Epsylon | Drag[en]gine ( Wiki )
User avatar
Rebel
-=TresCom Developer=-
-=TresCom Developer=-
Posts: 6112
Joined: Sun Nov 10, 2002 10:26 pm
Location: That country nobody likes (you know the one)
Contact:

Re: pcm encoder

Post by Rebel »

if mono;

22050, 16bit, 1024 block alignment


stereo;

41000, 16bit, 2048 block alignment
User avatar
machf
T-Rex Killer
T-Rex Killer
Posts: 12368
Joined: Thu Apr 24, 2003 11:20 pm
Location: Lima, Peru
Contact:

Re: pcm encoder

Post by machf »

Here's a test with Audacity:
Attachments
269.zip
(4.31 KiB) Downloaded 3374 times
Visit The Carnivores Saga - a forum devoted to modding Action Forms' Carnivores, Carnivores 2 and Carnivores: Ice Age games
Tres WIP: updated T-Script Reference and File Formats documents
Sound name listings for the Demo (build 117), Retail (build 116), Beta 103, Beta 99, Beta 97, Beta 96, Build 55, PC Gamer Alpha (build 32) and E3 1998 Alpha (build 22) TPA files
Dragonlord
Compsognathus
Compsognathus
Posts: 1070
Joined: Fri Jan 04, 2008 12:14 am
Location: Switzerland
Contact:

Re: pcm encoder

Post by Dragonlord »

Should be no problem for Audacity. Save as "Other Uncompressed Format" and use "IMA ADPCM" as format. Before exporting set the track to "Mono", "22050" and "16 Bit" and the project to "22050". Then the produced file should be correct. What exactly you mean with block size I don't get as I can not recall this format having any "block size" restrictions or requirements of any kind. It's a 4-bit format hence 1024 or 2048 "block size" (whatever this is supposed to be) is automatically given since both 1024 and 2048 are divisible by 4.
Image
Leader, Head Programmer: Epsylon | Drag[en]gine ( Wiki )
User avatar
Rebel
-=TresCom Developer=-
-=TresCom Developer=-
Posts: 6112
Joined: Sun Nov 10, 2002 10:26 pm
Location: That country nobody likes (you know the one)
Contact:

Re: pcm encoder

Post by Rebel »

Yea, need a bigger wave sample than that to test out. Block alignment is how many samples there are inbetween headers (before the next sample blocks begin).

Take a voiceover wav from trespasser, encode that and upload. Something at least a few words long.
Dragonlord
Compsognathus
Compsognathus
Posts: 1070
Joined: Fri Jan 04, 2008 12:14 am
Location: Switzerland
Contact:

Re: pcm encoder

Post by Dragonlord »

In between headers? There is only one header and the rest is a continuous stream of nibbles. Ah wait... yeah... the M$-fuck-me-up variation of IMA ADPCM has an abomination like "block size". I think I see now where you come from. From my test Audacity uses "512" as the block size on a mono file with static noise. You don't want to say they did "not" read the block header but assume 1024 all the time in Trespasser? That would be very short stupid even for games of that time.
Image
Leader, Head Programmer: Epsylon | Drag[en]gine ( Wiki )
User avatar
Rebel
-=TresCom Developer=-
-=TresCom Developer=-
Posts: 6112
Joined: Sun Nov 10, 2002 10:26 pm
Location: That country nobody likes (you know the one)
Contact:

Re: pcm encoder

Post by Rebel »

You don't want to say they did "not" read the block header but assume 1024 all the time in Trespasser? That would be very short stupid even for games of that time.
Yes, I believe that's what the audio loader does indeed do.
Dragonlord
Compsognathus
Compsognathus
Posts: 1070
Joined: Fri Jan 04, 2008 12:14 am
Location: Switzerland
Contact:

Re: pcm encoder

Post by Dragonlord »

That actually is "very" stupid. Way to make themselves (the developers and artists) extra work. I don't know right now if SoX has an option to alter the block size. Such an assumption about the block size is quite an exotic requirement.
Image
Leader, Head Programmer: Epsylon | Drag[en]gine ( Wiki )
User avatar
Rebel
-=TresCom Developer=-
-=TresCom Developer=-
Posts: 6112
Joined: Sun Nov 10, 2002 10:26 pm
Location: That country nobody likes (you know the one)
Contact:

Re: pcm encoder

Post by Rebel »

Dragonlord wrote:That actually is "very" stupid. Way to make themselves (the developers and artists) extra work. I don't know right now if SoX has an option to alter the block size. Such an assumption about the block size is quite an exotic requirement.
Well, the encoder I posted does the job, but the created adpcms are not optimum quality. On a scale of 1 - 10, I'd give most waves encoded a 7 or 8 in quality. Acceptable in most cases -
Post Reply