// // You can find the Dittytoy API Reference here: https://Dittytoy.net/syntax // Example ditties can be found here: https://dittytoy.net/user/Dittytoy // // Most of your ditty will run 44100 times per second using javascript in the browser. // Make sure you optimize your ditty to work well on as many devices as possible. To do that, try to limit // the number of simultaneously active synths: make sure they don't last longer than necessary, or you can // hear them, and spread them over different loops (each loop runs in a separate worker). // ditty.bpm = 120; loop( () => { for (let i=0; i<4; i++) { sine.play(c2, { attack: 0.01, release: 0.25, duration: 5, pan: Math.random() * 2 - 1, amp: 1.0 }); sleep( 0.25 ); } sine.play(c4, { attack: 0.01, release: 0.25, duration: 5 }); // attack and release in seconds, duration in ticks sleep(0.5); // sleep in ticks sine.play(c3, { attack: 0.01, release: 0.75, duration: 5 }); sleep(0.5); sine.play(c5, { attack: 0.01, release: 0.75, duration: 5 }); sleep(0.2); }, { name: 'wth' }); loop( () => { for (let i=0; i<4; i++) { sine.play(c9, { attack: 0.01, release: 0.25, duration: 5, pan: Math.random() * 2 - 1, amp: 1.0 }); sleep( 0.25 ); } sine.play(c5, { attack: 0.01, release: 0.25, duration: 5 }); // attack and release in seconds, duration in ticks sleep(0.5); // sleep in ticks sine.play(c3, { attack: 0.01, release: 0.75, duration: 5 }); sleep(0.5); sine.play(c4, { attack: 0.01, release: 0.75, duration: 5 }); sleep(0.2); }, { name: 'wth2' });