dist/wavefile.js
function encodeBlock(block) {
  /** @type {!Array<number>} */
  let adpcmSamples = blockHead_(block[0]);
  for (let i=3; i<block.length; i+=2) {
    /** @type {number} */
    let sample2 = encodeSample_(block[i]);
    /** @type {number} */
    let sample = encodeSample_(block[i + 1]);
    adpcmSamples.push((sample << 4) | sample2);
  }
  while (adpcmSamples.length < 256) {
    adpcmSamples.push(0);
  }
  return adpcmSamples;
}
function encodeBlock(block) {
  /** @type {!Array<number>} */
  let adpcmSamples = blockHead_(block[0]);
  for (let i=3; i<block.length; i+=2) {
    /** @type {number} */
    let sample2 = encodeSample_(block[i]);
    /** @type {number} */
    let sample = encodeSample_(block[i + 1]);
    adpcmSamples.push((sample << 4) | sample2);
  }
  while (adpcmSamples.length < 256) {
    adpcmSamples.push(0);
  }
  return adpcmSamples;
}
function encodeBlock ( block ) { /** @type {!Array<number>} */ let adpcmSamples = blockHead_ ( block [ 0 ] ) ; for ( let i = 3 ; i < block . length ; i += 2 ) { /** @type {number} */ let sample2 = encodeSample_ ( block [ i ] ) ; /** @type {number} */ let sample = encodeSample_ ( block [ i + 1 ] ) ; adpcmSamples . push ( ( sample << 4 ) | sample2 ) ; } while ( adpcmSamples . length < 256 ) { adpcmSamples . push ( 0 ) ; } return adpcmSamples ; }
Encode a block of 505 16-bit samples as 4-bit ADPCM samples.
@param {!Array<number>} block A sample block of 505 samples.
@return {!Array<number>}
Encode a block of 505 16 - bit samples as 4 - bit ADPCM samples .