Skip to content

Instantly share code, notes, and snippets.

@kindohm
Created April 23, 2014 13:37
Show Gist options
  • Save kindohm/11215494 to your computer and use it in GitHub Desktop.
Save kindohm/11215494 to your computer and use it in GitHub Desktop.
Python and Haskell code for recording a 1-min Tidal loop
{-# LANGUAGE OverloadedStrings #-}
module Play where
import Control.Applicative
import Control.Concurrent
import Control.Monad
import Data.List
import Data.Ratio
import Sound.Tidal.Dirt
import Sound.Tidal.Parse
import Sound.Tidal.Pattern
import Sound.Tidal.Stream
import Sound.Tidal.Strategies
import Sound.Tidal.Tempo
delay = 60
main :: IO ()
main = do dirt <- dirtstream "dirt"
dirt $ code
threadDelay $ delay * 1000000
#!/usr/bin/python
import sys
import os
code = raw_input('tidal> ')
fin = open('Play.hs', 'r')
fout = open('Code.hs', 'w')
header = fin.read()
fout.write(header)
fout.write("\n\n");
fout.write("code = " + code + "\n")
fin.close()
fout.close()
os.system("ecasound -t:62 -i jack,dirt -o cycle.wav &")
os.system("runhaskell Code.hs")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment