mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-30 21:48:45 +00:00
47 lines
1.3 KiB
HTML
47 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Microphone</title>
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
<link rel="icon" type="image/png" sizes="174x174" href="./favicon.png">
|
|
|
|
<script src="https://unpkg.com/@webcomponents/webcomponentsjs@^2/webcomponents-bundle.js"></script>
|
|
<script src="../build/Tone.js"></script>
|
|
<script src="./js/tonejs-ui.js"></script>
|
|
</head>
|
|
<body>
|
|
<style type="text/css">
|
|
tone-oscilloscope {
|
|
width: 100%;
|
|
background-color: black;
|
|
height: 40px;
|
|
border-radius: 20px;
|
|
margin-bottom: 10px;
|
|
}
|
|
</style>
|
|
<tone-example>
|
|
<tone-explanation label="Microphone">
|
|
If supported, Tone.UserMedia uses <code>getUserMedia</code> to open the user's microphone where it can then be processed with Tone.js. Only works on https domains.
|
|
</tone-explanation>
|
|
|
|
<tone-content>
|
|
<tone-oscilloscope></tone-oscilloscope>
|
|
<tone-microphone></tone-microphone>
|
|
</tone-content>
|
|
</tone-example>
|
|
|
|
<script type="text/javascript">
|
|
//you probably DONT want to connect the microphone
|
|
//directly to the master output because of feedback.
|
|
var mic = new Tone.UserMedia();
|
|
|
|
//bind the interface
|
|
document.querySelector("tone-microphone").bind(mic);
|
|
document.querySelector("tone-oscilloscope").bind(mic);
|
|
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|