you could hack a couple programs together to connect via tty and convert midi… but it wouldn’t be a class compliant solution

That’s pretty much what I do at the moment, I have a python udp listener that just passes the 3 midi bites over to the repl.

1 Like

I’m hitting an issue where if I have an error in my code within redraw() various parts of norns seem to break outside my script, anyone else hit something like this?

LuaFormatter

@tehn, @zebra; I’ve been working on adding LP Pro suppor to the midigrid codebase, and I noticed something really odd in awake 2.2.0; @ L199 we’ve got if g then, but I always get a stub table back, even with nothing connected, in which e.g. device = nil and name = none, and I can see e.g. loom 1.0.5 @ L893 uses (essentially) if grid_device.device then

tldr; What’s the correct way to check for a grid?

FWIW, I’m on fates 191230

real quick, i think awake is out of date, now grid.connect returns a vport and the correct way is to check device (i’ll try and remember to verify this later)

Hello all,

Had a curious problem with my pmap file for Benjolis (https://github.com/scazan/benjolis). I updated the script to include a few more parameters at the top but had a MIDI parameter mapping already set for my 4th line parameter (in this case “freq 1”).

The problem occurred when I added a new parameter to the top pushing “freq 1” down to the 5th line and a separator into the 4th position. This made my “freq 1” parameter no longer work (actually it just made all of my MIDI controls off by one). No problem, I remapped the “freq 1” parameter to the correct knob but, while it would show the proper MIDI CC number in the menu, it would not work.

I noticed that for some reason, since the pmap file was set previously with “freq 1” at index 4, it would never change… so I couldn’t remap that CC number to that parameter again without deleting my pmap file.

Easy fix for me but worried about pushing an updated release as it might cause errors for people who have mappings.

Is this a bug or is there a good way to deal with this?

EDIT: Actually it seems like it is just a matter of unmapping any already mapped CC numbers. Editing the pmap file equally works.

DOUBLE EDIT: Ok, I see that the pmap is always written by index in lua/core/menu/params.lua. I’ll take this to github

@scazan that’d be this old issue: https://github.com/monome/norns/issues/600

1 Like

made a gh issue but cross-posting here since it’s a documentation thing !

3 Likes

I’m looking at the norns scripting tutorials, but I’m getting engine missing errors.
Is there a way I can load in the PolySub or TestSine engines from the Maiden package manager?

those are part of the we repo. so update that one from the base collection.

That makes sense, and that’s where I thought. I just realized that I didn’t reboot norns after I re-installed it! Thank you!

Here’s some questions I’ve come up with tinkering with softcut:

Does that buffer start at 1 or 0 ? Starting at 1 would be more inline with Lua conventions, but buffer position is specified in seconds, so starting at 0sec makes some sense too?

Is there a way to slew the panning without re-implementing a slew function in my script? (Softcut feature request?)

Is there any reason that buffers get “stuck” on script (re)start from maiden?

(Update: two more softcut questions)

Is there a way to get the length of a loaded file?

Is there a way to get the current output level of a voice? i.e. envelope follower mentioned in another thread…

And more general Norns than Softcut, For a static background, is it better to draw a bunch of polys on every frame, or draw them once and write them to a PNG & then load the PNG every frame?

zero. lua convention is that arrays use 1-base indexing, and we follow this in norns lua code whenever a variable or argument is an index. when it is a quanitity, like time, this doesn’t apply.

you will notice a lot of softcut scripts that use 1s as a starting place, which maybe muddies the water. there is not a good reason for starting at 1s, except a general awareness that having some pre- and post-roll is a good idea. (but for the record, crossfades in softcut are applied at the end of the loop; so leaving some post-roll is important but pre-roll is not. [oh, ha: unless the rate goes negative, d’oh.])

Is there any reason that buffers get “stuck” on script (re)start from maiden?

not sure what you mean

Is there a way to slew the panning without re-implementing a slew function in my script? (Softcut feature request?)

sofcut.pan_slew_time(voice, time)

Is there a way to get the length of a loaded file?

not from softcut. you can query the duration of a soundfile before loading it with audio.file_info() (returns a table with channels, frames, samplerate)

Is there a way to get the current output level of a voice? i.e. envelope follower mentioned in another thread…

no. there are no envelope followers on per-voice output. (what thread?)

And more general Norns than Softcut, For a static background, is it better to draw a bunch of polys on every frame, or draw them once and write them to a PNG & then load the PNG every frame?

don’t load a PNG every frame; it incurs disk IO and creates/destroys a new cairo surface.

[mod: moving to norns: scripting]

4 Likes

Thanks for the informative answers.

Just a thought, I’m not sure about moving this to the Norns: Scripting thread, the drone in three worlds thread does prompt to ask questions …

zero. [snip] when it is a quanitity , like time, this doesn’t apply.

Good to know my initial suspicion was correct that buffers start from zero, but all the examples starting at 1 was misleading me, considering the documentation is not clear either.

Is there any reason that buffers get “stuck” on script (re)start from maiden?

not sure what you mean

Intermittently on restarting (hitting play in maiden, while the script is already runnning) a softcut script (grainular style, 7 voices) I get a tone, until the voic? is reclaimed. FYI This could be a non-norns driver issue (fates)

don’t load a PNG every frame; it incurs disk IO and creates/destroys a new cairo surface.

Is there a scriptable screen buffer? Maybe worth a feature request? Then again, Norns is not exactly designed to be a games console.

Once upon a time I started on expanding the load png stuff so they could load and show as separate functions - which would help.

I have also done some very basic “sprites” reading bitmaps into arrays.

One of these days I’ll have time to get back to that.

1 Like

thanks! can you link the script? could be an issue with how softcut params are reset between script loads.

re: scriptable screen buffers yes, i do actually think it would be a nice thing to have. but doing this correctly would involve the level below lua… it’s not a high priority but could be added if/when we get to refactoring screen.c to better support emulation.

:point_up: This has been super helpful in my scripts, but now I’m struggling to figure out how I’d constrain the range when the min value isn’t 1 (for example, if I wanted to increment/decrement a value within a range like 4-10). Any ideas? My stackoverflow searches are hurting the old brain.

i guess i wouldn’t overthink it

function wrap (x, min, max)
   local y = x
   while y > max do y = y - max end
   while y < min do y = y + min end
   return y
end

otherwise i guess you could do something like (x - min) % (max-min) + min

but preferring % operator over conditional isn’t really an optimization, at least in lua where i’m pretty sure it is literally implemented as a%b === a - math.floor(a/b)*b

4 Likes

4…10 is really 0…6 with an offset of 4. So you could change to % 6 and then add 4 instead of 1 at the end. I’m not at my computer but something like that should work.

1 Like