From 8e90d898d52a3b0b0a033daf932d5a3d0664f865 Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Sun, 2 Jul 2017 21:22:20 +0100 Subject: [PATCH] README has example and link to mailing list --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f35a2699..1e7d7740 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,48 @@ -**Vivid** - *music and sound synthesis in Haskell* +# Vivid - *music and sound synthesis in Haskell* This isn't Vivid's home -- that's at http://vivid-synth.com Some people like to read code on GitHub though, so here we are! -**Please don't submit pull requests here -- discuss on the mailing list** +**Please don't submit pull requests here -- discuss on the [mailing list][list]** + +[list]: http://lurk.org/groups/haskell-art + + +## Example usage: + +```haskell +{-# LANGUAGE DataKinds #-} + +import Vivid + +theSound = sd (0 ::I "note") $ do + wobble <- sinOsc (freq_ 5) ? KR ~* 10 ~+ 10 + s <- 0.1 ~* sinOsc (freq_ $ midiCPS (V::V "note") ~+ wobble) + out 0 [s,s] + +playSong = do + fork $ do + s0 <- synth theSound (36 ::I "note") + wait 1 + free s0 + s1 <- synth theSound (60 ::I "note") + forM_ [62,66,64] $ \note -> do + wait (1/4) + set s1 (note ::I "note") + wait (1/4) + free s1 + +main = do + putStrLn "Simplest:" + playSong + + putStrLn "With precise timing:" + doScheduledIn 0.1 playSong + wait 1 + + putStrLn "Written to a file, non-realtime synthesis:" + putStrLn "(Need to quit the running server for NRT)" + quitSCServer + writeNRT "/tmp/song.wav" playSong +```