Skip to content

Commit

Permalink
Merge branch 'dev' into patterned-tactus
Browse files Browse the repository at this point in the history
  • Loading branch information
yaxu committed Jan 30, 2025
2 parents 4fd06a4 + 7317563 commit a009997
Show file tree
Hide file tree
Showing 1,864 changed files with 3,760 additions and 563,679 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ jobs:
name: cabal ${{ matrix.versions.cabal }} - ghc ${{ matrix.versions.ghc }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: cache ~/.cabal/packages, ~/.cabal/store and dist-newstyle
uses: actions/cache@v4
Expand All @@ -75,4 +77,20 @@ jobs:

- name: test
run: cabal v2-test ${{ matrix.versions.args }} --enable-tests --enable-benchmarks all

ormolu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/run-ormolu@v17
with:
mode: inplace
pattern: |
src/**/*.hs
tidal-link/src/**/*.hs
tidal-parse/src/**/*.hs
tidal-listener/src/**/*.hs
- name: apply ormolu formatting
uses: stefanzweifel/git-auto-commit-action@v4
if: ${{ always() }}
with:
commit_message: automated ormolu reformatting
12 changes: 9 additions & 3 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ jobs:
os: [ubuntu-24.04, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
- name: install nix
uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix build --print-build-logs --no-update-lock-file .#${{ matrix.package }}
- name: clone project
uses: actions/checkout@v4
with:
submodules: recursive
- name: build
# https://github.com/NixOS/nix/issues/9530#issuecomment-2457467802
run: nix build '.?submodules=1#default' --print-build-logs
2 changes: 2 additions & 0 deletions .github/workflows/stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: cache ~/.stack
uses: actions/cache@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
name: cabal ${{ matrix.versions.cabal }} - ghc ${{ matrix.versions.ghc }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: cache ~/.cabal/packages, ~/.cabal/store and dist-newstyle
uses: actions/cache@v4
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "tidal-link/link"]
path = tidal-link/link
url = https://github.com/Ableton/link
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ development workflow, you are very welcome to join the
`#tidal-innards` channel on http://talk.lurk.org/ and ask questions
there.

## Submodules

The tidal-link module depends on submodules `link` and its `asio-standalone` dependency. Within the tidal repository, those submodules can be loaded using `git submodule update --init --recursive` .

# Recommendations to handle forks and branches

In your forked repository: before doing anything,
Expand Down
1 change: 1 addition & 0 deletions Setup.hs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import Distribution.Simple

main = defaultMain
10 changes: 5 additions & 5 deletions bench/Memory/Main.hs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module Main where
module Main where

import Weigh
import Tidal.UIB
import Weigh

main :: IO ()
main =
mainWith $ do
main :: IO ()
main =
mainWith $ do
euclidB
fixB
40 changes: 20 additions & 20 deletions bench/Memory/Tidal/Inputs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

module Tidal.Inputs where

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

Expand All @@ -15,19 +15,19 @@ columns = setColumns [Case, Allocated, Max, Live, GCs]

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

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

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

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

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

catPattSmall :: [Pattern Time]
catPattSmall = pure <$> xs3
Expand Down Expand Up @@ -72,18 +72,18 @@ 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 ( |*| speed "-1" ) (pF "cc67" 1)
$ fix ( (# delaytime 0.125).(# delay 0.5)) (pF "cc68" 1)
$ fix ( # coarse 12) (pF "cc69" 1)
$ s "[808bd:1(3,8), dr(7,8)]"
# pF "cc64" (cF 0 "64")
# pF "cc65" (cF 0 "65")
# pF "cc66" (cF 0 "66")
# pF "cc67" (cF 0 "67")
# pF "cc68" (cF 0 "68")
#  pF "cc69" (cF 0 "69")
fix (# crush 4) (pF "cc65" 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) $
s "[808bd:1(3,8), dr(7,8)]"
# pF "cc64" (cF 0 "64")
# pF "cc65" (cF 0 "65")
# pF "cc66" (cF 0 "66")
# pF "cc67" (cF 0 "67")
# pF "cc68" (cF 0 "68")
# pF "cc69" (cF 0 "69")

{- Euclid inputs -}
ecA1 :: [Pattern Int]
Expand Down
18 changes: 9 additions & 9 deletions bench/Memory/Tidal/UIB.hs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
module Tidal.UIB where
module Tidal.UIB where

import Weigh
import Tidal.Inputs
import Sound.Tidal.Context
import Tidal.Inputs
import Weigh

fixB :: Weigh ()
fixB =
fixB :: Weigh ()
fixB =
wgroup "fix weigh" $ do
columns
func "fix 1" (fix (fast 2) fixArg1) fixArg2

euclidB :: Weigh ()
euclidB =
wgroup "euclid" $ do
columns
euclidB :: Weigh ()
euclidB =
wgroup "euclid" $ do
columns
func "euclid" (euclid (head ecA1) (head $ drop 1 ecA1)) ecA2
func "euclidFull" (euclidFull (head ecA1) (head $ drop 1 ecA1) ecA2) ecA2
func "euclidBool" (_euclidBool 1) 100000
12 changes: 6 additions & 6 deletions bench/Speed/Main.hs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
module Main where

import Criterion.Main
import Tidal.PatternB
import Criterion.Main
import Tidal.CoreB
import Tidal.PatternB
import Tidal.UIB

patternBs :: [IO ()]
patternBs :: [IO ()]
patternBs = defaultMain <$> [withQueryTimeB, withQueryArcB, withResultArcB, withQueryTimeB, subArcB]

coreBs :: [IO ()]
coreBs :: [IO ()]
coreBs = defaultMain <$> [fromListB, stackB, appendB, concatB, _fastB]

uiBs :: [IO ()]
uiBs = defaultMain <$> [euclidB, fixB]

main :: IO ()
main = do
_ <- sequence coreBs
main = do
_ <- sequence coreBs
_ <- sequence patternBs
_ <- sequence uiBs
return ()
82 changes: 46 additions & 36 deletions bench/Speed/Tidal/CoreB.hs
Original file line number Diff line number Diff line change
@@ -1,50 +1,60 @@
module Tidal.CoreB where
module Tidal.CoreB where

import Criterion.Main
import Tidal.Inputs
import Criterion.Main
import Sound.Tidal.Core
import Sound.Tidal.Pattern
import Sound.Tidal.Core
import Tidal.Inputs

_fastB :: [Benchmark]
_fastB =
[ bgroup "_fast" [
bench "_fast < 0" $ whnf (_fast (-2)) pattApp2
, bench "_fast > 0" $ whnf (_fast (toTime $ 10^6)) (cat catPattBig) ]
_fastB =
[ bgroup
"_fast"
[ bench "_fast < 0" $ whnf (_fast (-2)) pattApp2,
bench "_fast > 0" $ whnf (_fast (toTime $ 10 ^ 6)) (cat catPattBig)
]
]

concatB :: [Benchmark]
concatB =
[ bgroup "concat" [
bench "fastCat 10^3" $ whnf fastCat catPattSmall
, bench "fastCat 10^4" $ whnf fastCat catPattMed
, bench "fastCat 10^5" $ whnf fastCat catPattMedB
, bench "fastCat 10^6" $ whnf fastCat catPattBig
, bench "timeCat 10^5" $ whnf timeCat timeCatMed
, bench "timeCat 10^6" $ whnf timeCat timeCatBig ]
concatB :: [Benchmark]
concatB =
[ bgroup
"concat"
[ bench "fastCat 10^3" $ whnf fastCat catPattSmall,
bench "fastCat 10^4" $ whnf fastCat catPattMed,
bench "fastCat 10^5" $ whnf fastCat catPattMedB,
bench "fastCat 10^6" $ whnf fastCat catPattBig,
bench "timeCat 10^5" $ whnf timeCat timeCatMed,
bench "timeCat 10^6" $ whnf timeCat timeCatBig
]
]

fromListB :: [Benchmark]
fromListB =
[ bgroup "fromList" [
bench "fromList" $ whnf fromList xs6
, bench "fromList nf" $ nf fromList xs6
, bench "fastFromList 10^3" $ whnf fastFromList xs3
, bench "fastFromList 10^4" $ whnf fastFromList xs4
, bench "fastFromList 10^5" $ whnf fastFromList xs5
, bench "fastFromList 10^6" $ whnf fastFromList xs6
, bench "fastFromList 10^6 nf" $ nf fastFromList xs6 ]
fromListB =
[ bgroup
"fromList"
[ bench "fromList" $ whnf fromList xs6,
bench "fromList nf" $ nf fromList xs6,
bench "fastFromList 10^3" $ whnf fastFromList xs3,
bench "fastFromList 10^4" $ whnf fastFromList xs4,
bench "fastFromList 10^5" $ whnf fastFromList xs5,
bench "fastFromList 10^6" $ whnf fastFromList xs6,
bench "fastFromList 10^6 nf" $ nf fastFromList xs6
]
]

appendB :: [Benchmark]
appendB =
[ bgroup "append" [
bench "append" $ whnf (append pattApp1) pattApp2
, bench "fastAppend" $ whnf (fastAppend pattApp1) pattApp2 ]
appendB :: [Benchmark]
appendB =
[ bgroup
"append"
[ bench "append" $ whnf (append pattApp1) pattApp2,
bench "fastAppend" $ whnf (fastAppend pattApp1) pattApp2
]
]

stackB :: [Benchmark]
stackB =
[ bgroup "stack" [
bench "overlay" $ whnf (overlay pattApp1) pattApp2
, bench "stack" $ whnf stack catPattBig ]
stackB :: [Benchmark]
stackB =
[ bgroup
"stack"
[ bench "overlay" $ whnf (overlay pattApp1) pattApp2,
bench "stack" $ whnf stack catPattBig
]
]
39 changes: 20 additions & 19 deletions bench/Speed/Tidal/Inputs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@

module Tidal.Inputs where

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

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

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

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

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

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

catPattSmall :: [Pattern Time]
catPattSmall = pure <$> xs3
Expand Down Expand Up @@ -67,18 +67,19 @@ 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 ( |*| speed "-1" ) (pF "cc67" 1)
$ fix ( (# delaytime 0.125).(# delay 0.5)) (pF "cc68" 1)
$ fix ( # coarse 12) (pF "cc69" 1)
$ s "[808bd:1(3,8), dr(7,8)]"
# pF "cc64" (cF 0 "64")
# pF "cc65" (cF 0 "65")
# pF "cc66" (cF 0 "66")
# pF "cc67" (cF 0 "67")
# pF "cc68" (cF 0 "68")
#  pF "cc69" (cF 0 "69")
fix (# crush 4) (pF "cc65" 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) $
s "[808bd:1(3,8), dr(7,8)]"
# pF "cc64" (cF 0 "64")
# pF "cc65" (cF 0 "65")
# pF "cc66" (cF 0 "66")
# pF "cc67" (cF 0 "67")
# pF "cc68" (cF 0 "68")
# pF "cc69" (cF 0 "69")

{- Euclid inputs -}
ecA1 :: [Pattern Int]
Expand Down
Loading

0 comments on commit a009997

Please sign in to comment.