Running .tidal files via command line

Is there a way to run the code in the .tidal file directly from the command line?

Is the same way as executing a Haskell file correct?

Thank you!

If you run ghci -ghci-script BootTidal.hs, you can load BootTidal.hs and start tidal.

If you want to also run Tidal code at startup, simply append the Tidal code after the last line of BootTidal.hs.

The following is an example of BootTidal.hs. Paragraphs should be enclosed in :{ and :}.

:set -fno-warn-orphans
:set -XMultiParamTypeClasses
:set -XOverloadedStrings
:set prompt ""

-- Import all the boot functions and aliases.
import Sound.Tidal.Boot

default (Signal String, Integer, Double)

-- Create a Tidal Stream with the default settings.
-- Use 'mkTidalWith' to customize these settings.
tidalInst <- mkTidal

-- This orphan instance makes the boot aliases work!
-- It has to go after you define 'tidalInst'.
instance Tidally where tidal = tidalInst

-- You can add your own aliases in this file. Here are some examples:
-- :{
-- let xfade i = transition tidal True (Sound.Tidal.Transition.xfadeIn 4) i
--     xfadeIn i t = transition tidal True (Sound.Tidal.Transition.xfadeIn t) i
--     histpan i t = transition tidal True (Sound.Tidal.Transition.histpan t) i
--     wait i t = transition tidal True (Sound.Tidal.Transition.wait t) i
--     waitT i f t = transition tidal True (Sound.Tidal.Transition.waitT f t) i
--     jump i = transition tidal True (Sound.Tidal.Transition.jump) i
--     jumpIn i t = transition tidal True (Sound.Tidal.Transition.jumpIn t) i
--     jumpIn' i t = transition tidal True (Sound.Tidal.Transition.jumpIn' t) i
--     jumpMod i t = transition tidal True (Sound.Tidal.Transition.jumpMod t) i
--     jumpMod' i t p = transition tidal True (Sound.Tidal.Transition.jumpMod' t p) i
--     mortal i lifespan release = transition tidal True (Sound.Tidal.Transition.mortal lifespan release) i
--     interpolate i = transition tidal True (Sound.Tidal.Transition.interpolate) i
--     interpolateIn i t = transition tidal True (Sound.Tidal.Transition.interpolateIn t) i
--     clutch i = transition tidal True (Sound.Tidal.Transition.clutch) i
--     clutchIn i t = transition tidal True (Sound.Tidal.Transition.clutchIn t) i
--     anticipate i = transition tidal True (Sound.Tidal.Transition.anticipate) i
--     anticipateIn i t = transition tidal True (Sound.Tidal.Transition.anticipateIn t) i
--     forId i t = transition tidal False (Sound.Tidal.Transition.mortalOverlay t) i
-- :}

:set -fwarn-orphans
:set prompt "tidal> "
:set prompt-cont ""


-- Add Tidal code

setcps (80/60/4)

:{
d1
  $ s "bd"
  # gain 0.9
  # room 0.3 # sz 0.1
:}

If you want to run it in the background, you can run tmux new-session -d -s tidal-session 'ghci -ghci-script BootTidal.hs'.

If you want to stop it, just run tmux kill-session -t tidal-session.