Created
November 5, 2015 22:19
-
-
Save FBerthelot/1fbb559d097472179555 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
// Création du ScriptProcessorNode avec un buffer de 4096, 1 entrée et 1 sortie | |
var ScriptProcessorNode = audioCtx.createScriptProcessor(4096, 1, 1); | |
ScriptProcessorNode.onaudioprocess = function(audioProcessingEvent){ | |
var inputBuffer = audioProcessingEvent.inputBuffer; | |
var outputBuffer = audioProcessingEvent.outputBuffer; | |
//Parcours de channel de la source audio (par exemple: gauche et droite en stéréo) | |
for (var i=0; i < outputBuffer.numberOfChannels; i++) { | |
var inputData = inputBuffer.getChannelData(i); | |
var outputData = outputBuffer.getChannelData(i); | |
//Parcours de l'ensemble du buffer | |
for (var j=0; j < inputBuffer.length; j++) { | |
outputData[j] = inputData[j] * 2; //Multiplication de l'amplitude par 2 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment