Created
June 17, 2016 02:19
-
-
Save AdrienFromToulouse/a7b8fd46c835d4a1ca642c46d9a297c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
module.exports = (audioContext) => { | |
const buffer = fs.readFileSync('./test/data/clean2.wav'); | |
const bufferConvolver = fs.readFileSync('impulse-responses/piano-hall.wav'); | |
return audioContext.decodeAudioData(buffer).then((audioBuffer) => { | |
const bufSrc = audioContext.createBufferSource(); | |
const convolverNode = audioContext.createConvolver(); | |
bufSrc.buffer = audioBuffer; | |
return audioContext.decodeAudioData(bufferConvolver).then((audioBuffer) => { | |
convolverNode.buffer = audioBuffer; | |
bufSrc.connect(convolverNode); | |
convolverNode.connect(audioContext.destination); | |
bufSrc.start(0); | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment