1

I want to combine audio files layered on top of each other with a specific range of an audio file with specific starting time.

  1. I want to combine audio files layered on top of each other (I was able to do this with this link)

  2. Combine audio files width specific starting time.

  3. Combine audio files with specific range of an audio.

I need help for #2 and #3. Does anyone know how to do it?

PS, if there’re any libraries that can do this, please let me know.

Thanks

Jin
  • 13
  • 2

1 Answers1

1

The linked answer uses AudioBufferSourceNodes with an OfflineAudioContext to mix the audio files (or AudioBuffers to be more precise). You can use there start() and stop() methods of that AudioBufferSourceNodes to schedule the files at the desired time and to make them stop earlier.

source.start(1, 2, 3);

The code above will for example start the source after 1 second with of an offset of 2 seconds and will play it for 3 seconds. This does of course only work if the provided AudioBuffer is at least 5 seconds long.

chrisguttandin
  • 7,025
  • 15
  • 21