Browse Source

generating dummy text file

dds
Matt Bradshaw 6 years ago
parent
commit
609fe13c3d
2 changed files with 16 additions and 1 deletions
  1. +1
    -0
      extras/wav2sketch/wav2sketch.html
  2. +15
    -1
      extras/wav2sketch/wav2sketch.js

+ 1
- 0
extras/wav2sketch/wav2sketch.html View File

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

+ 15
- 1
extras/wav2sketch/wav2sketch.js View File

source.connect(context.destination); source.connect(context.destination);
source.start(0); 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);

Loading…
Cancel
Save