P5 Audio JS

//cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.11/p5.min.js
/cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.11/addons/p5.dom.min.js
//cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.11/addons/p5.sound.min.js

var mic, recorder, soundFile;
function setup(){
mic = new p5.AudioIn();
mic.start();
recorder = new p5.SoundRecorder();
recorder.setInput(mic);
soundFile = new p5.SoundFile();
}
$("[name=btnRecord]").on("click",function(){
recorder.record(soundFile);
$("[name=btnRecord]").html("Recording...");
});
$("[name=btnStop]").on("click",function(){
recorder.stop();
$("[name=btnRecord]").html("Record");
});
$("[name=btnPlay]").on("click",function(){
soundFile.play();
});
$("[name=btnDownload]").on("click",function(){
saveSound(soundFile, 'mySound.wav');
});
$("[name=btnUpload]").on("click",function(){
$.ajax({
type: "POST",
url:"upload.php",
data: {sound: soundFile},
success: function(response){

},
dataType: "json"
});
});


Source: https://stackoverflow.com/questions/38183107/how-to-upload-recorded-sound-in-p5-sound-js