Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui">
- <link rel="apple-touch-icon" href="launch.png">
- <link rel="apple-touch-startup-image" href="launch.png">
- <meta name="apple-mobile-web-app-title" content="Push To Telescope">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black">
- <style>
- body {
- background-color: black;
- color: red;
- font-family: verdana;
- font-size: 120%;
- }
- .button {
- background-color: black;
- color: red;
- font-family: verdana;
- font-size: 7vw;
- border: 1px solid red;
- padding: 2% 2%;
- text-align: left;
- }
- </style>
- <script>
- function ready() {
- b7=document.getElementById("bit7")
- b7.addEventListener("click", () => {
- play();
- });
- setUpDone = false;
- setUp = () => {
- setUpDone = true;
- if ('webkitAudioContext' in window)
- audioCtx = new webkitAudioContext()
- else
- audioCtx = new AudioContext()
- oscillator = audioCtx.createOscillator()
- oscillator.frequency.value = 440; //19000
- oscillatorR = audioCtx.createOscillator()
- oscillatorR.frequency.value = 440; //19000
- if ('webkitAudioContext' in window) {
- gainNode = audioCtx.createGainNode()
- gainNodeR = audioCtx.createGainNode()
- } else {
- gainNode = audioCtx.createGain()
- gainNodeR = audioCtx.createGain()
- }
- if ('webkitAudioContext' in window) {
- oscillator.noteOn(0)
- oscillatorR.noteOn(0)
- } else {
- t = audioCtx.currentTime
- oscillator.start(t)
- oscillatorR.start(t + 0.00002632)
- oscillator.connect(gainNode)
- oscillatorR.connect(gainNodeR)
- merger = audioCtx.createChannelMerger(2)
- gainNode.connect(merger, 0, 0)
- gainNodeR.connect(merger, 0, 1)
- merger.connect(audioCtx.destination)
- t = audioCtx.currentTime
- }
- }
- }
- play = () => {
- if (!setUpDone) {
- setUp();
- }
- gainNode.gain.setValueAtTime(1.0, 100)
- gainNodeR.gain.setValueAtTime(1.0, 100)
- }
- if (document.readyState == 'loading') {
- document.addEventListener('DOMContentLoaded', ready);
- } else {
- ready();
- }
- </script>
- </head>
- <body>
- <div>
- <button id="bit7" class="buttonGroup8">play</button>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement