Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tidal-listener install process #861

Merged
merged 4 commits into from
Nov 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,19 @@ jobs:
versions:
- ghc: latest
resolver: nightly
# - ghc: 8.8.4
# resolver: lts-16.31
# - ghc: 8.6.4
# resolver: lts-12.26
name: stack resolver ${{ matrix.versions.resolver }} - ghc ${{ matrix.versions.ghc }}
steps:
- uses: actions/checkout@v2

- name: Set nightly resolver version
run: echo "NIGHTLY_VERSION=$(stack ls snapshots --nightly remote | tail -3 | head -1 | awk '{print $3}')" >> $GITHUB_ENV

- name: cache ~/.stack
uses: actions/cache@v2
with:
path: |
~/.stack
key: stack-${{ runner.os }}-${{ matrix.versions.resolver }}
key: stack-${{ runner.os }}-${{ env.NIGHTLY_VERSION }}

- name: install stack and ghc
uses: haskell/actions/setup@v1
Expand Down
56 changes: 33 additions & 23 deletions bench/Memory/Tidal/Inputs.hs
Original file line number Diff line number Diff line change
@@ -1,38 +1,45 @@
{-# LANGUAGE OverloadedStrings #-}

module Tidal.Inputs where
module Tidal.Inputs where

import Sound.Tidal.Pattern
import Sound.Tidal.Core
import Sound.Tidal.ParseBP
import Sound.Tidal.Core
import Sound.Tidal.ParseBP()
import Sound.Tidal.Params
import Sound.Tidal.Control
import Sound.Tidal.UI
import Weigh
import Weigh

columns :: Weigh ()
columns = setColumns [Case, Allocated, Max, Live, GCs]

{- Pattern inputs -}
xs3 :: [Time]
xs3 = [1..10000]

columns :: Weigh ()
columns = setColumns [Case, Allocated, Max, Live, GCs]
xs4 :: [Time]
xs4 = [1..100000]

{- Pattern inputs -}
xs3 = [1..10^3]
xs4 = [1..10^4]
xs5 = [1..10^5]
xs6 = [1..10^6]
xs5 :: [Time]
xs5 = [1..1000000]

xs6 :: [Time]
xs6 = [1..10000000]

xsA :: [Time]
xsA = [500000..1500000]

catPattSmall :: [Pattern Time]
catPattSmall = pure <$> xs3

catPattMed :: [Pattern Time]
catPattMed = pure <$> xs4
catPattMed = pure <$> xs4

catPattMedB :: [Pattern Time]
catPattMedB = pure <$> xs5

catPattBig :: [Pattern Time]
catPattBig = pure <$> xs6
catPattBig = pure <$> xs6

timeCatMed :: [(Time, Pattern Time)]
timeCatMed = zip xs5 catPattMed
Expand All @@ -41,23 +48,26 @@ timeCatBig :: [(Time, Pattern Time)]
timeCatBig = zip xs6 catPattBig

appendBig :: [Pattern Time]
appendBig = pure <$> xsA
appendBig = pure <$> xsA

pattApp1 :: Pattern [Time]
pattApp1 = sequence catPattBig
pattApp1 = sequence catPattBig

pattApp2 :: Pattern [Time]
pattApp2 = sequence appendBig

{- Arc Inputs -}
arcFunc :: Arc -> Arc
arcFunc (Arc s e) = Arc (s * 2) (e * 4)
arcFunc :: Arc -> Arc
arcFunc (Arc st en) = Arc (st * 2) (en * 4)

wqaMed :: Pattern Time
wqaMed = fromList xs5

wqaMed = fromList xs5
wqaBig :: Pattern Time
wqaBig = fromList xs6

{- fix inputs -}
fixArg1 :: ControlPattern
{- fix inputs -}
fixArg1 :: ControlPattern
fixArg1 = pF "cc64" 1

fixArg2 :: ControlPattern
Expand All @@ -76,8 +86,8 @@ fixArg2 =
#  pF "cc69" (cF 0 "69")

{- Euclid inputs -}
ecA1 :: [Pattern Int]
ecA1 = [1, 10^5]
ecA1 :: [Pattern Int]
ecA1 = [1, 1000000]

ecA2 :: Pattern String
ecA2 :: Pattern String
ecA2 = "x"
48 changes: 27 additions & 21 deletions bench/Speed/Tidal/Inputs.hs
Original file line number Diff line number Diff line change
@@ -1,34 +1,40 @@
{-# LANGUAGE OverloadedStrings #-}

module Tidal.Inputs where
module Tidal.Inputs where

import Sound.Tidal.Pattern
import Sound.Tidal.Core
import Sound.Tidal.ParseBP
import Sound.Tidal.Core
import Sound.Tidal.ParseBP()
import Sound.Tidal.Params
import Sound.Tidal.Control
import Sound.Tidal.UI

{- Pattern inputs -}
xs3 = [1..10^3]
xs4 = [1..10^4]
xs5 = [1..10^5]
xs6 = [1..10^6]
{- Pattern inputs -}
xs3 :: [Time]
xs3 = [1..10000]

xs4 :: [Time]
xs4 = [1..100000]

xs5 :: [Time]
xs5 = [1..1000000]

xs6 :: [Time]
xs6 = [1..10000000]

xsA :: [Time]
xsA = [500000..1500000]

catPattSmall :: [Pattern Time]
catPattSmall = pure <$> xs3

catPattMed :: [Pattern Time]
catPattMed = pure <$> xs4
catPattMed = pure <$> xs4

catPattMedB :: [Pattern Time]
catPattMedB = pure <$> xs5

catPattBig :: [Pattern Time]
catPattBig = pure <$> xs6
catPattBig = pure <$> xs6

timeCatMed :: [(Time, Pattern Time)]
timeCatMed = zip xs5 catPattMed
Expand All @@ -37,32 +43,32 @@ timeCatBig :: [(Time, Pattern Time)]
timeCatBig = zip xs6 catPattBig

appendBig :: [Pattern Time]
appendBig = pure <$> xsA
appendBig = pure <$> xsA

pattApp1 :: Pattern [Time]
pattApp1 = sequence catPattBig
pattApp1 = sequence catPattBig

pattApp2 :: Pattern [Time]
pattApp2 = sequence appendBig

{- Arc Inputs -}
arcFunc :: Arc -> Arc
arcFunc (Arc s e) = Arc (s * 2) (e * 4)
arcFunc :: Arc -> Arc
arcFunc (Arc st en) = Arc (st * 2) (en * 4)

wqaMed :: Pattern Time
wqaMed = fromList xs5
wqaMed = fromList xs5

wqaBig :: Pattern Time
wqaBig = fromList xs6

{- fix inputs -}
fixArg1 :: ControlPattern
{- fix inputs -}
fixArg1 :: ControlPattern
fixArg1 = pF "cc64" 1

fixArg2 :: ControlPattern
fixArg2 =
fix ( # crush 4 ) (pF "cc65" 1)
$ fix ( stut' 4 (0.125/4) ( + up "1" )) (pF "cc66" 1)
-- $ fix ( stut' 4 (0.125/4) ( + up "1" )) (pF "cc66" 1)
$ fix ( |*| speed "-1" ) (pF "cc67" 1)
$ fix ( (# delaytime 0.125).(# delay 0.5)) (pF "cc68" 1)
$ fix ( # coarse 12) (pF "cc69" 1)
Expand All @@ -75,8 +81,8 @@ fixArg2 =
#  pF "cc69" (cF 0 "69")

{- Euclid inputs -}
ecA1 :: [Pattern Int]
ecA1 :: [Pattern Int]
ecA1 = [1, 100]

ecA2 :: Pattern String
ecA2 :: Pattern String
ecA2 = "x"
3 changes: 2 additions & 1 deletion tidal-listener/src/Sound/Tidal/Listener.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module Sound.Tidal.Listener where
import Data.Default (def)

import Sound.Tidal.Stream (Target(..))
import Sound.Tidal.ID
import qualified Sound.Tidal.Context as T
import Sound.Tidal.Hint
import Sound.Tidal.Listener.Config
Expand Down Expand Up @@ -84,7 +85,7 @@ act st (Just (Message "/code" [ASCII_String a_ident, ASCII_String a_code])) =
respond ident r
return st
where respond ident (HintOK pat) =
do T.streamReplace (sStream st) ident pat
do T.streamReplace (sStream st) (ID ident) pat
O.sendTo (sLocal st) (O.p_message "/code/ok" [string ident]) (sRemote st)
respond ident (HintError s) =
O.sendTo (sLocal st) (O.p_message "/code/error" [string ident, string s]) (sRemote st)
Expand Down