monome / bowery Goto Github PK
View Code? Open in Web Editor NEWdruid script collection
druid script collection
When attempting to run clockdiv.lua
, I am getting this error on any voltage change at input 2:
> r clockdiv.lua
running clockdiv.lua
^^pub("_clear")Running: clock divider
bad argument #2 to 'clock_schedule_sync' (number expected, got nil)
stack traceback:
[C]: in function 'clock_schedule_sync'
?: in function 'clock_resume_handler'
?: in field 'run'
?: in method 'clock'
userscript:26: in function 'init'
^^ready()
I spent some time debugging - as far as I can tell, what is causing the error for me is that windows[win_ix][n]
within the newdiv()
function is undefined/nil.
I was able to get the script to work by replacing windows[win_ix][n]
with public["win" .. win_ix][n]
, but that feels hacky to me:
--- clock divider
-- in1: clock input
-- in2: division selector (see divs)
-- out1-4: divided outputs
function newdiv()
for n=1,4 do
output[n].clock_div = public["win" .. win_ix][n] -- this is the changed line!
end
end
-- choose your clock divisions
windows = {
public{win1 = {5, 7, 11, 13}}:action(newdiv),
public{win2 = {3, 5, 7 , 11}}:action(newdiv),
public{win3 = {2, 3, 5 , 7 }}:action(newdiv),
public{win4 = {2, 4, 8 , 16}}:action(newdiv),
public{win5 = {4, 8, 16, 32}}:action(newdiv),
}
win_ix = 3
function init()
input[1].mode('clock',1/4)
input[2].mode('window', {-3,-1,1,3})
for n=1,4 do
output[n]:clock(public.win3[n])
end
end
input[2].window = function(win, dir)
win_ix = win
newdiv(windows[win])
end
can anyone else reproduce this / what is the correct way to fix it?
Link to "druid" on https://github.com/monome/bowery is broken (404).
within the update_speeds
function, I am seeing freq
remain a static value (7.389056
, which is equal to math.exp(2)
) no matter what voltage is present at input 1.
I think this is due to some issue with line 21. math.exp()
seems to expect one argument according to the Lua docs I am seeing (example) and replit.com. the second argument is being ignored in the current script.
maybe this should be using a different math
function?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.