hi,
i've been performing with Tidal in Emacs and found tidal.el very nice to work with. binding shortcut keys to the tidal-run-dN
/tidal-stop-dN
functions allows for a great workflow that saves me a lot of navigation and typing.
however, in my tunes i often want to have multiple variations of e.g. d1
which i can switch between. in this case tidal-run-d1
feels a bit limiting as it can only run the first d1
block in my file. so i extended the code a bit
this enables using Emacs' prefix argument to provide tidal-run-dN
with an instance number that selects between multiple dN
blocks with the same N
. for example, running tidal-run-d3
with instance number 2
would run the second d3
pattern found in the file. the instance number is also registered in a buffer-local variable tidal-d-instances
, so that if tidal-run-dN
is run again without a prefix argument, it will use the registered instance number (defaulting to 1
). furthermore, when tidal-run-multiple-lines
is used to run the code block under the cursor, it will check whether that block is a dN
block, and if so, automatically detect its instance number and register it.
i got a bit excited about prefix arguments so i also gave tidal-stop-dN
one. with a prefix argument greater than zero, tidal-stop-dN
will fade out the dN
pattern over the given amount of cycles instead of stopping immediately.
what does the workflow actually look like? for starters, i prefer to use these keybindings (on Mac) in favor of the default ones:
(define-key tidal-mode-map (kbd "<M-return>") 'tidal-run-multiple-lines)
(define-key tidal-mode-map (kbd "s-1") 'tidal-run-d1)
(define-key tidal-mode-map (kbd "s-2") 'tidal-run-d2)
(define-key tidal-mode-map (kbd "s-3") 'tidal-run-d3)
(define-key tidal-mode-map (kbd "s-4") 'tidal-run-d4)
(define-key tidal-mode-map (kbd "s-5") 'tidal-run-d5)
(define-key tidal-mode-map (kbd "s-6") 'tidal-run-d6)
(define-key tidal-mode-map (kbd "s-7") 'tidal-run-d7)
(define-key tidal-mode-map (kbd "s-8") 'tidal-run-d8)
(define-key tidal-mode-map (kbd "s-9") 'tidal-run-d9)
(define-key tidal-mode-map (kbd "s-0") 'tidal-run-d10)
(define-key tidal-mode-map (kbd "C-s-1") 'tidal-stop-d1)
(define-key tidal-mode-map (kbd "C-s-2") 'tidal-stop-d2)
(define-key tidal-mode-map (kbd "C-s-3") 'tidal-stop-d3)
(define-key tidal-mode-map (kbd "C-s-4") 'tidal-stop-d4)
(define-key tidal-mode-map (kbd "C-s-5") 'tidal-stop-d5)
(define-key tidal-mode-map (kbd "C-s-6") 'tidal-stop-d6)
(define-key tidal-mode-map (kbd "C-s-7") 'tidal-stop-d7)
(define-key tidal-mode-map (kbd "C-s-8") 'tidal-stop-d8)
(define-key tidal-mode-map (kbd "C-s-9") 'tidal-stop-d9)
(define-key tidal-mode-map (kbd "C-s-0") 'tidal-stop-d10)
now, with Emacs' default keybinding M-<number>
to specify the prefix argument, i can do things like:
-
M-2 s-3
to run the secondd3
instance -
M-4 C-s-1
to fade outd1
over 4 cycles
if my cursor is on e.g. the third d1
pattern in the file, i can:
-
M-return
to start it -
C-s-1
to stop it - go work on some other patterns
-
s-1
to restart the samed1
pattern
for me this is a major ergonomics boost. i'm sure it won't fit everyone's workflow but maybe someone will find it useful! let me know what you think.