tidal 0.3.9 → 0.4
raw patch · 6 files changed
+203/−17 lines, 6 files
Files
- Sound/Tidal/Parse.hs +13/−3
- Sound/Tidal/Pattern.hs +7/−1
- Sound/Tidal/Strategies.hs +0/−5
- Sound/Tidal/Stream.hs +1/−1
- tidal.cabal +1/−1
- tidal.el +181/−6
Sound/Tidal/Parse.hs view
@@ -93,7 +93,7 @@ pSequenceN f = do spaces d <- pDensity ps <- many $ pPart f- return $ (length ps, density d $ cat ps)+ return $ (length ps, density d $ cat $ concat ps) pSequence :: Parser (Pattern a) -> GenParser Char () (Pattern a) pSequence f = do (_, p) <- pSequenceN f@@ -103,10 +103,12 @@ pSingle f = do part <- f pMult part -pPart :: Parser (Pattern a) -> Parser (Pattern a)+pPart :: Parser (Pattern a) -> Parser ([Pattern a]) pPart f = do part <- parens (pSequence f) <|> pSingle f <|> pPolyIn f <|> pPolyOut f spaces- return part+ parts <- pReplicate part+ spaces+ return $ parts pPolyIn :: Parser (Pattern a) -> Parser (Pattern a) pPolyIn f = do ps <- brackets (pSequence f `sepBy` symbol ",")@@ -162,6 +164,14 @@ return $ slow r thing <|> return thing++pReplicate :: Pattern a -> Parser ([Pattern a])+pReplicate thing = do is <- many1 $ do char '!'+ spaces+ return 1+ let i = sum is+ return $ replicate (1 + fromIntegral i) thing+ <|> return [thing] pRatio :: Parser (Rational) pRatio = do n <- natural <?> "numerator"
Sound/Tidal/Pattern.hs view
@@ -198,12 +198,18 @@ -- @(1%16) <~ p@ will return a pattern with all the events moved -- one 16th of a cycle to the left. (<~) :: Time -> Pattern a -> Pattern a-(<~) t p = mapResultTime (+ t) $ mapQueryTime (subtract t) p+(<~) t p = mapResultTime (subtract t) $ mapQueryTime (+ t) p -- | The @~>@ operator does the same as @~>@ but shifts events to the -- right (or clockwise) rather than to the left. (~>) :: Time -> Pattern a -> Pattern a (~>) = (<~) . (0-)++brak :: Pattern a -> Pattern a+brak = every 2 (((1%4) ~>) . (\x -> cat [x, silence]))++iter :: Int -> Pattern a -> Pattern a+iter n p = slowcat $ map (\i -> ((fromIntegral i)%(fromIntegral n)) <~ p) [0 .. n] -- | @rev p@ returns @p@ with the event positions in each cycle -- reversed (or mirrored).
Sound/Tidal/Strategies.hs view
@@ -31,8 +31,6 @@ smash n xs p = slowcat $ map (\n -> slow n p') xs where p' = striate n p -brak = every 2 (((1%4) <~) . (\x -> cat [x, silence]))- -- samples "jvbass [~ latibro] [jvbass [latibro jvbass]]" ((1%2) <~ slow 6 "[1 6 8 7 3]") samples :: Applicative f => f String -> f Int -> f String@@ -88,9 +86,6 @@ trunc' (s,e) = (min s ((sam s) + t), min e ((sam s) + t)) stretch (s,e) = (sam s + ((s - sam s) / t), sam s + ((e - sam s) / t)) -}--iter :: Int -> Pattern a -> Pattern a-iter n p = slowcat $ map (\i -> ((fromIntegral i)%(fromIntegral n)) <~ p) [0 .. n] spin4 step p = stack $ map (\n -> ((toRational n)/4) <~ p |+| pan (pure $ n)) [0,step .. 3]
Sound/Tidal/Stream.hs view
@@ -39,7 +39,7 @@ type OscPattern = Pattern OscMap -latency = 0.04+latency = 0.06 defaultDatum :: Param -> Maybe Datum defaultDatum (S _ (Just x)) = Just $ string x
tidal.cabal view
@@ -1,5 +1,5 @@ name: tidal-version: 0.3.9+version: 0.4 synopsis: Pattern language for improvised music -- description: homepage: http://yaxu.org/tidal/
tidal.el view
@@ -56,9 +56,9 @@ (tidal-see-output)) (tidal-send-string ":set prompt \"\"") (tidal-send-string ":module Sound.Tidal.Context")-; (tidal-send-string ":module Volca.Beat Volca.Key")-; (tidal-send-string "(note, [portamento, expression, voice, octave, detune, vcoegint, cutoff, vcfegint, lforate, lfopitchint, lfocutoffint, attack, decay, sustain, delaytime , delayfeedback], keystop) <- keystart")-; (tidal-send-string "(drum, [clapSpeed, clavesSpeed, agogoSpeed, crashSpeed, stutterTime, stutterDepth, tomDecay, clhatDecay, ophatDecay, hatGrain], beatstop) <- startbeat")+ ;(tidal-send-string ":module Volca.Beat Volca.Key")+ ;(tidal-send-string "(note, [portamento, expression, voice, octave, detune, vcoegint, cutoff, vcfegint, lforate, lfopitchint, lfocutoffint, attack, decay, sustain, delaytime , delayfeedback], keystop) <- keystart")+ ;(tidal-send-string "(drum, [clapSpeed, clavesSpeed, agogoSpeed, crashSpeed, stutterTime, stutterDepth, tomDecay, clhatDecay, ophatDecay, hatGrain], beatstop) <- startbeat") (tidal-send-string "d1 <- dirtStream") (tidal-send-string "d2 <- dirtStream") (tidal-send-string "d3 <- dirtStream")@@ -159,6 +159,144 @@ ) ) +(defun tidal-run-d1 ()+ "Send the first instance of d1 to the interpreter as a single line."+ (interactive)+ (goto-char 0)+ (search-forward "d1" nil nil 1)+ (tidal-run-multiple-lines)+ )++(defun tidal-run-d2 ()+ "Send the d2 to the interpreter as a single line."+ (interactive)+ (goto-char 0)+ (search-forward "d2" nil nil 1)+ (tidal-run-multiple-lines)+ )++(defun tidal-run-d3 ()+ "Send the d3 to the interpreter as a single line."+ (interactive)+ (goto-char 0)+ (search-forward "d3" nil nil 1)+ (tidal-run-multiple-lines)+ )++(defun tidal-run-d4 ()+ "Send the d4 to the interpreter as a single line."+ (interactive)+ (goto-char 0)+ (search-forward "d4" nil nil 1)+ (tidal-run-multiple-lines)+ )+(defun tidal-run-d5 ()+ "Send the d5 to the interpreter as a single line."+ (interactive)+ (goto-char 0)+ (search-forward "d5" nil nil 1)+ (tidal-run-multiple-lines)+ )+(defun tidal-run-d6 ()+ "Send the d6 to the interpreter as a single line."+ (interactive)+ (goto-char 0)+ (search-forward "d6" nil nil 1)+ (tidal-run-multiple-lines)+ )+(defun tidal-run-d7 ()+ "Send the d7 to the interpreter as a single line."+ (interactive)+ (goto-char 0)+ (search-forward "d7" nil nil 1)+ (tidal-run-multiple-lines)+ )+(defun tidal-run-d8 ()+ "Send the d9 to the interpreter as a single line."+ (interactive)+ (goto-char 0)+ (search-forward "d8" nil nil 1)+ (tidal-run-multiple-lines)+ )+(defun tidal-run-d9 ()+ "Send the d9 to the interpreter as a single line."+ (interactive)+ (goto-char 0)+ (search-forward "d9" nil nil 1)+ (tidal-run-multiple-lines)+ )+++(defun tidal-stop-d1 ()+ "send d1 $ silence as a single line"+ (interactive)+ (tidal-send-string ":{")+ (tidal-send-string " mapM_ ($ silence) [d1]")+ (tidal-send-string ":}")+ )++(defun tidal-stop-d2 ()+ "send d1 $ silence as a single line"+ (interactive)+ (tidal-send-string ":{")+ (tidal-send-string " mapM_ ($ silence) [d2]")+ (tidal-send-string ":}")+ )+(defun tidal-stop-d3 ()+ "send d1 $ silence as a single line"+ (interactive)+ (tidal-send-string ":{")+ (tidal-send-string " mapM_ ($ silence) [d3]")+ (tidal-send-string ":}")+ )+++(defun tidal-stop-d4 ()+ "send d1 $ silence as a single line"+ (interactive)+ (tidal-send-string ":{")+ (tidal-send-string " mapM_ ($ silence) [d4]")+ (tidal-send-string ":}")+ )++(defun tidal-stop-d5 ()+ "send d1 $ silence as a single line"+ (interactive)+ (tidal-send-string ":{")+ (tidal-send-string " mapM_ ($ silence) [d5]")+ (tidal-send-string ":}")+ )+(defun tidal-stop-d6 ()+ "send d1 $ silence as a single line"+ (interactive)+ (tidal-send-string ":{")+ (tidal-send-string " mapM_ ($ silence) [d6]")+ (tidal-send-string ":}")+ )++(defun tidal-stop-d7 ()+ "send d1 $ silence as a single line"+ (interactive)+ (tidal-send-string ":{")+ (tidal-send-string " mapM_ ($ silence) [d7]")+ (tidal-send-string ":}")+ )++(defun tidal-stop-d8 ()+ "send d1 $ silence as a single line"+ (interactive)+ (tidal-send-string ":{")+ (tidal-send-string " mapM_ ($ silence) [d8]")+ (tidal-send-string ":}")+ )+(defun tidal-stop-d9 ()+ "send d1 $ silence as a single line"+ (interactive)+ (tidal-send-string ":{")+ (tidal-send-string " mapM_ ($ silence) [d9]")+ (tidal-send-string ":}")+ )+ (defun tidal-run-region () "Place the region in a do block and compile." (interactive)@@ -200,7 +338,25 @@ (define-key map [?\C-c ?\C-l] 'tidal-load-buffer) (define-key map [?\C-c ?\C-i] 'tidal-interrupt-haskell) (define-key map [?\C-c ?\C-m] 'tidal-run-main)- (define-key map [?\C-c ?\C-h] 'tidal-help))+ (define-key map [?\C-c ?\C-h] 'tidal-help)+ (define-key map [?\C-c ?\C-1] 'tidal-run-d1)+ (define-key map [?\C-c ?\C-2] 'tidal-run-d2)+ (define-key map [?\C-c ?\C-3] 'tidal-run-d3)+ (define-key map [?\C-c ?\C-4] 'tidal-run-d4)+ (define-key map [?\C-c ?\C-5] 'tidal-run-d5)+ (define-key map [?\C-c ?\C-6] 'tidal-run-d6)+ (define-key map [?\C-c ?\C-7] 'tidal-run-d7)+ (define-key map [?\C-c ?\C-8] 'tidal-run-d8)+ (define-key map [?\C-c ?\C-9] 'tidal-run-d9)+ (define-key map [?\C-v ?\C-1] 'tidal-stop-d1)+ (define-key map [?\C-v ?\C-2] 'tidal-stop-d2)+ (define-key map [?\C-v ?\C-3] 'tidal-stop-d3)+ (define-key map [?\C-v ?\C-4] 'tidal-stop-d4)+ (define-key map [?\C-v ?\C-5] 'tidal-stop-d5)+ (define-key map [?\C-v ?\C-6] 'tidal-stop-d6)+ (define-key map [?\C-v ?\C-7] 'tidal-stop-d7)+ (define-key map [?\C-v ?\C-8] 'tidal-stop-d8)+ (define-key map [?\C-v ?\C-9] 'tidal-stop-d9)) (defun turn-on-tidal-keybindings () "Haskell Tidal keybindings in the local map."@@ -213,7 +369,25 @@ (local-set-key [?\C-c ?\C-l] 'tidal-load-buffer) (local-set-key [?\C-c ?\C-i] 'tidal-interrupt-haskell) (local-set-key [?\C-c ?\C-m] 'tidal-run-main)- (local-set-key [?\C-c ?\C-h] 'tidal-help))+ (local-set-key [?\C-c ?\C-h] 'tidal-help)+ (local-set-key [?\C-c ?\C-1] 'tidal-run-d1)+ (local-set-key [?\C-c ?\C-2] 'tidal-run-d2)+ (local-set-key [?\C-c ?\C-3] 'tidal-run-d3)+ (local-set-key [?\C-c ?\C-4] 'tidal-run-d4)+ (local-set-key [?\C-c ?\C-5] 'tidal-run-d5)+ (local-set-key [?\C-c ?\C-6] 'tidal-run-d6)+ (local-set-key [?\C-c ?\C-7] 'tidal-run-d7)+ (local-set-key [?\C-c ?\C-8] 'tidal-run-d8)+ (local-set-key [?\C-c ?\C-9] 'tidal-run-d9)+ (local-set-key [?\C-v ?\C-1] 'tidal-stop-d1)+ (local-set-key [?\C-v ?\C-2] 'tidal-stop-d2)+ (local-set-key [?\C-v ?\C-3] 'tidal-stop-d3)+ (local-set-key [?\C-v ?\C-4] 'tidal-stop-d4)+ (local-set-key [?\C-v ?\C-5] 'tidal-stop-d5)+ (local-set-key [?\C-v ?\C-6] 'tidal-stop-d6)+ (local-set-key [?\C-v ?\C-7] 'tidal-stop-d7)+ (local-set-key [?\C-v ?\C-8] 'tidal-stop-d8)+ (local-set-key [?\C-v ?\C-9] 'tidal-stop-d9)) (defun tidal-mode-menu (map) "Haskell Tidal menu."@@ -261,7 +435,8 @@ (turn-on-font-lock)) (add-to-list 'auto-mode-alist '("\\.ltidal$" . literate-tidal-mode))-+;(add-to-list 'load-path "/usr/share/emacs/site-lisp/haskell-mode/") ;required by olig1905 on linux+;(require 'haskell-mode) ;required by olig1905 on linux (define-derived-mode tidal-mode haskell-mode