Closed Goddard closed 12 months ago
TypeError: Cannot read properties of undefined (reading 'bind')
at D (/home/goddard/project/node_modules/@alexanderolsen/libsamplerate-js/dist/libsamplerate.js:1:4317)
at /home/goddard/project/node_modules/@alexanderolsen/libsamplerate-js/dist/libsamplerate.js:1:2009083
at /home/goddard/project/node_modules/@alexanderolsen/libsamplerate-js/dist/libsamplerate.js:1:2008431
at Object.next (/home/goddard/project/node_modules/@alexanderolsen/libsamplerate-js/dist/libsamplerate.js:1:2008536)
at /home/goddard/project/node_modules/@alexanderolsen/libsamplerate-js/dist/libsamplerate.js:1:2009403
at new Promise (
I'm happy to help, but I can't really help you without more information. Please either consider closing this issue + reopening using the bug report template I've provided, or specify more details about your environment. Node version, LibSampleRateJS version, OS, etc.
About all I can say right now with what you've provided is:
Seems to me there might be an older version in use, but please provide more info and we can figure it out.
I used this command as stated on the readme today to install.
npm i @alexanderolsen/libsamplerate-js
I am using node version 16.20.0
I also tried building from source with the docker image and got the same issue.
What operating system are you using? If I run the following:
nvm install 16.20.0
nvm use 16.20.0
mkdir lsr-test
cd lsr-test
npm init -y
touch index.js
npm i -S @alexanderolsen/libsamplerate-js
edit index.js:
const { create, ConverterType } = require('@alexanderolsen/libsamplerate-js');
and run
node index.js
The program completes without error, so this must be an environment issue. Please provide as much environment info as you can. What OS/version are you using? Is this in the browser, node AudioWorklet, etc? Please double check node version with node -v
Manjaro(Linux) it is rolling so latest.
I am running it in the cli so node. I also use nvm.
But this is running in a docker instance that is ubuntu. node --version v16.20.0
Thanks. Does the CLI example work for you? I don't have a Linux installation, but I need to install one for another project anyways. Will bump that up in my to-do's so I can check this out too. Thanks for verifying node version.
I've fresh installed Manjaro Kernel version 5.15.131 and the following works as expected. Same process - init empty project, install, create index, execute using node 16.20.0
const { create, ConverterType } = require('@alexanderolsen/libsamplerate-js');
(async () => {
const inSampleRate = 44100;
const outSampleRate = 96000;
const nChannels = 1;
create(nChannels, inSampleRate, outSampleRate).then((src) => {
const d = new Float32Array(44100);
const resampled = src.simple(d);
console.log(resampled.length);
});
})();
Inspecting the trace you got, the .bind()
statement is being called on console.error
. So for whatever reason console.error is not defined in your env.
Sorry to say, not sure what else I can do for you here.
Closing as this seems to be an environment issue. Feel free to followup and we can reopen
feeding chunks to resampler errors out immediately -
const { create, ConverterType } = require('@alexanderolsen/libsamplerate-js');
just importing this causes the error let resampler = await create(nChannels, inputSampleRate, outputSampleRate, { converterType });