//----------------------------------------------------------------------------
// Microsoft RIFF WAVE file header
//----------------------------------------------------------------------------
"RIFF" (4 byte literal string)
chunk_size (32-bit int) = 20 + sub_chunk_1_size + sub_chunk_2_size
//----------------------------------------------------------------------------
// Begin "WAVE" "fmt " chunk
//----------------------------------------------------------------------------
"WAVE" (4 byte literal string)
"fmt " (4 byte literal string; note the space at the end)
sub_chunk_1_size (32-bit int) = 16
audio_format (16-bit short) 1
num_channels (16-bit short) 6 or 8
sample_rate (32-bit int) 48000
byte_rate (32-bit int) = sample_rate * num_channels * (bits_per_sample /8)
block_align (16-bit short) = num_channels * (bits_per_sample /8)
bits_per_sample (16-bit short) 16
//----------------------------------------------------------------------------
// end "WAVE" "fmt " chunk
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// stuff added for LaserBoy !!!
//----------------------------------------------------------------------------
"LBoy" (4 byte literal string)
LaserBoy_chunk_size (16 // sizeof "LaserBoymmddCCYY"
+ sizeof(int) // sizeof (int)LaserBoy_wave_mode
// the following parts are only added if they are enabled
if(LASERBOY_WAVE_OFFSETS) + (num_channels * sizeof(int)
if(LASERBOY_WAVE_OPTIMIZED) + (8 * sizeof(int) // eight 32bit numbers
if(LASERBOY_WAVE_SIGNAL_MATRIX) + (num_channels * 2 * sizeof(short)
if(LASERBOY_SIGNAL_BIT_RESOLUTION) + (num_channels * sizeof(u_char)
if(LASERBOY_WAVE_NUM_FRAMES) + (sizeof(int)
if(LASERBOY_COLOR_RESCALE_R) + (256 * sizeof(short)
if(LASERBOY_COLOR_RESCALE_G) + (256 * sizeof(short)
if(LASERBOY_COLOR_RESCALE_B) + (256 * sizeof(short)
if(LASERBOY_COLOR_RESCALE_I) + (256 * sizeof(short)
"LaserBoy06282010" (16 byte literal string, current header version)
LaserBoy_wave_mode (32-bit int)
(OPTIONAL if the LASERBOY_WAVE_OFFSETS bit is set)
{
offset[0] (32-bit int)
offset[1] (32-bit int)
offset[2] (32-bit int)
offset[3] (32-bit int)
offset[4] (32-bit int)
offset[5] (32-bit int)
offset[6] (32-bit int) (optional, only for 8 channels)
offset[7] (32-bit int) (optional, only for 8 channels)
}
(OPTIONAL if you write anything other than X, Y, r, g, b, undefined)
{
signal_id (16-bit short) LASERBOY_SIGNAL_X_POSITION
signal_id [1] (16-bit short) LASERBOY_SIGNAL_Y_POSITION
signal_id [2] (16-bit short) LASERBOY_SIGNAL_RED_ANALOG
signal_id [3] (16-bit short) LASERBOY_SIGNAL_GREEN_ANALOG
signal_id [4] (16-bit short) LASERBOY_SIGNAL_BLUE_ANALOG
signal_id [5] (16-bit short) *** THIS_IS_THE_SIGNAL_YOU_NEED_TO_IDENTIFY ***
signal_id [6] (16-bit short) LASERBOY_SIGNAL_AUDIO_LEFT (optional, only for 8 channels)
signal_id [7] (16-bit short) LASERBOY_SIGNAL_AUDIO_RIGHT (optional, only for 8 channels)
LSB_tag (16-bit short) LASERBOY_LSB_NOT_USED
LSB_tag [1] (16-bit short) LASERBOY_LSB_NOT_USED
LSB_tag [2] (16-bit short) LASERBOY_LSB_END_OF_FRAME (eof is LSB of channel[2])
LSB_tag [3] (16-bit short) LASERBOY_LSB_NOT_USED
LSB_tag [4] (16-bit short) LASERBOY_LSB_NOT_USED
LSB_tag [5] (16-bit short) LASERBOY_LSB_NOT_USED
LSB_tag [6] (16-bit short) LASERBOY_LSB_NOT_USED (optional, only for 8 channels)
LSB_tag [7] (16-bit short) LASERBOY_LSB_NOT_USED (optional, only for 8 channels)
}
(OPTIONAL if the LASERBOY_SIGNAL_BIT_RESOLUTION bit is set)
{
resolution[0] (8-bit byte) 16
resolution[1] (8-bit byte) 16
resolution[2] (8-bit byte) 9
resolution[3] (8-bit byte) 9
resolution[4] (8-bit byte) 9
resolution[5] (8-bit byte) 16 or whatever known signal is
resolution[6] (8-bit byte) 16 (optional, only for 8 channels)
resolution[7] (8-bit byte) 16 (optional, only for 8 channels)
}
//----------------------------------------------------------------------------
// end of stuff added for LaserBoy !!!
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// Microsoft RIFF WAVE "data" chunk
//----------------------------------------------------------------------------
"data" (4 byte literal string)
sub_chunk_2_size (32-bit int) = num_samples * num_channels * (bits_per_sample /8)
//----------------------------------------------------------------------------
// end of wave header. actual wave data follows...
//----------------------------------------------------------------------------
for the value of LaserBoy_wave_mode, set these bits to 1 to enable each feature.
#define LASERBOY_WAVE_NEGATIVE 0
#define LASERBOY_WAVE_POSITIVE 1
#define LASERBOY_WAVE_END_OF_FRAME 2
#define LASERBOY_WAVE_UNIQUE_FRAME 4
#define LASERBOY_WAVE_UNIQUE_VERTEX 8
#define LASERBOY_WAVE_OFFSETS 16
#define LASERBOY_WAVE_OPTIMIZED 32
#define LASERBOY_WAVE_SIGNAL_MATRIX 64
#define LASERBOY_SIGNAL_BIT_RESOLUTION 128
Setting the bits for:
LASERBOY_WAVE_OFFSETS
LASERBOY_WAVE_OPTIMIZED
LASERBOY_WAVE_SIGNAL_MATRIX
LASERBOY_SIGNAL_BIT_RESOLUTION
also requires that you store an associated set of values for each of these features.
LASERBOY_WAVE_OPTIMIZED indicates that the wave has been optimized for direct
playback to a laser projector. This means that a specific set of processes have
been applied to the vector data before it was written to wave. The set of values
that get stored in the wave header are values that were used in the optimization
process and are probably not useful to anyone outside of the LaserBoy code.
LASERBOY_SIGNAL_BIT_RESOLUTION is enabled by setting the 128 bit.
A set of single, unsigned bytes are stored, one for each channel, that indicate the
actual number of bits of significance in each of the channels.
When you put some data into the sixth channel, you need to set bit 64
in LaserBoy_wave_mode and identify all of the signals. This is done with
two sets of signed 16-bit short integers that follow the offsets.
These are stored one for each channel.
The first set are the signal_id numbers.
The absolute values are shown below in hex.
#define LASERBOY_SIGNAL_NO_SIGNAL 0x00 // zero
#define LASERBOY_SIGNAL_UNDEFINED 0x01 // not zero
#define LASERBOY_SIGNAL_X_POSITION 0x10
#define LASERBOY_SIGNAL_Y_POSITION 0x11
#define LASERBOY_SIGNAL_Z_POSITION 0x12
#define LASERBOY_SIGNAL_DX_POSITION 0x13
#define LASERBOY_SIGNAL_DY_POSITION 0x14
#define LASERBOY_SIGNAL_X2_POSITION 0x15
#define LASERBOY_SIGNAL_Y2_POSITION 0x16
#define LASERBOY_SIGNAL_BEAM_WIDTH 0x20
#define LASERBOY_SIGNAL_RED_TTL 0x30
#define LASERBOY_SIGNAL_RED_ANALOG 0x31
#define LASERBOY_SIGNAL_YELLOW_TTL 0x32
#define LASERBOY_SIGNAL_YELLOW_ANALOG 0x33
#define LASERBOY_SIGNAL_GREEN_TTL 0x34
#define LASERBOY_SIGNAL_GREEN_ANALOG 0x35
#define LASERBOY_SIGNAL_BLUE_TTL 0x36
#define LASERBOY_SIGNAL_BLUE_ANALOG 0x37
#define LASERBOY_SIGNAL_VIOLET_TTL 0x38
#define LASERBOY_SIGNAL_VIOLET_ANALOG 0x39
#define LASERBOY_SIGNAL_MONO_TTL 0x3a
#define LASERBOY_SIGNAL_MONO_OR_ANALOG 0x3b
#define LASERBOY_SIGNAL_MONO_WEIGHTED_ANALOG 0x3c
#define LASERBOY_SIGNAL_MONO_AVG_ANALOG 0x3d
#define LASERBOY_SIGNAL_MONO_O_SCOPE 0x3e
#define LASERBOY_SIGNAL_AUDIO_SMTPE 0x40
#define LASERBOY_SIGNAL_AUDIO_MONO 0x41
#define LASERBOY_SIGNAL_AUDIO_LEFT 0x42
#define LASERBOY_SIGNAL_AUDIO_RIGHT 0x43
#define LASERBOY_SIGNAL_AUDIO_CENTER 0x44
#define LASERBOY_SIGNAL_AUDIO_SUB 0x45
#define LASERBOY_SIGNAL_AUDIO_S_LEFT 0x46
#define LASERBOY_SIGNAL_AUDIO_S_RIGHT 0x47
#define LASERBOY_SIGNAL_AUDIO_R_LEFT 0x48
#define LASERBOY_SIGNAL_AUDIO_R_RIGHT 0x49
To indicate that an individual signal has been negated with respect
to the global polarity, use the negative value of the signal number.
The second set are the LSB_tag numbers.
These numbers may be stored in any of the channel's LSB_tag values
to indicate that the least significant bit of this channel is used as
a Boolean marker to indicate something special about a particular sample.
#define LASERBOY_LSB_NOT_USED 0
#define LASERBOY_LSB_BLANKING 1
#define LASERBOY_LSB_END_OF_FRAME 2
#define LASERBOY_LSB_UNIQUE_FRAME 3
#define LASERBOY_LSB_UNIQUE_VERTEX 4
It is not necessary to set and use LASERBOY_WAVE_SIGNAL_MATRIX
to get the benefit of LASERBOY_WAVE_END_OF_FRAME.
In the case where the first is not set and the second is,
it should be assumed that eof marks will be found in the LSB
of the third channel; red.
"LaserBoy" is NOT a brand name!
It is a FREE and OPEN concept for extending the utility of the wave file format.
James.