Question
How do I play a local audio file inside Tone.Offline
so that when it finishes and return it's promised buffer it will contain the played audio?
Code
Tone.Offline(({ transport }) => {
const p = new Tone.Player(src, () => {
transport.start();
}).toDestination();
transport.schedule((time) => {
p.start(time + 5).stop(time + 9); //this never happen!
});
}, 10).then((buffer) => { // how do I push parts of my audio file onto the buffer?
const wav = toWav(buffer);
saveAs(new Blob([wav], { type: "audio/wav" }), "./blibli.wav");
});
Issue
I've noticed the callback part inside transport.schedule
never happen,
and so I never get to build the final buffer.