packages feed

hCsound-0.2: examples/simple.hs

module Main where

import Sound.Csound
import Sound.Csound.Interface (csoundCreate, csoundDestroy, csoundCompile, csoundPerform, CsoundPerformStatus)
import Control.Monad.Error

main :: IO ()
main = (runErrorT $ runCsound "-W -otest.wav test1.csd") >>= reportResult

runCsound :: String -> CsoundMonad ()
runCsound args = do
        ptr <- csoundCreate
        csoundCompile ptr args
        csoundPerform ptr
	csoundDestroy ptr

reportResult :: Either String () -> IO ()
reportResult (Right _) = putStrLn ("Csound Ran! " )
reportResult (Left e) = putStrLn ("csound didn't run... " ++ (show e))