parshap / node-fpcalc

Calculate AcoustID audio fingerprint
69 stars 13 forks source link

ERR_OUT_OF_RANGE error during raw uncompressed fingerprint generation #10

Open pralivera opened 3 years ago

pralivera commented 3 years ago

I used following code segment to generate raw uncompressed fingerprint for given sound clip. But fpcalc return following error.

internal/buffer.js:35 throw new ERR_OUT_OF_RANGE('value', >= ${min} and <= ${max}, value); ^

RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range. It must be >= -2147483648 and <= 2147483647. Received 4134789158 at checkInt (internal/buffer.js:35:11) at writeU_Int32BE (internal/buffer.js:619:3) at Buffer.writeInt32BE (internal/buffer.js:707:10) at Stream. (/home/prasad/Work/Personal/project/sample/fingurePrint/node_modules/fpcalc/index.js:49:26) at Stream.emit (events.js:198:13) at Stream.reemit (/home/prasad/Work/Personal/project/sample/fingurePrint/node_modules/duplexer/index.js:70:25) at Stream.emit (events.js:198:13) at Stream. (/home/prasad/Work/Personal/project/sample/fingurePrint/node_modules/stream-reduce/index.js:11:8) at _end (/home/prasad/Work/Personal/project/sample/fingurePrint/node_modules/through/index.js:65:9) at Stream.stream.end (/home/prasad/Work/Personal/project/sample/fingurePrint/node_modules/through/index.js:74:5)

I have node version 10. could you please help me to resolve this ? thank you.

josewweee commented 3 years ago

Replace the test.js with this and it'll work

/* jshint node:true */
'use strict';

var path = require('path'),
  fs = require('fs'),
  test = require('tape'),
  fpcalc = require('../');

var TEST_FILE = path.join(__dirname, 'test.mp3');

fpcalc(TEST_FILE, function (err, result) {
  if (err) throw err;
  console.log(result.file, result.duration, result.fingerprint);
});