Explorar el Código

generating dummy text file

dds
Matt Bradshaw hace 6 años
padre
commit
609fe13c3d
Se han modificado 2 ficheros con 16 adiciones y 1 borrados
  1. +1
    -0
      extras/wav2sketch/wav2sketch.html
  2. +15
    -1
      extras/wav2sketch/wav2sketch.js

+ 1
- 0
extras/wav2sketch/wav2sketch.html Ver fichero

@@ -7,6 +7,7 @@
<p>Upload an audio file to convert it into Teensy audio format.</p>
<form>
<input id="audioFileChooser" name="audioFileChooser" type="file" accept="audio/*">
<div id="outputFileHolder"></div>
</form>
<script type="text/javascript" src="wav2sketch.js"></script>
</body>

+ 15
- 1
extras/wav2sketch/wav2sketch.js Ver fichero

@@ -20,4 +20,18 @@ function processFile(file) {
source.connect(context.destination);
source.start(0);
});
}
}

function generateOutputFile(fileContents) {
var textFileURL = null;
var blob = new Blob([fileContents], {type: 'text/plain'});
textFileURL = window.URL.createObjectURL(blob);
return textFileURL;
}

var outputFileHolder = document.getElementById('outputFileHolder');
var downloadLink = document.createElement('a');
downloadLink.setAttribute('download', 'test.txt');
downloadLink.href = generateOutputFile("this is a test");
downloadLink.innerHTML = 'download link';
outputFileHolder.appendChild(downloadLink);

Cargando…
Cancelar
Guardar