lol, yesterday I ported the Aleph grid tutorial to a Norns script. Would a documented tutorial be useful too?

5 Likes

YESSSSSSSSS!!! Hero!

1 Like

@lazzarello nice work! much of this will be overlap with the forthcoming (this week) midi/grid study, so i’d hesitate to merge it at this point.

@dan_derks i’ve also seen some glitch/crash business with SoftCut and need to spend more time figuring out what’s going on. if you have a simple, commonly reproducible crash situation please do file a github issue for it!

1 Like

Starting a library of drawing functions. I’m not well versed in the flow of github right now, but I’ve got my functions on a single script here. It would be cool to get more together.

1 Like

If I make a lua library of functions (a separate file from my main script) - this does not get recompiled (or whatever) when the main script is re-run from maiden.

The only way I could get the changes to the lib to show up is to “run script” on the library.

Bug or Feature?

(lua) feature, i think.
require 'foo' - searches for foo.lua in all available paths (see the paths we add in norns/lua/config.lua), runs once and stores in package cache
dofile('foo.lua') - always executes foo.lua in the current directory

Therefore… using require, how does one get the library to reload/recompile?

(I was previously trying to just have some functions load in, but have updated to proper library module format)

there isn’t an explicit mechanism for doing that but you can manipulate the package cache directly:

-- import
local myfoo = require "foo"

-- un-import 
myfoo = nil
package.loaded["foo"] = nil
2 Likes

stupid thing of the day - a big gauge mapped to encoder turn:

15 Likes

Hey… so the grid and midi study went up, but maybe you still have questions about what device info is available? Like maybe… can I get the height and width of a connected grid?

The grid and midi objects (is that the right term?) are tables with sub tables:

 grid.list     -- contains port and device name
 grid.devices  -- contains port and device name
 grid.vport    -- which device is on which virtual port

So it’s handy to print those and see what’s inside:

tab.print(grid.list)  

This is nice to confirm which device is attached to which port

I like something like this to get details of each attached device:

 print("-Grid device details-")
 for i,v in pairs(grid.devices) do
   tab.print(grid.devices[i])
   print("-")
 end

which prints out:

-Grid device details-
cols	8
rows	8
serial	4676000
id	2
ports	table: 0x14d9e20
key	function: 0x1455310
name	monome 4676000
dev	userdata: 0x70305920

So to answer my question above - the number of columns available on this grid would be grid.devices[2].cols and the rows grid.devices[2].rows

NOTE - the grid.devices table uses an id key which is different from the port key in grid.list. The id would be a number chosen by norns when you plug/unplug a device. The port is going to be the numer you’d use in grid.connect() or as selected from the SYSTEM>DEVICES menu.

5 Likes

doing the studies tonight and playing around some in the process, have a few questions that i don’t want to clutter the thread with. is anyone online that has experience that wouldn’t mind answering a couple coding questions?

Has anyone tried or been experimenting with a morphing wavetable type engine? I’m imagining something like the Synth Tech Cloud Terrarium type morphing… I’ve been playing around with making custom wave table banks and would love to use them via norns.

Is there a way to get the current value of a parameter from a sound engine? While messing around with the studies I was hoping to write the current value of Hz. I’m sure it’s possible that this isn’t necessary but I’m curious nonetheless.

my suggestion is to wrap engine commands in a parameter— see part 3

then you can use

params:get('tempo')

let me know if you were suggesting something else?

2 Likes

Ah, cool! I haven’t worked through study three yet so i’m sure that will help. thanks.

1 Like

Trying to be able to save 16 grid patterns in a data file, each pattern taking up 136 lines in the .data file. The reading load_pattern() function seems to work fine. But the save_pattern() function only works on the first pattern, if I try to save a pattern when pattern_select = 2 or higher, ekombi.data becomes empty. Am I going wrong with the file:seek method or is there something I’m overlooking?

LOOK HERE
function save_pattern()
  local file = io.open(data_dir .. "gittifer/ekombi.data", "w")
  io.output(file)
  file:seek("set", (pattern_select - 1) * 136)
    for i = 1, 8 do
      io.write(tab.count(track[i]) .. "\n")
      for n=1, tab.count(track[i]) do
        io.write(track[i][tab.count(track[i])][n] .. "\n")
      end
      for n=1, 16 - tab.count(track[i]) do
          io.write("00\n")
      end
    end
  print("SAVE COMPLETE")
  io.close(file)
end

function load_pattern()
  local file = io.open(data_dir .. "gittifer/ekombi.data", "r")
  if file then
    print("datafile found")
    io.input(file)
    file:seek("set", (pattern_select - 1) * 137)
    for i = 1, 8 do
      track[i] = {}
      local tracklen = tonumber(io.read("*line"))
      print(i..":tracklen:"..tracklen)
      for n=1, tracklen do
        track[i][n] = {}
      end
      for j=1, tracklen do
        track[i][tracklen][j] = tonumber(io.read("*line"))
      end
      for m = 1, 16 - tab.count(track[i]) do
        io.read("*line")
      end
    end
    print("LOAD COMPLETE")
    io.close(file)
  end
  -- for i = 1, 8 do reer(i) end
end

Is it because you are opening the file in “w” mode in the save_pattern() routine? According to what I can read, that erases any existing data in the file. “r+” should allow you to update an existing file’s contents, if I’m reading this right…

[ddg]

Are you trying to append to an existing file? If so, try opening the file with a, or a+ instead of w?

Here is some Lua file I/O info, hope it helps!

@darwingrosse, @Justmat thanks for the input! The solution I settled on was “r+”. If I wanted to make an endless amount of saveable patterns, I’d definitely use append. I kind of ripped these two functions out of your scripts, so thanks @Justmat

so just wrangling a dev environment that lets me work on supercollider without using the wifi (which is super flakey for me but I know that that is being rewritten)

In order to use screen to connect over the serial port - follow instructions elsewhere. ie:

screen /dev/usb.tty- 115200

then in the screen if you want full screen and colour I needed to do:

stty rows 54 columns 181
export TERM=xterm-256color

then vim is working full screen with syntax highlighting! win :slight_smile:

.bashrc has all kinds of things in it - will need to review :wink: including messing with the TERM - not sure why I needed to set it

this is on a mac but should be similar elsewhere

(I’m too lazy to figure out using maiden over serial - presume some kind of tunnel would do the trick - if anyone knows how to do it - please share! )

(also worth noting - the usb connection directly from my Mac keeps the battery charged. Which is nice)

(I also installed tmux - which works nicely as well )

(edit - also installed this into my vim so I have syntax highlighting https://github.com/supercollider/scvim - I’ve not bothered trying to get the interactivity to work because I don’t need it here )

(last edit - if you are connecting with something that wants to use the bottom line for status (like mincom for example) just reduce the rows in the stty command)

(really the last edit - if you are running on the terminal (as above or via ssh):

go into norns. make a copy of start.sh - I called mine dstart.sh and edit it to say

cd “$(dirname “$0”)”
./crone.sh &
./matron.sh &

  • ie take out the pipe to dev null for the logging - that way you can see all the logging on the terminal
    )
6 Likes