Tone.js/examples/grainPlayer.html

103 lines
2.5 KiB
HTML
Raw Normal View History

2016-07-06 00:33:16 +00:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GRAINPLAYER</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="icon" type="image/png" sizes="174x174" href="./style/favicon.png">
<script type="text/javascript" src="../build/Tone.js"></script>
<script type="text/javascript" src="./scripts/jquery.min.js"></script>
<script type="text/javascript" src="./scripts/draggabilly.js"></script>
<script type="text/javascript" src="./scripts/StartAudioContext.js"></script>
<script type="text/javascript" src="./scripts/Interface.js"></script>
2016-07-07 21:31:06 +00:00
<script type="text/javascript" src="https://tonejs.github.io/Logo/build/Logo.js"></script>
2016-07-06 00:33:16 +00:00
<link rel="stylesheet" type="text/css" href="./style/examples.css">
<script type="text/javascript">
// jshint ignore: start
</script>
</head>
<body>
<div id="Content">
<div id="Title">Granular Synthesis</div>
<div id="Explanation">
<a href="https://tonejs.github.io/docs/#GrainPlayer">Tone.GrainPlayer</a> uses
2016-07-06 00:33:16 +00:00
<a href="https://en.wikipedia.org/wiki/Granular_synthesis">granular synthesis</a>
to enable you to adjust pitch and playback rate independently. The grainSize is the
amount of time each small chunk of audio is played for and the overlap is the
amount of crossfading transition time between successive grains.
</div>
<div id="Sliders"></div>
</div>
<script type="text/javascript">
//the player
var player = new Tone.GrainPlayer({
"url" : "./audio/FWDL.mp3",
"loop" : true,
"grainSize" : 0.1,
"overlap" : 0.05,
}).toMaster();
</script>
<script id="GUI" type="text/javascript">
$(function(){
Interface.Loader();
2016-07-06 00:33:16 +00:00
Interface.Button({
2016-07-06 00:33:16 +00:00
text : "Start",
activeText : "Stop",
type : "toggle",
start : function(){
player.start();
},
end : function(){
player.stop();
}
});
Interface.Slider({
2016-07-06 00:33:16 +00:00
param : "playbackRate",
name : "playbackRate",
parent : $("#Sliders"),
tone : player,
min : 0.5,
max : 2,
});
Interface.Slider({
2016-07-06 00:33:16 +00:00
param : "detune",
name : "detune",
parent : $("#Sliders"),
tone : player,
min : -1200,
max : 1200,
});
Interface.Slider({
2016-07-06 00:33:16 +00:00
param : "grainSize",
name : "grainSize",
parent : $("#Sliders"),
tone : player,
min : 0.01,
max : 0.2,
});
Interface.Slider({
2016-07-06 00:33:16 +00:00
param : "overlap",
name : "overlap",
parent : $("#Sliders"),
tone : player,
min : 0,
max : 0.2,
});
});
</script>
</body>
</html>