We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi All,
I am using the following code to generate my data from an audio file.
window.AudioContext = window.AudioContext || window.webkitAudioContext; const audioContext = new AudioContext(); const drawAudio = url => { fetch(url) .then(response => response.arrayBuffer()) .then(arrayBuffer => audioContext.decodeAudioData(arrayBuffer)) .then(audioBuffer => filterData(audioBuffer)); }; const filterData = audioBuffer => { const rawData = audioBuffer.getChannelData(0); console.log(rawData); }; drawAudio('https://983yqbz442.s3.amazonaws.com/andyc.mp3');
I am trying to get the same data from a local file with the Node js library like this.
const fs = require('fs'); const AudioContext = require('web-audio-api').AudioContext; const audioContext = new AudioContext; let resp = fs.readFileSync('./samples/andyc.mp3'); audioContext.decodeAudioData(resp, buffer => { console.log(buffer); });
But I get 2 different results.
If you look at the web api it produces.
You can check the console.log here https://output.jsbin.com/haloneb/1
first 4 values of array
0: 0.0031128879636526108 1: 0.0052797021344304085 2: -0.000030517578125 3: 0.0016174810007214546
But the Node js one produces this first 4 values of array
0: 0 1: 0 2: 0 3: 0
Am i missing something?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi All,
I am using the following code to generate my data from an audio file.
I am trying to get the same data from a local file with the Node js library like this.
But I get 2 different results.
If you look at the web api it produces.
You can check the console.log here https://output.jsbin.com/haloneb/1
first 4 values of array
But the Node js one produces this first 4 values of array
Am i missing something?
The text was updated successfully, but these errors were encountered: