Convert 16-bit wav file to 12-bit raw audio file
Sox will not support bit widths for wav files other than multiples of bytes. If you really need such unusual binary format then I suggest to write a short Python program that packs values in arbitrary format. Just please keep in mind that the maximum amplitude will be 2047 (instead of 32767 as for 16 bits).