alert!!! site for the old dublang version 0.5.x, see the latest version here
home - plugins - tutorials - history - manual - design
dublang system contains a plugin with same name called also dublang
this plugin allows to mix on the same code block multiple languages among the supported languages provided by the others plugins
it doesn't connect to any external live coding tool or servive as usually others plugins do
example (combining tidalcycles and mpv)
#!dublang
tidalcycles('d1 $ sound "cp"')
mpv('video mymovie:01')
the code evaluated by "CTRL + e"
is executed by lua 5.1,
it provides access to dublang api itself and also to the neovim
api
any other plugin can be executed by a lua function under the
#!dublang
region
for example the tidalcycles available under the shebang
#!tidalcycles
can be executed through the lua function
tidalcycles()
under the shebang #!dublang
alert! when running plugins this way filters, triggers, etc are not executed
example of functions available: obs()
,
supercollider()
, mpv()
, sm()
,
espeak()
, festival()
, sardine()
,
alda()
, etc
schedule
schedule()
function enqueue a sequence of events to be
executed over time
the sequence starts at the time 1 second and the time is incremented by 1 each second
example
#!dublang
schedule({
[1] = function()
mpv([[clear]])
tidalcycles([[hush]])
end,
[5] = function()
mpv([[loadfile "${PWD}/videos/buzz/slice1.mp4"]])
tidalcycles([[xfadeIn 1 8 $ sound "808bd*8"]])
end,
[10] = function()
mpv([[curves $ pre color_negative]])
tidalcycles([[xfadeIn 1 4 $ sound "[808bd*8, bd*2]"]])
end,
[15] = function()
mpv([[loadfile "${PWD}/videos/buzz/slice4.mp4"]])
tidalcycles([[xfadeIn 1 16 $ sound "[~ ~ jazz:7 jazz:7/2]"]])
end,
})
the example above schedules 4 events to be executed on the time: 1s, 5s, 10s and the final event at the time 15s
see below a demo created with the schedule()
function
(source
code)
cycle
cycle()
executes a list of anonymous functions in a
infinite loop, the loop length is 1 second by default, the list of
functions is spreaded on the loop length
example (the 1st function is executed on time 0 and the 2nd on time 500 ms)
#!dublang
cycle({
function()
vim.notify("run function 1")
end,
function()
vim.notify("run function 2")
end,
})
it is possible to modify the default length of a cycle using the
function length()
demonstration
length
length()
modifies the default cycle length in
milliseconds
example (set the cycle length as 10 seconds)
#!dublang
length(10000)