Musepack

From MultimediaWiki
Revision as of 23:23, 15 January 2007 by Kostya (talk | contribs) (Some known info about Musepack)
Jump to navigation Jump to search

Musepack is an open-source lossy audio codec based on MP2. It is a variable bit rate coder intended to produce perceptually transparent encoding.

There are several variations of Musepack known - SV(stream version) 4-6, 7 and 8. SV 4-6 is old and rarely used, SV8 is (still?) in development.

SV7 container format

Look here for header format: SV7 Specification The header is followed by frames, each frames is preceded by 20-bit variable containing number of bits in this frame (frames are not byte-aligned)

SV7 frame format

Frame data defines one audio frames - 32 bands with 36 subband samples (total 1152 samples per frame).

All data for bands is stored interleaved - left band first, right band next. Except for band indexes, all data is stored only for bands with index != 0.

Band type (max_bands is stored in file header):

 for(i = 0; i <= max_bands; i++){
   for(ch = 0; ch < 2; ch++)
     band[i][ch] = get_vlc();
   if(band[i][0] != 0 || band[i][1] != 0)
     msflag[i] = getbit();
 }

Scale index coding method - one VLC for each non-zero band (i.e. band type != 0) Scale indexes - 1-3 VLCs per each non-zero band depending on scale index coding method Quantizer

 for each non-zero band {
   switch(band type){
   case -1: fill all 36 band samples with random values
   case  1: read 12 VLCs for 36 band samples
   case  2: read 18 VLCs for 36 band samples
   case  3-7: for each band sample read VLC using table depending on band type
   case  8-17: for each band sample read (band type - 1) bits
   default: zero all 36 band samples
   }
 }

SV8 format

Look here for details: SV8 Specification