ah cool, i didn’t know if # would work with arrays! i’ll give that a shot for sure.

good call! i’ll have to try that and give it an optional parameter, then i assume i could call it from druid and assign new values as well!

ooo yeah yeah yeah cool!

ive been entertaining this idea lately, has anyone experimented with crow and vcv rack? vcv has cv to midi meanwhile crow has midi to cv. has anyone messed with this combination ?

1 Like

just realized drum_loop is a callback event for metro, so you cant add additional params to it actually. There are ways around this but it might not be necessary anyway…

@crim Lua is actually super flexible here & i believe you can add as many function args as you want (if you call it yourself), but when called from the metro callback it will just be a nil value.

yes I more just meant you can’t do something like this clock = metro.init{ event = drum_loop } if you want to pass additional args to the callback. you could however do

function createMetroCallback(additionalParam)
  return function(count)
    -- do something with additionalParam 
  end
end 

clock = metro.init{ event = createMetroCallback('hooray') }

That might not be necessary in this case though and just make things harder to read, idk

Because crow script are so short i typically just use global variables to do this kind of thing. It breaks my FP-heart every time…

6 Likes

the problem with a global variable in this case is that i’m shifting the bits of the value at the index of my array in each iteration of the loop. maybe i could shift the value by x where x is the index and do my modulus on that instead of assigning it back to my variable.

it’s usually applied in the visual domain, but Perlin Noise can make some complex modulations & can be looped, by plotting a circle through the noise field.

That said, a slewed S&H could provide similar (non-looped) results & leads me to think slew rate as a ratio derived from sample rate / time (less slew at faster rates) could also be a good exercise.

1 Like

Just spitballing some ideas, but is it possible to develop an app that can run Druid and send Lua scrips over a wireless or Bluetooth dongle? It’d be cool to store some scripts on my phone and just upload or run them without dragging out a computer.

2 Likes

Really simple utility use case that would save me $50-100 and ~2-4hp in a dedicated module that would do this…

CV Source / DC Offset
Input 1: Offset (range: -5 to +5v)
Input 2: Offset (range: -5 to +5v)
Output 1: constant voltage output with Input 1 offset applied
Output 2: same, but inverted
Output 3: constant voltage output with Input 2 offset applied
Output 4: same, but inverted

What determines the constant voltage that the offset is added to/how would you interact with that voltage? If you just want it to be a variable set by the script, you could set up the script in 4 lines.

Yep, I’m imagining the constant voltage as a variable set by the script so I could suit it to my needs for a given patch. What would those 4 lines look like?

typing on my phone but this should do the trick!

-- these voltages are the constant voltages
voltageA = 0
voltageB = 0

-- stream handler for in 1
input[1].stream = function(cv) 
    output[1].volts = voltageA + cv
    output[2].volts = -(voltageA + cv)
end

-- stream handler for in 2
input[2].stream = function(cv) 
    output[3].volts = voltageB + cv
    output[4].volts = -(voltageB + cv)
end

function init()
    -- tells crow to execute in 1's stream handler once every 10ms
    input[1].mode('stream',0.01)

    -- tells crow to execute in 2's stream handler once every 10ms
    input[2].mode('stream',0.01)
end

edit: annotated it for your convenience

12 Likes

Awesome… will experiment with this, thanks!

@voidstar This script works great! thanks! I’m astounded by how simple and clear the code is. it’s essentially a user-tweakable version of what I primarily used Channels 2 and 3 of Maths for when I had one, with CV input rather than manual knobs.

I tweaked it a bit so that it converts two of 16n Faderbank’s faders’ positive outputs (0 to +5v) to bipolar outputs (-5 to +5v), i.e.:

voltageA = -5
output[1].volts = voltageA + (cv * 2)

so when the fader’s at lowest value, output 1 produces -5v. When the fader’s in the middle, output 1 produces 0v. When the fader’s at highest value, output 1 produces +5v. Very useful! Will likely be my default Crow script when I’m not putting it to any other specific purpose, I imagine it’ll get heavy use.

4 Likes

I tried to give this a go by hacking some scripts like the shiftregister and sequential switch but I’m just not getting it at this point so I thought I’d put it out there for anyone that’s up to it.

SHIFTY CROW

It’s based off the intellijel shifty hocketing mode and would let you play Just friends synth mode as an oscillator via i2c.
Voices would do a round robin effects like in Rings which allows for longer release times to overlap giving you get a 6 voice sudo poly effect from a single cv/gate input like a channel from kria.

Crow input 1 - cv in
Crow input 2 - gate in

Every gate triggered will trigger a new jf voice and assigned the pitch cv to the new voice.

To make use of crows outs it would be nice to have the gate in sent sequentially to each outs giving you essentially a little clock divider. But that’s not the main idea. First things first let’s get jf to run as a poly synth via crow.
Anyone out there that could give this a shot?

1 Like

You do not need shift registers or anything.

The ii.jf.play_note(<volt/octave pitch>, <peak-to-peak voltage>) command will automatically assign each note to the next voice.

So your whole script could be:


input[1].change = function(s)
    ii.jf.play_note(input[2].volts,5)
end

function init()
    ii.pullup(true)
    ii.jf.mode(1)
    input[1].mode(‘change’, 1, 0.1, ‘rising’)
end

FYI I typed this on my phone, sometimes the single quotation marks around strings come out weird so check that in case you get an issue…

Every time you send a trigger to input 1, it will sample the voltage at input 2 and send it to JF as a new note to play!

6 Likes

Wow! thats it?
Seems like I was overthinking things :laughing:

I did try to copy the script into druid but its giving me an error
druid error 1.tiff (17.5 KB)
I also typed it into atom and saved it as jfsynth.lua but when I upload it to crow i get a syntax error near ‘jfsynth’

Sorry but I’m a complete noob so I’m probably missing something obvious.

Thanks for you help!!!

When you run a script upload command, it looks for the script in the directory which your command line interface entered druid from.

As such, you have to run druid from the same directory which you saved the Lua file in - so navigate to that directory in terminal (using cd), then run druid, then run the upload command.

Also, again, you may need to retype those single quote marks around ‘change’ and ‘rising’, I’m not sure iOS is typing the correct ones.

1 Like

I tried changing the shiftregister script as well, with the intention of making it two voices instead of four, to use for hocketing purposes with my Furthrr Generator.

Before taking the time to dive into learning the language I started by guessing- changing places where I saw “for n=1,4 do” and replacing it with “for n=1,2 do.”

This seemed to work at first, but then I was getting behavior I didn’t expect- both CV values at the outputs were changing with every clock pulse, as opposed to my desired behavior of one voice updating and holding, then the other updating and holding, etc.

Would greatly appreciate a nudge in the right direction, as well as how I might go about making the newly unused remaining 2 outputs operate as gate outputs for each individual voice, for triggering envelopes.