ircam-ismm / node-web-audio-api

Web Audio API implementation for Node.js
https://www.npmjs.com/package/node-web-audio-api
BSD 3-Clause "New" or "Revised" License
96 stars 13 forks source link

Question: How would this exception occur? 'Error: unsupported feature: aac: aac too complex' #126

Closed anson0370 closed 4 months ago

anson0370 commented 4 months ago

Hi Team,

Thank you for your work. I've encountered some issues while using this library, but since I know nothing about audio parsing, I have to ask for your help.

I retrieve a segment of incomplete MP3 audio data through http header range: bytes xxx-xxx, and then use node-web-audio-api to decode it. Most of the time, it works well, but sometimes the following errors occur.

Error: unsupported feature: adts: only 1 aac frame per adts packet is supported
Error: unsupported feature: aac: aac too complex

But every time I try to reproduce it, it's really hard to do so. In my use case, these MP3 audio files come with DAI (Dynamic Ad Insertion), so the audio files are actually different each time.

I don't know what's causing the above error or if it's possible to avoid it. For example, when such an error occurs, I move the range position a bit?

b-ma commented 4 months ago

Hey,

Unfortunately, I have absolutely no knowledge of how mp3 encoding / decoding works, so I can't help you here

I just wonder why you just don't decode the mp3 file entirely and playback the chunks you need using an AudioBufferSourceNode? It is possible to play only parts of an AudioBuffer using the source.start(time, offset, duration) signature (cf. https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode/start)

anson0370 commented 4 months ago

Hey @b-ma , thanks for the reply.

Download the entire MP3 file is too large and takes too long. I need to collect audio features from multiple points within a few seconds to compare the differences between two audio files.

I'll close this issue. Thanks.