Basic phase cancellation
Got this from Licson.net but nevertheless it's an awesome tiny module you can include. Just attach it to your audioContext and it should try to delete all the audio in the middle of the track, as they would with stereo tracks. Mono won't work.
class VoiceCancellation
constructor: ( @_audioContext ) ->
@audioProcessor = @_audioContext.createScriptProcessor 4096
@audioProcessor.onaudioprocess = ( e ) ->
inputOne = e.inputBuffer.getChannelData 0
inputTwo = e.inputBuffer.getChannelData 1
outputOne = e.outputBuffer.getChannelData 0
outputTwo = e.outputBuffer.getChannelData 1
for i in inputOne
outputOne[_i] = (inputOne[_i] - inputTwo[_i]) / 2
outputTwo[_i] = (inputTwo[_i] - inputOne[_i]) / 2
@audioProcessor
Written by Kenneth
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Coffeescript
Authors
iam4x
94.17K
ericdfields
63.02K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#