Electronic Arts MicroTalk: Difference between revisions

From MultimediaWiki
Jump to navigation Jump to search
No edit summary
(→‎Huffman tables: Fix output command)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
* Extension: UTK
* Company: [[Electronic Arts]]
* Company: Maxis
* Decoding: https://github.com/daddesio/utkencode
* Decompression code: http://wiki.niotso.org/UTK
* Samples: http://niotso.org/utalk/


Maxis UTalk is a speech-oriented audio codec used in The Sims Online, which operates at 32kbit/s.
'''EA MicroTalk''' (also '''UTalk''' or '''UTK''') is a linear-predictive speech codec used in various games by Electronic Arts. The earliest known game to use it is Beasts & Bumpkins (1997). The codec has a bandwidth of 11.025kHz (sampling rate 22.05kHz) and frame size of 20ms (432 samples) and only supports mono. It is typically encoded at 32 kbit/s.


== UTK File header ==
The codec was reverse-engineered by trass3r on August 05, 2010 and was later analyzed by Andrew D'Addesio on January 12, 2012.
<pre>struct UTKHeader
{
    char  sID[4];
    DWORD dwOutSize;
    DWORD dwWfxSize;
    /* WAVEFORMATEX */
    WORD  wFormatTag;
    WORD  nChannels;
    DWORD nSamplesPerSec;
    DWORD nAvgBytesPerSec;
    WORD  nBlockAlign;
    WORD  wBitsPerSample;
    DWORD cbSize;
};
</pre>


* '''sID''' - A 4-byte string identifier equal to "UTM0"
MicroTalk has been seen in several containers, depending on the game:
* '''dwOutSize''' - The decompressed size of the audio stream
* PT/.m10 (Beasts and Bumpkins)
* '''dwWfxSize''' - The size in bytes of the WAVEFORMATEX structure to follow; must be 20
* Maxis UTK (The Sims Online, SimCity 4)
* '''wFormatTag''' - The decoded audio format; set to WAVE_FORMAT_PCM (0x0001)
* SCxl (FIFA 2001 PS2, FIFA 2002 PS2)
* '''nChannels''' - Number of channels in the decoded audio data
* '''nSamplesPerSec''' - Sampling rate used in the decoded audio data
* '''nAvgBytesPerSec''' - Bytes per second consumed by the decoded audio data; equal to nChannels*nSamplesPerSec*wBitsPerSample/8 or nSamplesPerSec*nBlockAlign
* '''nBlockAlign''' - The number of bytes consumed by an audio frame (one sample for each channel) in the decoded audio data; equal to nChannels*wBitsPerSample/8
* '''wBitsPerSample''' - The bits per sample for one audio channel in the decoded audio data; 8-, 16-, or 24-bit, etc.
* '''cbSize''' - The size in bytes of extra format information appended to the end of the WAVEFORMATEX structure; must be 0. Note that in the original WAVEFORMATEX, this parameter is a WORD, not a DWORD.


Note that the part of the header from wFormatTag below is a Microsoft WAVEFORMATEX structure.
== Variants ==
There are a few variants of MicroTalk:
* MicroTalk 10:1 (codec_id=0x04 in [[Electronic Arts SCxl|EA SCxl]]) and MicroTalk 5:1 (codec_id=0x16) are really the same codec; the encoder simply chooses different compression parameters (reduced_bw is enabled in 10:1 and disabled in 5:1). MicroTalk 10:1 is typically encoded at 32kbit/s; 5:1 is encoded at 64kbit/s.
* MicroTalk Revision 3 (codec_revision=3 in SCxl) is a variant which supports raw PCM samples.


== Naming notes ==
== Huffman tables ==
The UTK files in The Sims Online were stored in DBPF archives without filenames. However, we can deduce the codec's name and file extension from this text contained in sys/tsoaudio.ini:
Normal model (Table 0):


