Loading audio sample and mixing it with a delayed version of itself (on the compute shader).
Just for fun - also does a visualization of the origin and new sound signal.
Plays the sound as well - so you can actually hear the sound!! For this test example it's just someone saying 'hello'.
The steps:
• Create an AudioContext to load and play the audio file.
• Then load the audio file using fetch and decode it using decodeAudioData.
• Convert the audio data to mono and normalize it to ensure it's in the range [-1, 1].
• Setup GPU buffers for the audio data and copy the audio data to these buffers (WebGPU).
• Run the compute shader to apply the echo effect to the audio data.
• Visualize the waveform before and after processing using the visualizeWaveform function.
JavaScript code to set up the buffers and visualize the waveform:
Visitor:
Copyright (c) 2002-2025 xbdev.net - All rights reserved.
Designated articles, tutorials and software are the property of their respective owners.