Ah, yes that’s the issue. I was putting in a directory path, assuming it would generate a file name on its own. I got an <ok> in the console, so I wasn’t sure what I was doing wrong. Silly me. Would it make sense to return an error if the path is just a directory?

1 Like

Im getting the “Duplicate Engines” error i ran crone and i got this

`ERROR: duplicate Class found: 'Engine_FM7' 
/home/we/dust/code/we/lib/Engine_FM7.sc
/home/we/dust/code/fm7/engine/Engine_FM7.sc

ERROR: There is a discrepancy.
numClassDeps 1440   gNumClasses 2876`

it seems like its we needs a fix but i cant seem to figure it out
any help would be appreciated

using maiden, navigate to we > lib, where you should see a Engine_FM7.sc file. if you navigate to fm7 > engine, you’ll also see the same Engine_FM7.sc file.

supercollider is failing to load because you have the same engine listed in two different places inside of /home/we/dust/dust is the holding cell for everything you see in the file browser of maiden.

so, you just need to delete one of them – I’d suggest the we > lib one, since you’re likely interested in running the fm7 script.

hope this helps!

1 Like

great. thanks got it sorted!

As far as I know (please correct me if I’m mistaken!), require() is the conventional way to use a shared, non-global library. Also, its loading behavior differs from include in that the code in the referenced script will be sandboxed and treated like a self-contained module. It will have an explicit public interface as exposed by its return value, much like require() in NodeJS/AMD.

Also, it will in fact look in dust/code, but it looks in a few other places first, and a grip of others after :

/home/we/dust/code/scratchpad/require-test.lua:1: module 'test' not found:
	no field package.preload['test']
	no file '/home/we/norns/lua/test.lua'
	no file '/home/we/norns/lua/core/test.lua'
	no file '/home/we/norns/lua/core/params/test.lua'
	no file '/home/we/norns/lua/lib/test.lua'
	no file '/home/we/norns/lua/softcut/test.lua'
	no file '/home/we/dust/code/test.lua'
	no file '/usr/local/share/lua/5.3/test.lua'
	no file '/usr/local/share/lua/5.3/test/init.lua'
	no file '/usr/local/lib/lua/5.3/test.lua'
	no file '/usr/local/lib/lua/5.3/test/init.lua'
	no file '/usr/share/lua/5.3/test.lua'
	no file '/usr/share/lua/5.3/test/init.lua'
	no file './test.lua'
	no file './test/init.lua'
	no file '/usr/local/lib/lua/5.3/test.so'
	no file '/usr/lib/arm-linux-gnueabihf/lua/5.3/test.so'
	no file '/usr/lib/lua/5.3/test.so'
	no file '/usr/local/lib/lua/5.3/loadall.so'
	no file './test.so'

Conventional - yes. Shared - yes. Non-global - I’m not sure what how to interpret that. Certainly require is bringing in code which is not part of the built-in/default environment. The require function is part of the Lua language.

Based on the stack trace from the failed require call it does appear that my earlier assertion that require does not search directories under ~/dust/code is in fact not true - it does look like the scripts are looked for directly under ~/dust/code but not any of its subdirectories.

Looking over the norns documentation I see that there isn’t really a ton of guidance as to when to use require and when to use include (something I will raise with the dev team). What would probably be of the most value to people is highlighting the two areas where the behavior of require and include differ, specifically (a) where do they search for lua files to load and (b) what happens if the same lua module is required/included multiple times.

Where do they search?

  • require: looks for a file along the configured Lua module search path
  • include: looks for a file in one of two places; relative to the currently loaded/running script or relative to the top of the ~/dust/code directory tree (the code for reference)

If one is trying to access lua code from files which lives within the ~dust/code (basically anything editable within maiden) the include is your friend.

If one is trying to access lua code which is part of the norns/matron software itself (such as these files) then require is what you what.

What happens when the same lua code is referenced twice?

  • require: the first time a lua module is required it is loaded up and the module is added to a list of currently loaded modules. Should a file be require-ed a second time the previously loaded module is returned - it is not loaded a second time.
  • include: the file is loaded fresh again from the filesystem each time the include function is called.

The main benefit of include here is that if one is working on building a library of code for use in a script, each time the script is run any changes to the file being include-ed will picked up. If we used require then we would have to manually remove the previous copy from the list of loaded modules any time we wanted to pick up changes to the library module.

One unfortunate characteristic of Lua is that all variable (name bindings) are global by default unless one explicitly declares them local. The net effect is that it is very easy for modules to produce global side-effects when they are loaded. As of today the norns menu system and each script as it is loaded share the same Lua interpreter environment and there isn’t much if any sandboxing of scripts/modules as they are loaded. There has been a healthy amount of debate around trying to take steps to better sandbox scripts and to remove any side-effects produced when the script is run.

