Skip to content
/ vivid Public
forked from vivid-synth/vivid

Music and sound synthesis in Haskell!

Notifications You must be signed in to change notification settings

w14/vivid

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vivid - music and sound synthesis in Haskell

Introductory video: https://www.youtube.com/watch?v=xo3zUvPsizo

Listen to examples at: http://vivid-synth.com

Haskell package: https://hackage.haskell.org/package/vivid

Example usage:

{-# 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

Installation

cabal install vivid

About

Music and sound synthesis in Haskell!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Haskell 100.0%