- Sign, add, clip, unsign. Subtract 128 from each byte, add them, clip, then add 128.
- Produce the Average, each sample just a[x]+b[x]/2
- Viktor T. Toth's, maths linked.
Full example is below. This will ask you to authorize Google Drive to access the audio samples (no it does NOT touch anything of yours): https://script.google.com/macros/s/AKfycbzMOWV5Z5soG3uinrFc0WcscNXxsDq9elE9rzG0t703vsvDJZMS/exec
var vegaArray = DriveApp.getFileById('0B-e9EqGm0pWPQ3RUTXFyUERDVTA').getBlob().getBytes(); var fdraArray = DriveApp.getFileById('0B-e9EqGm0pWPaUJQUmFRQWctNG8').getBlob().getBytes(); for(var i=44;i<vegaArray.length;i++) vegaArray[i] = Math.round( ( 2 * (vegaArray[i] + fdraArray[i]) ) - ( vegaArray[i] * fdraArray[i] / 128 ) - 256 ); // for // vegaArray is the mixed output