Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <html>
  4.  
  5. <head>
  6.  
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui">
  8. <link rel="apple-touch-icon" href="launch.png">
  9. <link rel="apple-touch-startup-image" href="launch.png">
  10. <meta name="apple-mobile-web-app-title" content="Push To Telescope">
  11. <meta name="apple-mobile-web-app-capable" content="yes">
  12. <meta name="mobile-web-app-capable" content="yes">
  13. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  14.  
  15. <style>
  16. body {
  17. background-color: black;
  18. color: red;
  19. font-family: verdana;
  20. font-size: 120%;
  21. }
  22. .button {
  23. background-color: black;
  24. color: red;
  25. font-family: verdana;
  26. font-size: 7vw;
  27. border: 1px solid red;
  28. padding: 2% 2%;
  29. text-align: left;
  30. }
  31. </style>
  32.  
  33. <script>
  34. function ready() {
  35.  
  36. b7=document.getElementById("bit7")
  37. b7.addEventListener("click", () => {
  38. play();
  39. });
  40.  
  41. setUpDone = false;
  42.  
  43. setUp = () => {
  44. setUpDone = true;
  45. if ('webkitAudioContext' in window)
  46. audioCtx = new webkitAudioContext()
  47. else
  48. audioCtx = new AudioContext()
  49. oscillator = audioCtx.createOscillator()
  50. oscillator.frequency.value = 440; //19000
  51. oscillatorR = audioCtx.createOscillator()
  52. oscillatorR.frequency.value = 440; //19000
  53. if ('webkitAudioContext' in window) {
  54. gainNode = audioCtx.createGainNode()
  55. gainNodeR = audioCtx.createGainNode()
  56. } else {
  57. gainNode = audioCtx.createGain()
  58. gainNodeR = audioCtx.createGain()
  59. }
  60. if ('webkitAudioContext' in window) {
  61. oscillator.noteOn(0)
  62. oscillatorR.noteOn(0)
  63. } else {
  64. t = audioCtx.currentTime
  65. oscillator.start(t)
  66. oscillatorR.start(t + 0.00002632)
  67. oscillator.connect(gainNode)
  68. oscillatorR.connect(gainNodeR)
  69. merger = audioCtx.createChannelMerger(2)
  70. gainNode.connect(merger, 0, 0)
  71. gainNodeR.connect(merger, 0, 1)
  72. merger.connect(audioCtx.destination)
  73. t = audioCtx.currentTime
  74. }
  75. }
  76. }
  77.  
  78. play = () => {
  79. if (!setUpDone) {
  80. setUp();
  81. }
  82. gainNode.gain.setValueAtTime(1.0, 100)
  83. gainNodeR.gain.setValueAtTime(1.0, 100)
  84. }
  85. if (document.readyState == 'loading') {
  86. document.addEventListener('DOMContentLoaded', ready);
  87. } else {
  88. ready();
  89. }
  90. </script>
  91.  
  92. </head>
  93.  
  94. <body>
  95. <div>
  96.  
  97. <button id="bit7" class="buttonGroup8">play</button>
  98.  
  99. </div>
  100.  
  101. </body>
  102.  
  103. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement