Bink Audio

From MultimediaWiki
Revision as of 16:06, 22 September 2008 by Multimedia Mike (talk | contribs) (just jotting down some notes)
Jump to navigation Jump to search

This is a custom perceptual audio codec used in Bink and later Smacker files.

Notes

  • mono or stereo
  • compresses audio in chunks of varying sizes depending on sample rate:
    • if sample rate < 22050, frame size is 2048 samples
    • if sample rate < 44100, frame size is 4096 samples
    • else, frame size is 8192 samples
  • a frame is windowed with the previous frame; the size of the window is frame size / 16
  • compute half the sample rate as (sample rate + 1) / 2; initialize an array of band frequencies corresponding to an array of 25 critical frequencies (same as WMA, apparently), any for which the critical frequencies are less than half the sample rate
    • critical frequencies: 100, 200, 300, 400, 510, 630, 770, 920, 1080, 1270, 1480, 1720, 2000, 2320, 2700, 3150, 3700, 4400, 5300, 6400, 7700, 9500, 12000, 15500, 24500
    • bands calculation: bands[0] = 1; foreach (i in 1..# of bands-1): bands[i] = crit_freq[i-1] * (frame length / 2) / (sample rate / 2); bands[# of bands] = frame length / 2
  • Bink audio packs 29-bit floating point numbers in the bitstream like this-- get_float():
    • exponent = next 5 bits
    • mantissa = next 23 bits
    • sign = 1 bit