WTF.
Just post the text here please!
James.
Both LaserBoy and LaserWave can produce multi-channel wave files that are 'projector-ready'
for a modified sound card, complete with adjustable time shifts (offsets) down to the sample
period to account for the delayed response of scanners vs solid-state color modulators, as
well as the ability to provide independent polarity control of signals, based on hardware
requirements. Rendered wave is purely time-based; the concept of the frame would normally
be lost.
'Laser formatted' wave is about making sure that rendered waves can be de-compiled back
into individual 24 bit color 2 or 3-D frames, with no data loss. This is accomplished by the fact
that the 16 bit wave format includes the ability to store non-audio info in the header of the file
(this allows time shifts between channels to be defined), as well as the fact that color channels
only need 8 bits of precision plus a sign bit, leaving the lower bits available for subcode purposes,
including the placement of end of frame marks, so that individual frames can be separated.
Both LaserBoy and LaserWave started with a simplistic addition to the minimal 44 byte header
16 bit Windows PCM .wav format. LW uses an updated version of this core format (fully readable
in LB) to include support for 3D and 8 channels. We'll call this format the Offsets standard; this
doc describes it in detail. Since the multiplatform release, LB uses an expanded format that
contains the core basics, plus an increasing amount of additional rendering information; we'll
call this the LaserBoy format. Since the LB format is subject to new additions from time to time,
LW is coded to read just the minimal information needed to bring LB rendered waves back into
frames (provided that they follow the original channel assignments). A description of the process
is given at the end of this doc.
''******** Offsets File Format
''** RIFF chunk
"RIFF" (4 byte ASCII) 'ASCII is big endian
Length from here to end of file, FileSize - 8 (4 byte int)
Integers are little endian
"WAVE" (4 byte ASCII)
''** Format chunk
"fmt " (4 byte ASCII) 'Don't forget the space
Length from here to the Data chunk, 16 + ExtraBytes (4 byte int)
ExtraBytes = 32 for 6ch, 40 for 8ch; ExtraBytes must always be an even number
Compression code = 1 (2 byte int) 'A setting of 1 indicates that the data is uncompressed PCM
Number of channels, 6 or 8 (2 byte int)
Sample rate in Hz (4 byte int)
Bytes per second (4 byte int) 'NumChannels * 2 * SampleRate
Bytes per sample period (2 byte int) 'NumChannels * 2
Bits per sample, 16 (2 byte int)
''** Non-audio Offsets chunk- here's the ExtraBytes
"offsets " (with the space) or "offsetsZ" (capital Z) (8 byte ASCII)
OffsetsZ signifies that data in the multi-function channel is 16 bit Z coordinate info
X offset (4 byte signed int) 'Number of sample periods to time-shift the channel. See notes
Y offset (4 byte signed int)
Red offset (4 byte signed int)
Green offset (4 byte signed int)
Blue offset (4 byte signed int)
Z offset (4 byte signed int)
Left audio offset (4 byte signed int) '8 ch only
Right audio offset (4 byte signed int) '8 ch only
''** Data chunk
"data" (4 byte ASCII)
Total PCM size, TotalTime * BytesPerSecond (4 byte int)
PCM sample data (2 byte signed int values)
Values range from -32768 to 32767 but -32768 should be avoided in chan 0-5
''**************
Notes:
PCM data is written in channel order for each sample period:
Sample_0: 0,1,2,3... Sample_1: 0,1,2,3... etc.
Use of the Offsets chunk implies the following channel assignments and details:
0 = X 16 bit
1 = Y 16 bit
2 = Red with End of Frame marks in bit 0
3 = Green
4 = Blue
5 = Multi-function: TTL (beam on-off), Intensity (grayscale), or 16 bit Z coordinate data
6 = Left audio 16 bit
7 = Right audio 16 bit
All channels are 16 bit signed int in storage, but color channels only need 8 bit precision,
plus the sign bit. Only the top 9 bits (7-15) are used; bits 0-6 are reserved. This is also
true if the multi-function channel is TTL or intensity, but if it is Z coordinate, than all
16 bits are used, as with X & Y.
Bit 0 of the Red channel is used for the all-important end of frame mark when set.
Offset values must be less than or equal to 0 for compliance with LaserBoy.
A negative offset indicates that the channel has been delayed by the specified
number of sample periods. The general idea is to delay color channels, as scanners
have a significantly longer propagation delay than color modulators. This all must
be accounted for when reading wave back into frames. In order of precedence, End of Frame
marks are added before the Red channel is offset in a write operation. Offset values are
always specified in this format, even if they are all 0.
When reading formatted wave back into real frames, absolute values can be taken for color,
TTL, or intensity signals, but independent polarity control for X, Y & Z should be made available
to handle any case.
''***** Minimal Read of LaserBoy Format
With the LB format the Offsets chunk is replaced with the LaserBoy chunk.
''** LaserBoy chunk
"LaserBoy" (8 byte ASCII)
"DDMMYYYY" (8 byte ASCII) 'Date stamp
LBMode (4 byte int) 'Bit 0 is global polarity (1 = positive), bit 4 indicates that offset values
are present- see LB notes
' These values are only present if LBMode bit 4 is set!!!
X offset (4 byte signed int) 'Number of sample periods to time-shift the channel
Y offset (4 byte signed int)
Red offset (4 byte signed int)
Green offset (4 byte signed int)
Blue offset (4 byte signed int)
Z (or I) offset (4 byte signed int)
Left audio offset (4 byte signed int) '8 ch only
Right audio offset (4 byte signed int) '8 ch only
'
Onward are varying amounts of extra information based on LB settings and date stamp. For a
minimal read, use the pointer in the Format chunk (second item) to skip to the start of the
Data chunk, or search from here for the ASCII string "data" (2 bytes at a time to maintain
block alignment).
''**
LB Notes:
The date stamp varies as new additions are made to the format, but the exact rev is not
important for a minimal read, at least for now... Channel assignments are the same as the
Offsets format, including End of Frame marks in bit 0 of the Red channel. The LB format also
includes Unique Frame marks in bit 0 of the Green channel. In an LB rendered wave, a source
drawing may be redrawn repeatedly for sustained appearance in display, resulting in multiple
wave frames of the same image. The Unique Frame bit is set only in the first of a series of repeat
frames (in the last sample of that frame), allowing the duplicate frames to be easily stripped away.
Bit 0 of the LBMode identifies global polarity- if set to 0, all channels are inverted to account
for the fact that a modified sound card together with a correction amp usually produces an
inverted signal. ONLY if bit 4 is set, channel offset values follow in the same form as the Offsets
format.
Some of this may change, as LB may offer optional new channel assignments and definitions in
the future.