Tone.js/examples/microphone.html
2014-03-16 13:33:56 -04:00

101 lines
No EOL
2.7 KiB
HTML

<html>
<head>
<title>Mic to Delay</title>
<link rel="stylesheet" type="text/css" href="../style/GUI.css">
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="../src/core/Tone.js"></script>
<script type="text/javascript" src="../src/components/Meter.js"></script>
<script type="text/javascript" src="../src/components/Envelope.js"></script>
<script type="text/javascript" src="../src/components/Noise.js"></script>
<script type="text/javascript" src="../src/components/Microphone.js"></script>
<script type="text/javascript" src="../src/effects/Effect.js"></script>
<script type="text/javascript" src="../src/effects/FeedbackEffect.js"></script>
<script type="text/javascript" src="../src/effects/FeedbackDelay.js"></script>
<script type="text/javascript" src="../src/GUI/GUI.js"></script>
<script type="text/javascript" src="../src/GUI/GUI.Bar.js"></script>
<script type="text/javascript" src="../src/GUI/GUI.Meter.js"></script>
<script type="text/javascript" src="../src/GUI/GUI.Fader.js"></script>
<script type="text/javascript" src="../src/GUI/GUI.ParamFader.js"></script>
<script type="text/javascript" src="../src/GUI/GUI.GainFader.js"></script>
</head>
<body>
<style type="text/css">
#meter {
width: auto;
text-align: center;
float: right;
position: absolute;
bottom: 10px;
right: 10px;
}
#fader {
position: absolute;
bottom: 10px;
right: 100px;
width: auto;
}
#MasterOut {
width: 160px;
height: 200px;
position: absolute;
bottom: 10px;
right: 0px;
}
#Trigger {
margin-left: -50px;
margin-top: -50px;
width: 100px;
height: 100px;
position: absolute;
top: 50%;
left: 50%;
background-color: blue;
}
#Trigger:after {
font-family: monospace;
position: absolute;
width: 100%;
content: "start mic";
color: white;
text-align: center;
line-height: 100px;
}
#Trigger:active {
background-color: white;
color: black;
}
</style>
<div id='Trigger'></div>
<div id='MasterOut'></div>
<script type="text/javascript">
var meter = new Tone.Meter(2);
var mic = new Tone.Microphone();
var env = new Tone.Envelope(.05, .01, 0, 0);
var feedbackDelay = new Tone.FeedbackDelay(.25);
var fader = new Tone.GUI.GainFader($("#MasterOut"), Tone.Master.output, "mstr");
var meterGui = new Tone.GUI.Meter($("#MasterOut"), meter, "master", 20);
mic.connect(feedbackDelay);
feedbackDelay.setWet(1);
feedbackDelay.setFeedback(.5);
feedbackDelay.toMaster();
//the master output meter
Tone.Master.connect(meter);
$("#Trigger").bind("mousedown touchstart", function(e){
mic.start();
$("#Trigger").remove();
});
</script>
</body>
</html>