Micronas SC4

From MultimediaWiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This is a simple speech codec supporting 32000, 16000, 11025 and 8000 Hz sampling rates.

It uses adaptive 6-point filtering and 30-byte blocks expanding into 58 samples (interleaved in case of stereo).

Codec data starts with a 5-byte header followed by 30-byte data frame and after every 100 frames there's a special 4-byte marker inserted depending on sample rate:

  • 8000/11025 Hz -> 00 00 01 1B
  • 16000/32000 Hz -> 00 00 02 2B

Each frame consists of 58 nibbles (starting from high nibble) and 0x55 sync marker at the end.

Nibble is expanded into sample in the following way:

 diff_sign = nibble >> 3;
 diff = STEP_TABLE[nibble];
 step = diff + (last_step >> 2);
 adiff = ((diff >> 11) == 0) ? ((newstep & 0x7F) + 0x80) << 7 >> (14 - (diff >> 7)) : 0;
 delta = diff_sign ? -adiff : adiff;
 new_sample = pred + delta;
 update weights as weight[i] * 255/256 - sign3(delta) * stored_sign[i] / 128
 shift weights back, assign delta as new weight[0]
 update stored signs
 calculate new prediction from the new_sample and dot product of weights and stored signs
 clip and output sample

Step table:

 0x800, 0x004, 0x087, 0x0D5, 0x111, 0x143, 0x175, 0x1A9,
 0x1A9, 0x175, 0x143, 0x111, 0x0D5, 0x087, 0x004, 0x800