How to split a .wav file into multiple .wav files?

This is a python code snippet that I use for splitting files as per necessity. I use the pydub library from https://github.com/jiaaro/pydub. You can modify the snippet to suit your requirement. from pydub import AudioSegment t1 = t1 * 1000 #Works in milliseconds t2 = t2 * 1000 newAudio = AudioSegment.from_wav(“oldSong.wav”) newAudio = newAudio[t1:t2] newAudio.export(‘newSong.wav’, … Read more

Pass Blob through ajax to generate a file

Try uploading the file as form data audioRecorder.exportWAV(function(blob) { var url = (window.URL || window.webkitURL).createObjectURL(blob); console.log(url); var filename = <?php echo $filename;?>; var data = new FormData(); data.append(‘file’, blob); $.ajax({ url : “lib/vocal_render.php”, type: ‘POST’, data: data, contentType: false, processData: false, success: function(data) { alert(“boa!”); }, error: function() { alert(“not so boa!”); } }); }); … Read more

Reading *.wav files in Python

Per the documentation, scipy.io.wavfile.read(somefile) returns a tuple of two items: the first is the sampling rate in samples per second, the second is a numpy array with all the data read from the file: from scipy.io import wavfile samplerate, data = wavfile.read(‘./output/audio.wav’)