Tone.js/examples/grainPlayer.html

101 lines
2.2 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 src="../build/Tone.js"></script>
<script src="./scripts/jquery.min.js"></script>
<script src="./scripts/draggabilly.js"></script>
<script src="./scripts/StartAudioContext.js"></script>
<script src="./scripts/Interface.js"></script>
<script 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>
2016-07-06 00:33:16 +00:00
// 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>
2016-07-06 00:33:16 +00:00
//the player
var player = new Tone.GrainPlayer({
"url" : "./audio/FWDL.[mp3|ogg]",
2016-07-06 00:33:16 +00:00
"loop" : true,
"grainSize" : 0.1,
"overlap" : 0.05,
}).toMaster();
2017-03-26 20:39:19 +00:00
// GUI //
2016-07-06 00:33:16 +00:00
2017-03-26 20:39:19 +00:00
Interface.Loader();
2016-07-06 00:33:16 +00:00
2017-03-26 20:39:19 +00:00
Interface.Button({
text : "Start",
activeText : "Stop",
type : "toggle",
start : function(){
player.start();
},
end : function(){
player.stop();
}
});
2016-07-06 00:33:16 +00:00
2017-03-26 20:39:19 +00:00
Interface.Slider({
param : "playbackRate",
name : "playbackRate",
parent : $("#Sliders"),
tone : player,
min : 0.5,
max : 2,
});
2016-07-06 00:33:16 +00:00
2017-03-26 20:39:19 +00:00
Interface.Slider({
param : "detune",
name : "detune",
parent : $("#Sliders"),
tone : player,
min : -1200,
max : 1200,
});
2016-07-06 00:33:16 +00:00
2017-03-26 20:39:19 +00:00
Interface.Slider({
param : "grainSize",
name : "grainSize",
parent : $("#Sliders"),
tone : player,
min : 0.01,
max : 0.2,
});
2016-07-06 00:33:16 +00:00
2017-03-26 20:39:19 +00:00
Interface.Slider({
param : "overlap",
name : "overlap",
parent : $("#Sliders"),
tone : player,
min : 0,
max : 0.2,
2016-07-06 00:33:16 +00:00
});
2017-03-26 20:39:19 +00:00
2016-07-06 00:33:16 +00:00
</script>
</body>
</html>