mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 00:27:58 +00:00
40 lines
No EOL
861 B
HTML
40 lines
No EOL
861 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>USING TONE WITH REQUIRE</title>
|
|
|
|
<script type="text/javascript" src="./deps/require.js"></script>
|
|
|
|
</head>
|
|
<body>
|
|
<div id='meter'></div>
|
|
<script type="text/javascript">
|
|
//minimal example using requirejs
|
|
require.config({
|
|
baseUrl : "./",
|
|
//make sure there is a path which points to
|
|
paths : {
|
|
"Tone" : "../Tone"
|
|
}
|
|
});
|
|
require(["Tone/core/Tone", "Tone/component/LFO", "Tone/signal/Scale", "Tone/component/Meter"],
|
|
function(Tone, LFO, Scale, Meter){
|
|
|
|
var osc = new LFO(0.5, 0, 1);
|
|
var scale = new Scale(10, 100);
|
|
var meter = new Meter();
|
|
|
|
osc.chain(scale, meter);
|
|
|
|
osc.start();
|
|
|
|
var meterEl = document.querySelector("#meter");
|
|
|
|
setInterval(function(){
|
|
meterEl.textContent = meter.getValue().toFixed(2);
|
|
}, 100);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |