audiojs / web-audio-api

Node.js implementation of Web audio API
MIT License
826 stars 67 forks source link

Error: Invalid ADTS header #87

Closed jayc809 closed 2 years ago

jayc809 commented 2 years ago

I was trying to decode an ArrayBuffer from a local mp3 file using node but got the "Invalid ADTS header" error. Here is my code:

const webAudioApi = require("web-audio-api")

const filePath = path.resolve(__dirname, 'test.mp3')
const data = fs.readFileSync(filePath)
const buffer = data.buffer
const audioCtx = new webAudioApi.AudioContext()
audioCtx.decodeAudioData(buffer, (buffer) => {console.log(buffer)})

Not really sure what the error means or why my code doesn't work (buffer is an ArrayBuffer). Thanks!

jayc809 commented 2 years ago

It appears to be an issue with my mp3 file