<pre>;kGZCLSID_cWaveXA = 0x1d07eb4b
{| class="wikitable" border="1"
;kGZCLSID_cGZSndSegmentDataSourceUTalk = 0x1b6b9806
|-
;kGZCLSID_cGZWave = 0xbb7051f5
!Huffman code
;kGZCLSID_cHitMp3DecoderDataSource = 0x3cec2b47
!Output command
1=0x1d07eb4b,XA
!Meaning
2=0x1b6b9806,UTK
!Next model
3=0xbb7051f5,WAV
|-
4=0x3cec2b47,MP3</pre>
|0 0
|4
|Insert one 0.0f
|MDL_NORMAL
|-
|0 1
|5
|Insert one -1.0f
|MDL_NORMAL
|-
|1 0
|6
|Insert one +1.0f
|MDL_NORMAL
|-
|1 1 0 0
|9
|Insert one -2.0f
|MDL_LARGEPULSE
|-
|1 1 0 1
|10
|Insert one +2.0f
|MDL_LARGEPULSE
|-
|1 1 1 0 0
|13
|Insert one -3.0f
|MDL_LARGEPULSE
|-
|1 1 1 0 1
|14
|Insert one +3.0f
|MDL_LARGEPULSE
|-
|1 1 1 1 0 0
|17
|Insert one -4.0f
|MDL_LARGEPULSE
|-
|1 1 1 1 0 1
|18
|Insert one +4.0f
|MDL_LARGEPULSE
|-
|1 1 1 1 1 0 0
|21
|Insert one -5.0f
|MDL_LARGEPULSE
|-
|1 1 1 1 1 0 1
|22
|Insert one +5.0f
|MDL_LARGEPULSE
|-
|1 1 1 1 1 1 0 0
|25
|Insert one -6.0f
|MDL_LARGEPULSE
|-
|1 1 1 1 1 1 0 1
|26
|Insert one +6.0f
|MDL_LARGEPULSE
|-
|1 1 1 1 1 1 1 0
|0
|Insert a pulse with magnitude >= 7.0f
|MDL_LARGEPULSE
|-
|1 1 1 1 1 1 1 1
|2
|Insert between 7 and 70 0.0fs
|MDL_NORMAL
|}


WAV and MP3 are common audio formats, and XA refers to the [[Maxis XA]] ADPCM codec (with extension ".xa" in The Sims 1); and most importantly, the UTK files in the DBPF archives have a Type ID that match 0x1b6b9806.
Large-pulse model (Table 1):
 
{| class="wikitable" border="1"
|-
!Huffman code
!Output command
!Meaning
!Next model
|-
|0 0
|4
|Insert one 0.0f
|MDL_NORMAL
|-
|0 1 0
|7
|Insert one -1.0f
|MDL_NORMAL
|-
|0 1 1
|8
|Insert one +1.0f
|MDL_NORMAL
|-
|1 0 0
|11
|Insert one -2.0f
|MDL_LARGEPULSE
|-
|1 0 1
|12
|Insert one +2.0f
|MDL_LARGEPULSE
|-
|1 1 0 0
|15
|Insert one -3.0f
|MDL_LARGEPULSE
|-
|1 1 0 1
|16
|Insert one +3.0f
|MDL_LARGEPULSE
|-
|1 1 1 0 0
|19
|Insert one -4.0f
|MDL_LARGEPULSE
|-
|1 1 1 0 1
|20
|Insert one +4.0f
|MDL_LARGEPULSE
|-
|1 1 1 1 0 0
|23
|Insert one -5.0f
|MDL_LARGEPULSE
|-
|1 1 1 1 0 1
|24
|Insert one +5.0f
|MDL_LARGEPULSE
|-
|1 1 1 1 1 0 0
|27
|Insert one -6.0f
|MDL_LARGEPULSE
|-
|1 1 1 1 1 0 1
|28
|Insert one +6.0f
|MDL_LARGEPULSE
|-
|1 1 1 1 1 1 0
|1
|Insert a pulse with magnitude >= 7.0f
|MDL_LARGEPULSE
|-
|1 1 1 1 1 1 1
|3
|Insert between 7 and 70 0.0fs
|MDL_NORMAL
|}


[[Category:Vocoders]]
[[Category:Vocoders]]

Latest revision as of 11:11, 27 October 2017

EA MicroTalk (also UTalk or UTK) is a linear-predictive speech codec used in various games by Electronic Arts. The earliest known game to use it is Beasts & Bumpkins (1997). The codec has a bandwidth of 11.025kHz (sampling rate 22.05kHz) and frame size of 20ms (432 samples) and only supports mono. It is typically encoded at 32 kbit/s.

The codec was reverse-engineered by trass3r on August 05, 2010 and was later analyzed by Andrew D'Addesio on January 12, 2012.

MicroTalk has been seen in several containers, depending on the game:

  • PT/.m10 (Beasts and Bumpkins)
  • Maxis UTK (The Sims Online, SimCity 4)
  • SCxl (FIFA 2001 PS2, FIFA 2002 PS2)

Variants

There are a few variants of MicroTalk:

  • MicroTalk 10:1 (codec_id=0x04 in EA SCxl) and MicroTalk 5:1 (codec_id=0x16) are really the same codec; the encoder simply chooses different compression parameters (reduced_bw is enabled in 10:1 and disabled in 5:1). MicroTalk 10:1 is typically encoded at 32kbit/s; 5:1 is encoded at 64kbit/s.
  • MicroTalk Revision 3 (codec_revision=3 in SCxl) is a variant which supports raw PCM samples.

Huffman tables

Normal model (Table 0):

Huffman code Output command Meaning Next model
0 0 4 Insert one 0.0f MDL_NORMAL
0 1 5 Insert one -1.0f MDL_NORMAL
1 0 6 Insert one +1.0f MDL_NORMAL
1 1 0 0 9 Insert one -2.0f MDL_LARGEPULSE
1 1 0 1 10 Insert one +2.0f MDL_LARGEPULSE
1 1 1 0 0 13 Insert one -3.0f MDL_LARGEPULSE
1 1 1 0 1 14 Insert one +3.0f MDL_LARGEPULSE
1 1 1 1 0 0 17 Insert one -4.0f MDL_LARGEPULSE
1 1 1 1 0 1 18 Insert one +4.0f MDL_LARGEPULSE
1 1 1 1 1 0 0 21 Insert one -5.0f MDL_LARGEPULSE
1 1 1 1 1 0 1 22 Insert one +5.0f MDL_LARGEPULSE
1 1 1 1 1 1 0 0 25 Insert one -6.0f MDL_LARGEPULSE
1 1 1 1 1 1 0 1 26 Insert one +6.0f MDL_LARGEPULSE
1 1 1 1 1 1 1 0 0 Insert a pulse with magnitude >= 7.0f MDL_LARGEPULSE
1 1 1 1 1 1 1 1 2 Insert between 7 and 70 0.0fs MDL_NORMAL

Large-pulse model (Table 1):

Huffman code Output command Meaning Next model
0 0 4 Insert one 0.0f MDL_NORMAL
0 1 0 7 Insert one -1.0f MDL_NORMAL
0 1 1 8 Insert one +1.0f MDL_NORMAL
1 0 0 11 Insert one -2.0f MDL_LARGEPULSE
1 0 1 12 Insert one +2.0f MDL_LARGEPULSE
1 1 0 0 15 Insert one -3.0f MDL_LARGEPULSE
1 1 0 1 16 Insert one +3.0f MDL_LARGEPULSE
1 1 1 0 0 19 Insert one -4.0f MDL_LARGEPULSE
1 1 1 0 1 20 Insert one +4.0f MDL_LARGEPULSE
1 1 1 1 0 0 23 Insert one -5.0f MDL_LARGEPULSE
1 1 1 1 0 1 24 Insert one +5.0f MDL_LARGEPULSE
1 1 1 1 1 0 0 27 Insert one -6.0f MDL_LARGEPULSE
1 1 1 1 1 0 1 28 Insert one +6.0f MDL_LARGEPULSE
1 1 1 1 1 1 0 1 Insert a pulse with magnitude >= 7.0f MDL_LARGEPULSE
1 1 1 1 1 1 1 3 Insert between 7 and 70 0.0fs MDL_NORMAL