jsynth-file-sample

test audioBufferSource node for web audio API

Usage no npm install needed!

<script type="module">
  import jsynthFileSample from 'https://cdn.skypack.dev/jsynth-file-sample';
</script>

README

jsynth-file-sample

This module will turn your audio file / clip into a Web Audio source node. Use it to create samples.

Use with browserifyv.2 and brfs

npm install jsynth-file-sample

usage

example.js - use fs.readFileSync as supported by brfs. Use base64 encoding.

var fs = require('fs')
,   fileBuff = require('./')
,   context = new webkitAudioContext()
;

var file = fs.readFileSync('./loop.wav', 'base64'); // <----  

var sample = fileBuff(context, file);

sample.loop = true;

sample.connect(context.destination)

sample.start(0)

To run example.js

npm install -g browserify -opa
git clone https://github.com/NHQ/jsynth-file-sample
cd jsynth-file-sample
opa -n -e example.js