OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <title>Osc with ExponentialRamp (crbug.com/522229)</title> |
| 5 </head> |
| 6 |
| 7 <body> |
| 8 <p> |
| 9 Test from <a href="crbug.com/522229">crbug.com/522229</a>. This test cann
ot be validated |
| 10 using an offline context because it requires user interaction. |
| 11 </p> |
| 12 <p> |
| 13 Press the start button to start the test and the stop button to stop it. |
| 14 </p> |
| 15 <p> |
| 16 Press any set of keys quickly and listen. At no point should audio ever b
e silent. There |
| 17 should be no glitches either. If either of these happens, this test has f
ailed. |
| 18 </p> |
| 19 <button onclick="startTest()">Start</button> |
| 20 <button onclick="stopTest()">Stop</button> |
| 21 |
| 22 <script> |
| 23 var context = new AudioContext(); |
| 24 var sawosc; |
| 25 |
| 26 function updateOsc(event) { |
| 27 var freq = Math.random() * 440 + 440; |
| 28 sawosc.frequency.exponentialRampToValueAtTime(freq, context.currentTime
+ 0.025); |
| 29 } |
| 30 |
| 31 function startTest() { |
| 32 sawosc = context.createOscillator(); |
| 33 sawosc.type = 'sawtooth'; |
| 34 sawosc.connect(context.destination); |
| 35 window.addEventListener('keydown', updateOsc); |
| 36 sawosc.start(); |
| 37 } |
| 38 |
| 39 function stopTest() { |
| 40 window.removeEventListener('keydown', updateOsc); |
| 41 sawosc.stop(); |
| 42 } |
| 43 </script> |
| 44 </body> |
| 45 </html> |
OLD | NEW |