OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 </head> |
| 5 <body> |
| 6 <h1>AudioWorklet Test</h1> |
| 7 <script> |
| 8 let context; |
| 9 let noise; |
| 10 let onepole; |
| 11 |
| 12 window.audioWorklet.addModule('processors.js').then(() => { |
| 13 context = new AudioContext(); |
| 14 |
| 15 let osc = new OscillatorNode(context); |
| 16 let bypass = new AudioWorkletNode(context, 'bypass'); |
| 17 noise = new AudioWorkletNode(context, 'noise'); |
| 18 onepole = new AudioWorkletNode(context, 'onepole'); |
| 19 |
| 20 // osc.connect(noise); |
| 21 noise.connect(onepole); |
| 22 onepole.connect(context.destination); |
| 23 |
| 24 let noiseGain = noise.parameters.get('gain'); |
| 25 |
| 26 // osc.frequency.value = 5; |
| 27 // osc.type = 'sine'; |
| 28 // osc.connect(noiseGain); |
| 29 |
| 30 noiseGain.setValueAtTime(0, 0); |
| 31 noiseGain.linearRampToValueAtTime(1.0, 4); |
| 32 noiseGain.exponentialRampToValueAtTime(0.001, 8); |
| 33 |
| 34 osc.start(); |
| 35 }); |
| 36 </script> |
| 37 </body> |
| 38 </html> |
OLD | NEW |