The Ur-Quan Masters Home Page Welcome, Guest. Please login or register.
Did you miss your activation email?
December 10, 2024, 01:19:24 pm
Home Help Search Login Register
News: Celebrating 30 years of Star Control 2 - The Ur-Quan Masters

+  The Ur-Quan Masters Discussion Forum
|-+  The Ur-Quan Masters Re-Release
| |-+  Starbase Café (Moderator: Death 999)
| | |-+  Star Control 3 STAR001.VOC archive WAV file format?
« previous next »
Pages: 1 2 [3] Print
Author Topic: Star Control 3 STAR001.VOC archive WAV file format?  (Read 21389 times)
Bisqwit
Zebranky food
*
Offline Offline

Posts: 8



View Profile WWW
Re: Star Control 3 STAR001.VOC archive WAV file format?
« Reply #30 on: September 24, 2013, 12:50:33 am »

Well, the previous three messages in this thread are all spam (promoting a product without really checking whether it actually solves anything discussed in the thread), and the last relevant post was from 2006.

Once upon a time - in 1998 - I also worked on this problem. Similarly without much success at cracking the speech compression.

Here's my Turbo Pascal program (from 1998) that extracts the wav files from the voc file, and reports some statistics on how much they were compressed.
Code:
{$M 2048,0,68096}
Uses Objects, Strings, WinDos, Crt;

Const
AppTxt: Array[0..63]Of Char = '<APP BYTES>';

Var
s, s2: Array[0..63]Of Char;
Buf: Array[0..16383]Of Char;
Bread: Word;

f, t: TBufStream;

Count: Word;
a, b: Word;

Size2, Size3, Total, Size, Posi: LongInt;

Ratio2, Ratio3, Ratio: Real;
Best2, Best3, Signa: Word;

C10: Word; C10A, C10B: Real;
C11: Word; C11A, C11B: Real;

Var
wFormatTag,
nChannels: Word;
nSamplesPerSec,
nAvgBytesPerSec: LongInt;
nBlockAlign,
Bits: Word;

Begin
f.Init('e:\pelit\sc3\star001.voc', stOpenRead, $FE00);

f.Read(Count, 2);

WriteLn('Voice clip count: ', Count);

Total := 0;

Ratio2 := 0;
Ratio3 := 100;

For a := 2900 To Count-1 Do
Begin
f.Seek(2 + a*4);
f.Read(Posi, 4);
f.Read(Size2, 4);
If Posi = 0 Then Continue;

{ Repeat f.Read(Size2, 4)Until Size2 <> 0;
Dec(Size2, Posi);
}
If Size2>0 Then Dec(Size2, Posi);
If(Size2 < 30000)Or(a >= 3000)Then
Begin
f.Seek(Posi);
f.Read(Signa, 2);
f.Read(Size, 4)
End
Else
Size := Size2;

If KeyPressed Then Break;

Write(a:4,': ',Size:5,' bytes'#13);
{If(Size >= 30000)And(Signa <> 0)Then Continue;}

If a < 3000 Then
Begin
f.Seek(Posi);
f.Read(Signa, 2);
f.Read(Size, 4)
End;

Str(a+1:4, s2);
strcpy(s, 'd:\sc3_wav\sc3_');
For b := 0 To 3 Do If s2[b]=' ' Then s2[b] := '0';
strcat(s, s2);

If Signa=32 Then strcat(s, '.wac')
Else If Signa= 0 Then strcat(s, '.wav')
Else
strcat(s, '.___');

Inc(Total, Size);

TextAttr := 15;
Write(s,': ');

t.Init(s, stOpenRead, 512);
If(t.Status = stOk)And(t.GetSize = Size)Then
Begin
t.Done;
Continue
End;
t.Done;
t.Init(s, stCreate, 512);
t.Done;
t.Init(s, stOpen, 2048);
t.Seek(0);
Size2 := Size;

Write(#8#8' Size:',Size:7);

C10 := 0;
C11 := 0;

Repeat
BRead := SizeOf(Buf);
If BRead > Size Then BRead := Size;

f.Read(Buf, BRead);

For b := 0 To BRead-1 Do
Begin
If Buf[b] = '' Then Inc(C10);
If Buf[b] = '' Then Inc(C11)
End;

t.Write(Buf, BRead);

Dec(Size, BRead)
Until Size <= 0;

t.CopyFrom(f, Size);

Size3 := t.GetPos;
{ t.Write(AppTxt, strlen(AppTxt));
t.CopyFrom(f, Size2 - Size - 6);}

WriteLn('   Free: ',DiskFree(Ord(UpCase(s[0]))-Ord('A')+1));

TextAttr := 7;

If(Signa = 32)Or(Signa=0)Then
Begin
t.Seek(20);      {'RIFF', size, 'WAVE', 'fmt ', size}
t.Read(wFormatTag,     2);
t.Read(nChannels,      2);
t.Read(nSamplesPerSec, 4);
t.Read(nAvgBytesPerSec,4);
t.Read(nBlockAlign,    2);
t.Read(Bits, 2);
t.Read(Size, 4); {'data'}
Size2 := Size3;
t.Read(Size, 4);
TextAttr := 3; Write(' FORMAT ');
TextAttr := 9; Write(wFormatTag);
TextAttr := 3; Write(': ');
TextAttr := 9;
If nChannels=1 Then Write('MONO')
Else If nChannels=2 Then Write('STEREO')
Else Write('Chans: ',nChannels);

TextAttr := 9; Write(' ',nSamplesPerSec/1000:0:2,' kHz ',Bits);
TextAttr := 3; WriteLn(' bits');

TextAttr := 3; Write(' Size: ');
TextAttr := 9; Write(Size:6);
TextAttr := 3; Write(' File: ');
TextAttr := 9; Write(Size2:6);
TextAttr := 3; Write(' Ratio: ');
Ratio := Size2*100/Size;
TextAttr := 9; Write(Ratio:0:1);
If Ratio > Ratio2 Then Begin Ratio2 := Ratio; Best2 := a; C10A := C10*100.0/Size; C11A := C11*100.0/Size End;
If Ratio < Ratio3 Then Begin Ratio3 := Ratio; Best3 := a; C10B := C10*100.0/Size; C11B := C11*100.0/Size End;
TextAttr := 3; WriteLn('% of original');
If Signa=0 Then WriteLn('*** NOT COMPRESSED, NOTE!')
End;

t.Done
End;

TextAttr := 7;
WriteLn('LEAST COMPRESSED ITEM WAS NUMBER',Best2:5,' (',Ratio2:0:1,'% OF ORIGINAL, :',C10A:0:4,'%, :',C11A:0:4,'%)');
WriteLn(' MOST COMPRESSED ITEM WAS NUMBER',Best3:5,' (',Ratio3:0:1,'% OF ORIGINAL, :',C10B:0:4,'%, :',C11B:0:4,'%)');

f.Done
End.

From what I deduced back then I saw that the compressed files still contained bits of recognizable audio, which suggests that it's either not entirely in one format, or it includes LZ-type elements to it.
Logged
meep-eep
Forum Admin
Enlightened
*****
Offline Offline

Posts: 2847



View Profile
Re: Star Control 3 STAR001.VOC archive WAV file format?
« Reply #31 on: June 13, 2015, 10:19:36 pm »

For future readers; the 'previous three messages in this thread' that Bisqwit referred to, no longer exist.
I have removed them, along with the later spam postings.
Logged

“When Juffo-Wup is complete
when at last there is no Void, no Non
when the Creators return
then we can finally rest.”
Scalare
*Many bubbles*
***
Offline Offline

Posts: 245



View Profile
Re: Star Control 3 STAR001.VOC archive WAV file format?
« Reply #32 on: October 20, 2016, 04:45:19 pm »

For future readers; the 'previous three messages in this thread' that Bisqwit referred to, no longer exist.
I have removed them, along with the later spam postings.

Their permission to exist has been revoked!
Logged
Death 999
Global Moderator
Enlightened
*****
Offline Offline

Gender: Male
Posts: 3874


We did. You did. Yes we can. No.


View Profile
Re: Star Control 3 STAR001.VOC archive WAV file format?
« Reply #33 on: October 27, 2016, 04:42:02 am »

If they can keep the writing up, they're in good shape - only like one line of dialog and it's a memetic-level hit!
Logged
Wcarr_
Zebranky food
*
Offline Offline

Posts: 4


Hi


View Profile
Re: Star Control 3 STAR001.VOC archive WAV file format?
« Reply #34 on: December 24, 2016, 04:02:00 pm »

I don't have the slightest idea! I am good at programming (kind of), but all of that still makes no sense to me.
Logged

*everyone* should *smell*! Do you *smell*? No! It will be *dissolving* for you now, for *silly cow* can not  *smell*! *GO GO*!
Pages: 1 2 [3] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!