Last active
September 24, 2020 21:33
-
-
Save mikesol/c28a01d3bb382d8a9d24dbb636835a21 to your computer and use it in GitHub Desktop.
A forest sound with a drone underneath
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
module Klank.Dev where | |
-- new to purescript? check out https://www.purescript.org/ for learning resources! | |
import Prelude | |
import Data.List ((:), List(..)) | |
import Data.NonEmpty ((:|)) | |
import Data.Typelevel.Num (D1) | |
import FRP.Behavior (Behavior) | |
import FRP.Behavior.Audio (AudioUnit, gain', runInBrowser_, play, sinOsc, speaker) | |
import Math (pi, sin) | |
scene :: Behavior Number -> Behavior (AudioUnit D1) | |
scene _ = | |
pure | |
( speaker | |
$ ( (gain' 0.2 $ sinOsc 110.0) | |
:| (gain' 0.1 $ sinOsc 220.0) | |
: (gain' 0.5 $ (play "forest")) | |
: Nil | |
) | |
) | |
-- change to true if you use `microphone` above | |
enableMicrophone = false | |
-- add a mouse, keyboard or other device here if needed | |
main = runInBrowser_ (pure scene) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment