Skip to content

Instantly share code, notes, and snippets.

@mohayonao
Created June 26, 2017 22:11
Show Gist options
  • Select an option

  • Save mohayonao/1acede6fcc53add0fbbd986b21767669 to your computer and use it in GitHub Desktop.

Select an option

Save mohayonao/1acede6fcc53add0fbbd986b21767669 to your computer and use it in GitHub Desktop.

Revisions

  1. mohayonao created this gist Jun 26, 2017.
    20 changes: 20 additions & 0 deletions draft.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    import neume, { scapi } from "neume";

    const neu = neume();
    const { mul, SinOsc } = scapi;

    const hello = neu.def("hello", () => {
    const freq = ctl("freq");

    SinOsc(freq)::mul(0.2);
    });

    let synth = { kill: () => {} };

    setInterval(() => {
    synth.kill();

    const freq = (Math.random() * 2 - 1) * 220 + 880;

    synth = hello(neu.currentTime. { freq });
    }, 1000);