Tonejs / Tone.js

A Web Audio framework for making interactive music in the browser.
https://tonejs.github.io
MIT License
13.24k stars 963 forks source link

Unable to stream audio by fetching partial content of the audio #1245

Closed logesh2496 closed 1 month ago

logesh2496 commented 2 months ago

Describe the bug

I have been trying to set initial Range in the header and an auto fetch property to stream audio data instead of downloading the whole file from the provided url.

To Reproduce

Try to setup Range headers in the Tone.Player method.

Expected behavior Would be great to have a method to auto fetch the bytes range as per the configurations

What I've tried I have been trying to handle it all outside by fetching the audio and setting the buffer of the tone.player

tambien commented 1 month ago

The way that the Web Audio API converts audio files into AudioBuffers (decodeAudioData), it's not currently possible to stream. decodeAudioData requires the entire buffer be available. I'm going to close this issue for now, if this changes or new approaches come to light, we can reopen.