Classes that turn the CAPI device audio streams into an A-Law, u-Law or PCM stream.

ISDN byte streams are encoded as either u-Law (North America, Japan) or A-Law (most other countries) [2] with the bit order 'swapped'.
Here in beautiful Lincolnshire (England, old world) the local telecoms use the A-Law coding.
What you need to do, to convert the raw network byte stream into something more useful is the following :

  1. The bits in every byte need to be 'swapped' like this : 0x00 -> 0x00, 0x01 -> 0x80, 0x02->0x40, 0x03->0xc0 ... [1]; (LawInputStream.java, LawOutputStream.java)
    Now the bytes are coded as an A-Law stream or u-Law stream.
  2. Optionally the Law stream can be converted into PCM-streams (see uk.co.mmscomputing.sound).
  3. This can now be packed into an audio file format (i.e.: MS-'wave', uk.co.mmscomputing.device.capi.CapiSystem, uk.co.mmscomputing.sound).

LawInputStream : Converts the incoming ISDN byte stream into A-Law or u-Law byte stream.

LawOutputStream : Converts an A-Law or u-Law byte stream into an outgoing ISDN byte stream.

PCMInputStream : Converts the incoming ISDN byte stream into a PCM byte stream.

PCMOutputStream : Converts a PCM byte stream into an outgoing ISDN byte stream.

The PCM-Format here is :
PCM 8000.0 Hz, 16 bit, mono, SIGNED, little-endian
static AudioFormat pcmformat = new AudioFormat(8000,16,1,true,false);


[1] caiviar project [last accessed : 2003-07-09]

[2] Willi-Hans Steeb; Mathematical Tools in Signal Processing with C++ and Java Simulations; International School for Scientific Computing

Package : uk.co.mmscomputing.device.capi.sound
  1. LawInputStream.java
  2. LawOutputStream.java
  3. PCMInputStream.java
  4. PCMOutputStream.java
Projects :
  1. uk.co.mmscomputing.sound:
    Java classes that convert A-Law or u-Law byte streams into PCM byte streams or *.wav files and vice versa. A simple sound player and recorder