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

Update link 1.9 dev #1057

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
533574d
avoid loading stream module in other modules, so hint wont crash
polymorphicengine Jun 16, 2023
477be66
Update tidal.cabal
polymorphicengine Jun 16, 2023
003c6d9
move to StreamTypes
polymorphicengine Jun 17, 2023
5dc643a
Merge pull request #1019 from polymorphicengine/1.9-dev2
yaxu Jun 24, 2023
8d5e789
change streamGetnow to factor in the processAhead and also destroy th…
polymorphicengine Jun 29, 2023
0b45518
Update Stream.hs
polymorphicengine Jun 30, 2023
3b44c5f
Merge pull request #1025 from polymorphicengine/1.9-dev-stremgetnow
yaxu Jul 26, 2023
fe8069f
fix minor7sharp9 chord (the 9th wasn't sharp)
cleary Sep 13, 2023
4f128f0
Merge pull request #1036 from cleary/patch-1
yaxu Sep 14, 2023
cd1fa4f
bump primitive to 0.10 (metadata already updated on hackage)
yaxu Oct 11, 2023
da4cc48
fix outdated dependencies, ref #1044
yaxu Oct 16, 2023
b2161fb
add metatune param
ahihi Oct 26, 2023
6ffb9c4
Merge pull request #1046 from ahihi/metatune-1.9
yaxu Oct 27, 2023
8e55a88
Fix nix build for Tidal 2.0 (include hosc 0.20). Update nixpkgs input.
mitchmindtree Jun 28, 2023
f878aad
Fix tidal-listener build options, and add it to the stack build too.
Jun 23, 2023
3179c11
Bump action versions in workflows for nix-build and build-listener-wi…
Jun 23, 2023
aab0ff2
Don't build dynamic libraries for tidal-listener on Windows.
Jun 26, 2023
ed32bc5
Lower bounds for criterion for benchmarks
yaxu Dec 2, 2023
5d20eec
Merge pull request #1052 from mindofmatthew/1.9-build-fixes
yaxu Dec 2, 2023
3a6a064
update to latest link library
yaxu Dec 15, 2023
194d5d2
bump
yaxu Dec 15, 2023
47c167d
bump tidal-link dependency
yaxu Dec 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/listener-build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@v2

- name: Setup Haskell
uses: haskell/actions/setup@v1
uses: haskell/actions/setup@v2
id: setup-haskell-cabal
with:
ghc-version: ${{ matrix.ghc }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v16
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix fmt -- --check ./
Expand All @@ -36,7 +36,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v16
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix build --print-build-logs --no-update-lock-file .#${{ matrix.package }}
1 change: 1 addition & 0 deletions bin/generate-params.hs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ genericParams = [
("f", "loop", "loops the sample (from `begin` to `end`) the specified number of times."),
("f", "lophat", ""),
("f", "lsnare", ""),
("f", "metatune", "A pattern of numbers. Specifies whether the pitch of played samples should be tuned relative to their pitch metadata, if it exists. When set to 1, pitch metadata is applied. When set to 0, pitch metadata is ignored."),
("note", "n", "The note or sample number to choose for a synth or sampleset"),
("note", "note", "The note or pitch to play a sound or synth with"),
("f", "degree", ""),
Expand Down
48 changes: 42 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@
inputs = {
utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# Temporarily add `hosc` at the latest v0.20 commit
# (nixpkgs currently only has 0.19.1).
# See this comment for details:
# https://github.com/tidalcycles/Tidal/pull/1022#issuecomment-1610978403
hosc = {
url = "github:rd--/hosc?rev=e77aa67cd0b99a32498fef246a687ba443c9b4be";
flake = false;
};
};

outputs = inputs: let
Expand All @@ -38,6 +46,7 @@

mkPackages = pkgs: let
project = pkgs.haskellPackages.extend (pkgs.haskell.lib.compose.packageSourceOverrides {
hosc = inputs.hosc; # Remove once `hosc` is at 0.20 in nixpkgs.
tidal = ./.;
tidal-link = ./tidal-link;
tidal-listener = ./tidal-listener;
Expand Down
2 changes: 1 addition & 1 deletion src/Sound/Tidal/Chords.hs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ minor7sharp5 = [0,3,8,10]
minor7flat9 :: Num a => [a]
minor7flat9 = [0,3,7,10,13]
minor7sharp9 :: Num a => [a]
minor7sharp9 = [0,3,7,10,14]
minor7sharp9 = [0,3,7,10,15]
diminished7 :: Num a => [a]
diminished7 = [0,3,6,9]
minor9 :: Num a => [a]
Expand Down
8 changes: 4 additions & 4 deletions src/Sound/Tidal/Control.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import Data.Ratio

import Sound.Tidal.Pattern
import Sound.Tidal.Core
import Sound.Tidal.Stream (patternTimeID)
import Sound.Tidal.StreamTypes (patternTimeID)
import Sound.Tidal.UI
import qualified Sound.Tidal.Params as P
import Sound.Tidal.Utils
Expand Down Expand Up @@ -422,16 +422,16 @@ trigger = triggerWith id
-- | (Alias @__qt__@) Quantise trigger. Aligns the start of the pattern
-- with the next cycle boundary. For example, this pattern will fade in
-- starting with the next cycle after the pattern is evaluated:
--
--
-- @
-- d1 $ qtrigger $ s "hh(5, 8)" # amp envL
-- @
--
--
-- Note that the pattern will start playing immediately. The /start/ of the
-- pattern aligns with the next cycle boundary, but events will play before
-- if the pattern has events at negative timestamps (which most loops do).
-- These events can be filtered out, for example:
--
--
-- @
-- d1 $ qtrigger $ filterWhen (>= 0) $ s "hh(5, 8)"
-- @
Expand Down
15 changes: 15 additions & 0 deletions src/Sound/Tidal/Params.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1630,6 +1630,21 @@ lsnarebus busid pat = (pF "lsnare" pat) # (pI "^lsnare" busid)
lsnarerecv :: Pattern Int -> ControlPattern
lsnarerecv busid = pI "^lsnare" busid

-- | A pattern of numbers. Specifies whether the pitch of played samples should be tuned relative to their pitch metadata, if it exists. When set to 1, pitch metadata is applied. When set to 0, pitch metadata is ignored.
metatune :: Pattern Double -> ControlPattern
metatune = pF "metatune"
metatuneTake :: String -> [Double] -> ControlPattern
metatuneTake name xs = pStateListF "metatune" name xs
metatuneCount :: String -> ControlPattern
metatuneCount name = pStateF "metatune" name (maybe 0 (+1))
metatuneCountTo :: String -> Pattern Double -> Pattern ValueMap
metatuneCountTo name ipat = innerJoin $ (\i -> pStateF "metatune" name (maybe 0 ((`mod'` i) . (+1)))) <$> ipat

metatunebus :: Pattern Int -> Pattern Double -> ControlPattern
metatunebus busid pat = (pF "metatune" pat) # (pI "^metatune" busid)
metatunerecv :: Pattern Int -> ControlPattern
metatunerecv busid = pI "^metatune" busid

-- |
midibend :: Pattern Double -> ControlPattern
midibend = pF "midibend"
Expand Down
31 changes: 21 additions & 10 deletions src/Sound/Tidal/Stream.hs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
-- Spawns a thread within Tempo that acts as the clock
-- Spawns a thread that listens to and acts on OSC control messages
startStream :: Config -> [(Target, [OSC])] -> IO Stream
startStream config oscmap
startStream config oscmap
= do sMapMV <- newMVar Map.empty
pMapMV <- newMVar Map.empty
bussesMV <- newMVar []
Expand All @@ -219,7 +219,7 @@
u <- O.udp_socket (\sock sockaddr -> do N.setSocketOption sock N.Broadcast broadcast
N.connect sock sockaddr
) (oAddress target) (oPort target)
return $ Cx {cxUDP = u, cxAddr = remote_addr, cxBusAddr = remote_bus_addr, cxTarget = target, cxOSCs = os}
return $ Cx {cxUDP = u, cxAddr = remote_addr, cxBusAddr = remote_bus_addr, cxTarget = target, cxOSCs = os}
) oscmap
let bpm = (coerce defaultCps) * 60 * (cBeatsPerCycle config)
abletonLink <- Link.create bpm
Expand Down Expand Up @@ -249,7 +249,7 @@
sendHandshakes :: Stream -> IO ()
sendHandshakes stream = mapM_ sendHandshake $ filter (oHandshake . cxTarget) (sCxs stream)
where sendHandshake cx = if (isJust $ sListen stream)
then
then
do -- send it _from_ the udp socket we're listening to, so the
-- replies go back there
sendO False (sListen stream) cx $ O.Message "/dirt/handshake" []
Expand Down Expand Up @@ -290,7 +290,7 @@
toDatum (VB False) = O.int32 (0 :: Int)
toDatum (VX xs) = O.Blob $ O.blob_pack xs
toDatum _ = error "toDatum: unhandled value"

toData :: OSC -> Event ValueMap -> Maybe [O.Datum]
toData (OSC {args = ArgList as}) e = fmap (fmap (toDatum)) $ sequence $ map (\(n,v) -> Map.lookup n (value e) <|> v) as
toData (OSC {args = Named rqrd}) e
Expand Down Expand Up @@ -355,14 +355,14 @@
-- (but perhaps we should explicitly crash with an error message if it contains something else?).
-- Map.mapKeys tail is used to remove ^ from the keys.
-- In case (value e) has the key "", we will get a crash here.
playmap' = Map.union (Map.mapKeys tail $ Map.map (\(VI i) -> VS ('c':(show $ toBus i))) busmap) playmap

Check warning on line 358 in src/Sound/Tidal/Stream.hs

View workflow job for this annotation

GitHub Actions / cabal 3.8.1.0 - ghc 9.4.1

Pattern match(es) are non-exhaustive

Check warning on line 358 in src/Sound/Tidal/Stream.hs

View workflow job for this annotation

GitHub Actions / cabal latest - ghc latest

Pattern match(es) are non-exhaustive

Check warning on line 358 in src/Sound/Tidal/Stream.hs

View workflow job for this annotation

GitHub Actions / cabal 3.8.1.0 - ghc 9.4.1

Pattern match(es) are non-exhaustive

Check warning on line 358 in src/Sound/Tidal/Stream.hs

View workflow job for this annotation

GitHub Actions / cabal latest - ghc latest

Pattern match(es) are non-exhaustive
val = value . peEvent
-- Only events that start within the current nowArc are included
playmsg | peHasOnset pe = do
-- If there is already cps in the event, the union will preserve that.
let extra = Map.fromList [("cps", (VF (coerce $! peCps pe))),
("delta", VF (T.addMicrosToOsc (peDelta pe) 0)),
("cycle", VF (fromRational (peCycle pe)))
("cycle", VF (fromRational (peCycle pe)))
]
addExtra = Map.union playmap' extra
ts = (peOnWholeOrPartOsc pe) + nudge -- + latency
Expand All @@ -376,7 +376,7 @@
toBus n | null busses = n
| otherwise = busses !!! n
busmsgs = map
(\(('^':k), (VI b)) -> do v <- Map.lookup k playmap

Check warning on line 379 in src/Sound/Tidal/Stream.hs

View workflow job for this annotation

GitHub Actions / cabal 3.8.1.0 - ghc 9.4.1

Pattern match(es) are non-exhaustive

Check warning on line 379 in src/Sound/Tidal/Stream.hs

View workflow job for this annotation

GitHub Actions / cabal latest - ghc latest

Pattern match(es) are non-exhaustive

Check warning on line 379 in src/Sound/Tidal/Stream.hs

View workflow job for this annotation

GitHub Actions / cabal 3.8.1.0 - ghc 9.4.1

Pattern match(es) are non-exhaustive

Check warning on line 379 in src/Sound/Tidal/Stream.hs

View workflow job for this annotation

GitHub Actions / cabal latest - ghc latest

Pattern match(es) are non-exhaustive
return $ (tsPart,
True, -- bus message ?
O.Message "/c_set" [O.int32 b, toDatum v]
Expand All @@ -399,8 +399,6 @@
ident = fromMaybe "unknown" $ Map.lookup "_id_" (value $ peEvent pe) >>= getS
ts = (peOnWholeOrPartOsc pe) + nudge -- + latency

patternTimeID :: String
patternTimeID = "_t_pattern"

-- Used for Tempo callback
updatePattern :: Stream -> ID -> Time -> ControlPattern -> IO ()
Expand Down Expand Up @@ -431,7 +429,7 @@
onPart <- (T.timeAtBeat ops) partStartBeat
when (eventHasOnset e) (do
let cps' = Map.lookup "cps" (value e) >>= getF
maybe (return ()) (\newCps -> (T.setTempo ops) ((T.cyclesToBeat ops) (newCps * 60)) on) $ coerce cps'
maybe (return ()) (\newCps -> (T.setTempo ops) ((T.cyclesToBeat ops) (newCps * 60)) on) $ coerce cps'
)
off <- (T.timeAtBeat ops) offBeat
bpm <- (T.getTempo ops)
Expand Down Expand Up @@ -491,7 +489,7 @@
-- If an exception occurs during sending,
-- this functions prints a warning and continues, because
-- the likely reason is that the backend (supercollider) isn't running.
--
--
-- If any exception occurs before or outside sending
-- (e.g., while querying the pattern, while computing a message),
-- this function prints a warning and resets the current pattern
Expand Down Expand Up @@ -691,7 +689,7 @@
-- Only report the first time..
when (null prev) $ verbose c $ "Connected to SuperDirt."
return ()
where
where
bufferIndices [] = []
bufferIndices (x:xs') | x == (O.AsciiString $ O.ascii "&controlBusIndices") = catMaybes $ takeWhile isJust $ map O.datum_integral xs'
| otherwise = bufferIndices xs'
Expand Down Expand Up @@ -745,6 +743,7 @@
let config = sConfig s
ss <- Link.createAndCaptureAppSessionState (sLink s)
bpm <- Link.getTempo ss
Link.destroySessionState ss
return $! coerce $ bpm / (cBeatsPerCycle config) / 60

streamGetnow :: Stream -> IO Double
Expand All @@ -753,4 +752,16 @@
ss <- Link.createAndCaptureAppSessionState (sLink s)
now <- Link.clock (sLink s)
beat <- Link.beatAtTime ss now (cQuantum config)
Link.destroySessionState ss
return $! coerce $ beat / (cBeatsPerCycle config)

getProcessAhead :: Stream -> Link.Micros
getProcessAhead str = round $ (cProcessAhead $ sConfig str) * 100000

streamGetAhead :: Stream -> IO Double
streamGetAhead str = do
ss <- Link.createAndCaptureAppSessionState (sLink str)
now <- Link.clock (sLink str)
beat <- Link.beatAtTime ss (now + (getProcessAhead str)) (cQuantum $! sConfig str)
Link.destroySessionState ss
return $ coerce $! beat / (cBeatsPerCycle $! sConfig str)
3 changes: 3 additions & 0 deletions src/Sound/Tidal/StreamTypes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ data TickState = TickState {
tickNudge :: Double
}
deriving Show

patternTimeID :: String
patternTimeID = "_t_pattern"
1 change: 1 addition & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ resolver: lts-20.5
packages:
- '.'
- 'tidal-parse'
- 'tidal-listener'
- 'tidal-link'

extra-deps:
Expand Down
25 changes: 8 additions & 17 deletions tidal-link/link/.appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ environment:
- APPVEYOR_BUILD_WORKER_IMAGE: macos-catalina
CONFIGURATION: Release
XCODE_VERSION: 11.7
- APPVEYOR_BUILD_WORKER_IMAGE: macos-catalina
- APPVEYOR_BUILD_WORKER_IMAGE: macos-bigsur
CONFIGURATION: Debug
XCODE_VERSION: 12.3
XCODE_VERSION: 12.5.1
- APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey
CONFIGURATION: Release
XCODE_VERSION: 12.5.1
XCODE_VERSION: 13.4.1
- APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey
CONFIGURATION: Release
XCODE_VERSION: 13.2.1
XCODE_VERSION: 14.1
- APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004
AUDIO_DRIVER: Jack
CONFIGURATION: Debug
Expand Down Expand Up @@ -52,20 +52,10 @@ environment:
GENERATOR: Ninja
CXX: g++-7
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
AUDIO_DRIVER: Asio
THREAD_DESCRIPTION: OFF
CONFIGURATION: Release
GENERATOR: Visual Studio 14 2015
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
AUDIO_DRIVER: Asio
AUDIO_DRIVER: Wasapi
THREAD_DESCRIPTION: OFF
CONFIGURATION: Debug
GENERATOR: Visual Studio 14 2015 Win64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
AUDIO_DRIVER: Asio
THREAD_DESCRIPTION: OFF
CONFIGURATION: Release
GENERATOR: Visual Studio 14 2015 Win64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
AUDIO_DRIVER: Wasapi
THREAD_DESCRIPTION: OFF
Expand All @@ -88,7 +78,7 @@ environment:
GENERATOR: Visual Studio 17 2022
- APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004
ESP_IDF: true
IDF_RELEASE: v4.3.1
IDF_RELEASE: v5.1.1
- APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004
FORMATTING: true

Expand All @@ -100,6 +90,7 @@ for:
only:
- APPVEYOR_BUILD_WORKER_IMAGE: macos-mojave
- APPVEYOR_BUILD_WORKER_IMAGE: macos-catalina
- APPVEYOR_BUILD_WORKER_IMAGE: macos-bigsur
- APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey
build_script:
- sudo xcode-select -s /Applications/Xcode-$XCODE_VERSION.app
Expand All @@ -114,7 +105,6 @@ for:
- GENERATOR: Ninja
install:
- git submodule update --init --recursive
- sudo apt-get update
- sudo apt-get install -y libjack-dev portaudio19-dev valgrind
build_script:
- python3 ci/configure.py --audio-driver $AUDIO_DRIVER --generator "$GENERATOR" --configuration $CONFIGURATION
Expand All @@ -129,6 +119,7 @@ for:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
build_script:
- py -3 -m pip install setuptools
- py -3 ci/configure.py --audio-driver %AUDIO_DRIVER% --thread-description %THREAD_DESCRIPTION% --generator "%GENERATOR%" --flags="-DCMAKE_SYSTEM_VERSION=10.0.18362.0"
- py -3 ci/build.py --configuration %CONFIGURATION%
test_script:
Expand Down
Binary file added tidal-link/link/Ableton Link Guidelines.pdf
Binary file not shown.
5 changes: 5 additions & 0 deletions tidal-link/link/AbletonLinkConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|kFreeBSD|GNU")
INTERFACE_COMPILE_DEFINITIONS
LINK_PLATFORM_LINUX=1
)
set_property(TARGET Ableton::Link APPEND PROPERTY
INTERFACE_LINK_LIBRARIES
atomic
pthread
)
endif()

include(${CMAKE_CURRENT_LIST_DIR}/cmake_include/AsioStandaloneConfig.cmake)
Expand Down
Loading
Loading