瀏覽代碼

ready to attempt sample rate stuff

dds
Matt Bradshaw 6 年之前
父節點
當前提交
f7b8ce783d
共有 2 個檔案被更改,包括 10 行新增2 行删除
  1. +8
    -1
      extras/wav2sketch/wav2sketch.html
  2. +2
    -1
      extras/wav2sketch/wav2sketch.js

+ 8
- 1
extras/wav2sketch/wav2sketch.html 查看文件

@@ -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>

+ 2
- 1
extras/wav2sketch/wav2sketch.js 查看文件

@@ -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);

Loading…
取消
儲存