@@ -6,7 +6,14 @@ | |||
<h1>Teensy Audio Wav2Sketch Utility</h1> | |||
<p>Upload an audio file to convert it into Teensy audio format.</p> | |||
<form> | |||
<input id="audioFileChooser" name="audioFileChooser" type="file" accept="audio/*" multiple> | |||
<label>Sample rate</label> | |||
<select> | |||
<option>Auto</option> | |||
<option>44100</option> | |||
<option>22050</option> | |||
<option>11025</option> | |||
</select><br/><br/> | |||
<input id="audioFileChooser" name="audioFileChooser" type="file" accept="audio/wav" multiple> | |||
<div id="outputFileHolder"></div> | |||
</form> | |||
<script type="text/javascript" src="wav2sketch.js"></script> |
@@ -19,8 +19,9 @@ function readFile() { | |||
} | |||
function processFile(file, fileName) { | |||
var context = new OfflineAudioContext(1,10*44100,44100); | |||
var context = new OfflineAudioContext(1,100*44100,44100); // 100 seconds for now | |||
context.decodeAudioData(file, function(buffer) { | |||
console.log(buffer.sampleRate); | |||
var monoData = []; | |||
if(buffer.numberOfChannels == 1) { | |||
monoData = buffer.getChannelData(0); |