dist/wavefile.js
function encodeSample$1(sample) {
  /** @type {number} */
  let sign;
  /** @type {number} */
  let exponent;
  /** @type {number} */
  let mantissa;
  /** @type {number} */
  let muLawSample;
  /** get the sample into sign-magnitude **/
  sign = (sample >> 8) & 0x80;
  if (sign != 0) sample = -sample;
  if (sample > CLIP) sample = CLIP;
  /** convert from 16 bit linear to ulaw **/
  sample = sample + BIAS;
  exponent = encodeTable[(sample>>7) & 0xFF];
  mantissa = (sample >> (exponent+3)) & 0x0F;
  muLawSample = ~(sign | (exponent << 4) | mantissa);
  /** return the result **/
  return muLawSample;
}
function encodeSample$1(sample) {
  /** @type {number} */
  let sign;
  /** @type {number} */
  let exponent;
  /** @type {number} */
  let mantissa;
  /** @type {number} */
  let muLawSample;
  /** get the sample into sign-magnitude **/
  sign = (sample >> 8) & 0x80;
  if (sign != 0) sample = -sample;
  if (sample > CLIP) sample = CLIP;
  /** convert from 16 bit linear to ulaw **/
  sample = sample + BIAS;
  exponent = encodeTable[(sample>>7) & 0xFF];
  mantissa = (sample >> (exponent+3)) & 0x0F;
  muLawSample = ~(sign | (exponent << 4) | mantissa);
  /** return the result **/
  return muLawSample;
}
function encodeSample$1 ( sample ) { /** @type {number} */ let sign ; /** @type {number} */ let exponent ; /** @type {number} */ let mantissa ; /** @type {number} */ let muLawSample ; /** get the sample into sign-magnitude **/ sign = ( sample >> 8 ) & 0x80 ; if ( sign != 0 ) sample = - sample ; if ( sample > CLIP ) sample = CLIP ; /** convert from 16 bit linear to ulaw **/ sample = sample + BIAS ; exponent = encodeTable [ ( sample >> 7 ) & 0xFF ] ; mantissa = ( sample >> ( exponent + 3 ) ) & 0x0F ; muLawSample = ~ ( sign | ( exponent << 4 ) | mantissa ) ; /** return the result **/ return muLawSample ; }
Encode a 16-bit linear PCM sample as 8-bit mu-Law.
@param {number} sample A 16-bit PCM sample
@return {number}
Encode a 16 - bit linear PCM sample as 8 - bit mu - Law .