# Norns: dust

#193

Not at home to try it out but super curious: Does today’s update improve Norns MLR?

#194

no updates to mlr today. just midi-cc mapping to its params.

#195

Would it be crazy / annoying or overkill to start a norns mlr thread ? To help people clarify how to use it, ask questions and talk about potential features ?

#196

#197

Markov melody generator (first-order but i’m ultimately heading for a second-order one). Interaction is a bit limited for now but it is just a foundation.

``````-- Markov melody generator
-- Key 2 randomize Scale
-- Key 3 randomize Probabilities

engine.name = "PolyPerc"
Scale = {0,0,0,0,0,0,0}
Prob = {{},{},{},{},{},{},{}}

function init()
rndScale()
rndProb()
engine.amp(1.5)
w = 1
noteSel = 1                                       -- note selector
counter = metro.alloc(count, 0.15, -1)
counter:start()
end

function redraw()
screen.clear()
screen.aa(0)
screen.font_face(1)
screen.font_size(8)
for i=1, 7 do                                   -- Draws Notes
screen.move(15*i, 6)
screen.level(15)
screen.font_face(1)
screen.text_center(Scale[i])
for j=1, 7 do                                 -- Draws probability for each note
screen.move(15*i, 10 + (j*7))
screen.level(2)
screen.text_center(Prob[i][j])
end
end
screen.move(11, 9)
screen.line(110, 9)                             -- Line
screen.stroke()
screen.rect((w*15-1),8,4,1)                       -- Feedback
screen.level(5)
screen.stroke()
screen.update()
end

-- Counter
function count()
probRoll()
engine.hz(midi_to_hz(60 + noteSel))
redraw()
end

-- Random Scale Generator
function rndScale()
for i=1, 7 do
if i ~= 1 then
Scale[i] = Scale[i-1] + math.random(1,3)       -- Creates Scale{}
end
end
end

-- Random Prob Gen per note
function rndProb()
for i=1, 7 do
remain = 100
deck = {1,2,3,4,5,6,7}
shuffleTable(deck)                          -- random distribution order
for j=1, 7 do
Prob[i][deck[j]] = (math.random(0, remain)) -- Mixup tables or last probs 0
if Prob[i][deck[j]] == 100 then             -- Prevent 100%
Prob[i][deck[j]] = 99
end
remain = (remain - Prob[i][deck[j]])
end
end
end

-- Midi to Hz
function midi_to_hz(note)
local hz = (440 / 32) * (2 ^ ((note - 9) / 12))
return hz
end

-- Prob roll
function probRoll()
local v = 1
repeat
Test = math.random(100)
if Test > Prob[w][v] then
v = v+1
if v > 7 then v = 1 end
x = false
else x = true
end
until x == true
w = v
noteSel = Scale[w]
end

function shuffleTable(t)                 -- shuffle table content
for ite = #t, 2, -1 do
local shf = math.random(1, ite)
t[ite], t[shf] = t[shf], t[ite]
end
end

function key(n, z)                      -- Key2 change Scale, Key 3 chang Probs
if n == 2 then
if z == 1 then
rndScale()
end
end
if n == 3 then
if z == 1 then
rndProb()
end
end
redraw()
end``````

#198

I’ve gotten started on this. Here’s a very early gist of a five buffer version.

Biggest thing I need to figure out a good way to do all notes off for only a particular buffer when stopped. Otherwise, exploring some interface changes and ideas, quantization of the loops relative to each other, and what the screen should do.

Here’s an early recording exploring seaaaa, cc mapping of various engine parameters with the nanoKONTROL2, and lots of delay, reverb and saturation.

Norns: help
#199

hello_gong: the played notes seem to never trigger a note off, is this by design? Bonus question: how do I revert to the default parameter settings on a script, after saving my own configuration as default?

#200

notes should be released upon note offs unless parameter `amp gain` is > 0.

#201

I’m trying my first attempts at writing a small engine for my norns.
Maybe a stupid question but how do I actually put the engine_something.sc file in the sc folder on norns?
Is it through maiden?
Or do I open a serial connection via usb and do it via terminal? And how would I go about and do that?

#202

#203

@jah quick question RE step. I’ve a gig coming up and I’d like to use step/grid for some drum sequencing. I know that I can save the state of the parameters menu, which is wonderful - is there a way to include the grid state?

I should probably say, I’ve not as yet even fired up Maiden etc, been too busy enjoying the scripts already written. I’m unlikely to have time to delve in either prior to the show (this weekend).

#204

Not currently, but I want to include features for saving/restoring patterns too. Perhaps I can make a quick hack and include it as a parameter in the parameter set. When is your show?

#205

Oh man, that would be such a help. It’s sat eve (BST). Understand if it’s not viable or whatever, already feel in your debt for such great scripts.

#206

Is there a way to pass parameter values declared within the norns interface to the CroneEngine upon startup/init of a script?

#207

Noticed something in earthsea tonight while debugging a grid problem.

Seems earthsea is sending a gridredraw() twice in a row for `grid_note()` The first in the `grid_note()` function and then again in `gridkey()` where `grid_note()` is called.

Should we be wary of double/multiple refresh updates to the leds? I suppose this is a pretty benign thing though.

#208

Depends.

Something like “plane” or “nerdscroll”, where nearly every LED needs an update when any do, you don’t want to write unnecessary messages to the serial port.

But… If gridredraw() is checking a “dirty” flag, and thus only actually redrawing when something is changed, that shouldn’t add a whole lot of overhead.

#209

in this case it’s checking for dirty, sending the LED frame, sending refresh, then doing both of those a second time (without having any changes occurred) - which I’m assuming is a bug.

EDIT: Clarification - I’m talking about the lua code here

#210

I believe the low level grid code has dirty flags to avoid overhead.
(apart from the higher level overhead eg lua calls)

#211

Try this out for pattern saved/bundled with parameters in the pset: https://gist.github.com/antonhornquist/922ef1bd0f8173e3bf72039edec6ba8d

I won’t push this to the `dust` repo, as it’s not the ideal solution to have weird `row1``row8` parameters. i think i’ll try to add a pattern memory kind of thing (99 patterns or something) to the regular `step` script and a single parameterno parameter for selecting patterns.

#212

this is probably a bug. `gridredraw()` goes through all of the code to draw the earthsea interface… so it’s burning cycles.

`g.redraw()` actually sends the grid data to the grid, conditionally if the grid pixels are dirty, and the flag is set when the pixels are written. not sure if the logic is smart enough not to set the dirty flag when a pixel is overwritten with the same value (pretty sure it’s not) so indeed i’d say earthsea needs a fix to be more optimized. works as-is, but should be fixed.