Under the hood include and require (to my knowledge) use the lower level Lua function dofile to read/load Lua code so I believe they are more or less the same in not providing any sandboxing.

Hopefully that helps clear up some of the confusion (instead of creating more)!

3 Likes

Exactly, as opposed to the standard Norns modules, which are global. The term “library” is a little confusing because it could mean 1) the standard Lua libraries 2) the standard Norns libraries 3) a library residing in ~/dust/code, probably written by a Norns user.

Right, but if you had a file ~/dust/code/test-lib/lib/foo.lua, requiring test-lib/lib/foo would return it. It looks below ~/dust/code as deep as the require indicates, but no deeper.

Thank you, I wanted to say this but glossed over it.

Anybody else notice their norns has one channel louder than the other?

what’s the test situation?

Headphone only plugged in.
Power on norns.
Load Awake.
System>Audio
Output = -11.36db
Monitor Mode: stereo
Headphone: 30
Reverb off,
Compressor off
Look at levels. Listen in headphones or monitor through mixer. Left channel lower than right.

Hello,

I’m posting here as I recently got a norns and I wanted to use my Korg SQ-1 as a dual midi-cv converter to sequence my eurorack from less concepts.
My trouble is that SQ1 has two possible outputs : SQ-1 MIDI OUT (the actual sequencer output) and SQ-1 CTRL, I need to choose the second one to be able to use it as a midi/CV converter but it doesn’t seem possible to do it from the norns devices > midi menu, I can select SQ1 but there is no further options. I guess norns choose the first option as default.

Anyone here had to deal with a similar issue?
Or is there something I overlooked?
I guess other midi devices might work like this, that’d be nice to be able to use them.

Thanks

PS : I hope it’s okay to create a specific thread for this, I didn’t really know where to ask this but please feel free to merge it somewhere if needed/better.

this was a known issue until very recently. are you on the latest version?

1 Like

the softuct voice is panned 50% right in halfsecond.lua. i don’t know if this is on purpose (i actually think it sounds better with that separation) or (more likely) halfsecond.lua has not been adjusted for breaking pan scaling change in version 2.2.0.

here’s a trivial PR that recenters the echo.

after centering the echo, or when muting softcut in the mixer, i cannot reproduce any significant/measurable L/R volume difference.

BTW: monitor mode only affects how inputs are routed to headphones. so if you are trying to test output level as opposed to input level, best to mute monitor path entirely.

1 Like

It seems indeed to be the issue, unfortunately I’m on latest version (191028) and only “SQ-1 1” is appearing, it might be related to this specific device though.
I’ll try to investigate a bit and report back if I find something useful.

ok, thanks for the report. feel free to reopen the issue on github if you have specific feedback, easier to track there

Hi!

One question and a follow up to a bug (?) that was discussed a few weeks back.

I’m on the newest norns firmware and am trying to Midi map my Korg Nano Kontrol 2 and norns seems to be having trouble learning anything from it. Is there something I’m doing wrong?
Edit: is not every parameter available for midi mapping per script? maybe this is the issue?

Also: A while back I remember a few members and I brought to light that sometimes the norns audio will become super distorted and weird randomly. I figured out (maybe) how to reproduce it. It seems everytime I have this problem is when the audio source I have plugged into norns is feeding sound into norns BEFORE it is turned on. If I am sure to have my external input source muted or off before turning on norns the issue does not happen. Can anyone else try reproing this?

certain types of parameters are not available for midi mapping – which script + which parameter(s) is causing particular trouble?

is this script-specific as well? exact steps to reproduce would be :raised_hands: – I wasn’t able to get it to be distorted when loading with audio in and loading to playfair

1 Like

Thanks Dan. Yeah, I think that was my issue with the MIDI mapping. All good on that end now.

I believe you can reproduce my issue exactly by:

  1. Have a sound source plugged into the stereo in of norns.
  2. Volume up on your external sound source.
  3. Have the external sound source outputting audio into norns.
  4. Turn on norns.
  5. Audio being monitored (should) be distorted and wild sounding.

I didn’t notice if it was script specific but it almost seems like norns needs a few moments to boot up before sending audio into the device. I’ve had this happen on a few occasions when I had turned my eurorack on before turning norns on and a sequence was running with the volume up. I do have an output module for my case so I’m not running hot modular signals directly in to norns.

Edit: I will say it doesn’t happen every time, but this is how I think I’ve caused it.

keep having rec overwrites on tape. like last track rec overwrites last track or mixed counting…

is the counter not properly advancing? you can see which tape number will be written to prior to starting record.

perhaps, if you’re not shutting down correctly the current tape position is not getting stored. you’re not using the emergency-shutoff bottom button, right?