Ndef argument, min/max

Hello,

I am very new to using ndef. I was curious if there was a way to use an argument to set the min and max of a parameter slider so I would not have to go in and adjust them every time I load a synth to the ndef.

Thanks!

Best way I know is with JITLibExtensions.

  1. Add the JITLibExtensions quark.
    a. Install git from git-scm.com.
    b. Quarks.gui
    c. Find JITLibExtensions and click the checkbox to install.
    d. Recompile the class library.

Then you can do:

Ndef(\a).addSpec(\parameter, [min, max, warp], \otherParameter, [min, max, warp]... etc...)

hjh

ahh amazing thanks!

Any other cool tips you recommend for Ndef?

Is there a directory where I can see what else these Jitlib extensions let me do?

Thanks

Quarks.at("JITLibExtensions").localPath.openOS

hjh

That does not work for me due to the way I have quarks installed? Would there be another way?

Thanks

Aha, well, I couldn’t have guessed that you were installing them in a nonstandard way.

In fact, it isn’t required to use git to download the quarks. The only thing that is required is to put them in userAppSupportDir/downloaded-quarks, e.g.:

(
var quarksDir = Platform.userAppSupportDir +/+ "downloaded-quarks";
if(File.exists(quarksDir).not) {
	File.mkdir(quarksDir);
};
quarksDir.openOS;
)

If there is a directory within this location, and that directory contains a valid ‘.quark’ file, then you can use Quarks methods to access it – no need for it to be in the official list of quarks.

So you might consider moving your quarks into this location. Then you can use Quarks.gui etc.

In the meantime, you could pick some class that is defined in the quark and use its filenameSymbol to open the directory. (The catch is that you wanted to open the directory to find out what’s defined inside!)

Halo.filenameSymbol.asString.dirname.openOS

hjh

Weird, I have all my quarks in a folder called “downloaded-quarks” in my Supercollider Application support folder and the first method does not work? The quarks.gui does work for me.

Thanks!

the first method does not work

Recommended, if something is unexpectedly not working, to post the error output. This is actually an important point that often gets overlooked: if you ever catch yourself writing “it doesn’t work,” a little red flag should go up in your mind saying “Oops, it’s not enough to say that” – error or other output, maybe code snippets, to help diagnose the problem.

At present, all I know is that if I execute Quarks.at("JITLibExtensions").localPath, then I get "/home/dlm/.local/share/SuperCollider/downloaded-quarks/JITLibExtensions" as a String, and Strings know how to openOS.

There is no information about why it isn’t working on your machine, so I can’t begin to guess.

hjh

1 Like

ERROR: Quarks requires git to be installed
ERROR: Failed to read quarks directory listing: GitHub - supercollider-quarks/quarks: Directory of community contributed Quarks for SuperCollider a PrimitiveFailedError
ERROR: Quark ‘JITLibExtensions’ not found
CALL STACK:
Exception:reportError
arg this =
Nil:handleError
arg this = nil
arg error =
Thread:handleError
arg this =
arg error =
Object:throw
arg this =
Meta_Quark:new
arg this =
arg name = “JITLibExtensions”
arg refspec = nil
arg url = nil
arg localPath = nil
var args = nil
Meta_Quarks:at
arg this =
arg name = “JITLibExtensions”
var q = nil
Interpreter:interpretPrintCmdLine
arg this =
var res = nil
var func =
var code = " Quarks.at(“JITLibExtensions”)"
var doc = nil
var ideClass =
Process:interpretPrintCmdLine
arg this =
^^ The preceding error dump is for ERROR: Quark ‘JITLibExtensions’ not found

I was curious if there was a way to make the min values in Jitlib smaller than 0.01?

If you set a spec that allows values between 0 and 0.01 and you use the slider, then you get the proper value.

Ndef(\x, { |test = 0| test });
Ndef(\x).addSpec(\test, [0.000001, 0.01, \exp]);
Ndef(\x).gui;

// move slider somewhere in the middle

Ndef(\x).nodeMap[\test]
-> 6.9385678787372e-05

By default, the number box rounds to 0.01 (and unfortunately forces typed-in values to the same rounding :frowning: ), but this doesn’t affect the slider’s numeric resolution.

hjh

BTW I’ve raised the question on the developer list about making the number box precision user-configurable.

hjh

1 Like

You could check out the slider and player gui VarGui from miSCellaneous_lib quark. It supports a number of precision and display options which are discribed in its help file Ex.9. It can be used for passing SynthDef names and Synth objects and can be used for Environment variable control, though it doesn’t support Ndef.

Code example for control of a default synth

VarGui(
	synthCtr: [
		\amp, [0.0001, 0.2, \exp, 0, 0.005],
		\freq, [100, 10000, \exp, 0, 500]	
	],
	synth: \default	
).gui
1 Like