I am trying to write a program that will create 24 bit wav files using java. The java sound api does not support 24 bit audio so I am trying to write the file from scratch. This started out as a casual interest but it has become an epic quest of bits, bytes, signs and chunks.
Does a 24bit wav file's data chunk have signed or unsigned bytes?
Java's lack of unsigned bytes is frustrating. I have read that bit masked integers can be used to represent unsigned bytes but I wonder how that will be represented in the final output to file.
Sorry to diverge... my question is "Does a 24bit wav file's data chunk have signed or unsigned bytes?"
Either way I am going to have to figure out this signed/unsigned business but I can't find an answer reg开发者_开发问答arding the data chunk in the references I have found.
I can also confirm that 24 bit data in WAV files is signed (when the data is stored in the WAVE_FORMAT_PCM format). More generally, WAVE_FORMAT_PCM data is always signed EXCEPT when it is 8-bits per sample.
According to this (and my own personal experience) Microsoft WAVE files use 2's-complement signed integers to represent PCM samples larger than 8 bits. By default, the byte-order of those integers is little-endian.
You can use soxi
from the SoX package to verify this on your own test files (you do have some, right?).
Please note that WAVE files can also hold audio formats other than plain PCM.
精彩评论