Created
August 8, 2017 17:19
-
-
Save gkucmierz/4722566a0917ed205cc939549bda6065 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // gold coin (krugerrand) oscilations generator | |
| let context = new (window.AudioContext || window.webkitAudioContext)(); | |
| [4823, 10852, 18540].map(freq => { | |
| let osc = context.createOscillator(); // instantiate an oscillator | |
| osc.type = 'sine'; // this is the default - also square, sawtooth, triangle | |
| osc.frequency.value = freq; | |
| osc.connect(context.destination); // connect it to the destination | |
| osc.start(); // start the oscillator | |
| osc.stop(context.currentTime + 2); // stop 2 seconds after the current time | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment