This is essentially what I’m going for. I’m writing a script that blends two samples and maps them out over MIDI notes in a layout similar to Earth Sea. The samples will be fairly simple, so I’ll just need to a find a relative pitch for each of them and adjust playback speed accordingly. I think non-realtime would be ideal. I’ve got a more detailed plan on paper if you want to take a look. In the meantime, I’ll checkout aubio.

is there a strong reason to do this automatically instead of just writing down some sample metadata? (i mean, “it’s cool” is a good reason, but maybe not sufficient to actually go down the rabbit hole of building an FFT-based analysis tool. unless that is also cool.)

1 Like

Can you elaborate exactly what you mean by this? If there is a simpler solution I’d be very happy, my current plan is a little outside my skill level.

well, caveman solution:

you’re putting some samples on the norns filesystem like foo.wav. accompany it with something like foo.data which can even just be a lua file

foo.data.lua:

{ name = 'foo', rootNote = '48', ... }

and in lua:

foo_data = dofile(`foo.data.lua`)
do_something_with_soundfile(foo_data.name .. '.wav')
do_something_with_midi_note(foo_data.rootNote)

some audio formats allow you to embed IDv3 tags that include metadata like pitch. we don’t have any facilities in the norns lua environment to parse that kind of stuff, but it could be added pretty easily if it seems generally useful. (probably - since you can build a sampler, you should be able to take advantage of sample-format features. but there are a lot of formats and features, so would be best to narrow down the most useful ones.)

2 Likes

Is there anything about the norns configuration of SuperCollider that would prevent it from working with TidalCycles?
https://tidalcycles.org/index.php/Linux_installation

I’m thinking about installing it, but I’m hoping I might be able to allow it to live alongside norns as norns is today, ideally unaltered. Am I dreaming? Do I have to choose between the two, or might I be able to run both (albeit not simultaneously, at least, not necessarily) on the same norns hardware instance?

1 Like

as far as i can tell, it should be fine. i installed it once and it seemed to work, but since i don’t actually know how to use TidalCycles i can’t say much about it.

the SuperDirt package is pretty huge as i recall, and the main issue was disk space.

you may want to customize the startup file for Tidal if you want to use the same server process as Crone uses.

[ https://github.com/musikinformatik/SuperDirt/blob/master/superdirt_startup.scd ]

6 Likes

What is the process for installing a Ugen?

if it’s all SC code, just put it in ~/.local/share/SuperCollider/Extensions

if it’s a custom cpp project, add it to the waf build:

1 Like

excellent - thanks!

I figured it needed to be compiled somewhere (as there are .cpp aspects)

last dumb question of the day - where do the compiled .so files get installed?
(I compiled them manually with cmake)

I’m not sure what ${PREFIX} is in the above script.

my waf-fu is weak but in some mysterious manner it is set to /usr/local.

that installs our built SC plugins in the SC “system” location for extensions. IIRC it will also work fine if you put the .so's and their associated .sc class wrappers directly in ~/.local/share/SuperCollider/Extensions or subdirectory thereof. (the “user” location.)

1 Like

Not sure if this is the right thread for this, but I’m trying to do something in SC on the Norns which works fine on my computer but won’t compile on Norns. I’m just trying to load some samples:

~samples = Array.new;
~folder = PathName.new("/home/we/dust/audio/samples");
~folder.entries.do({
arg path;
~samples = ~samples.add(s.Buffer.read(s, path.fullPath));
});

The line that it crashes on is:
~samples = ~samples.add(s.Buffer.read(s, path.fullPath));
I’m doing this inside alloc. If I comment out that one line, it compiles fine.

Any ideas? Thanks!

1 Like

Looks like you need to use context.server instead of s?

1 Like

I changed that and still get the same error:
ERROR: syntax error, unexpected CLASSNAME, expecting NAME or WHILE or '[' or '(' in file

Can you post your whole class? You have to make sure your class extends CroneEngine. See this example: https://gist.github.com/catfact/c08ec86bd7def0a1b072925e1287a4af

Sure. I’ve been referring to that gist, but this is my first foray into SC. It works as expected on my computer:

Engine_Sampler : CroneEngine {
var <synth;

*new { arg context, doneCallback;
	^super.new(context, doneCallback);
	}

alloc{
	~samples = Array.new;
	~folder = PathName.new("/home/we/dust/audio/samples");
	~folder.entries.do({
		arg path;
	~samples = ~samples.add(context.server.Buffer.read(context.server, path.fullPath));
	});

	SynthDef(\sampler, {
		arg buf, vel=64, gate=0, rate=1;
		var sig, env, amp;
		env = EnvGen.kr(Env.asr(), gate, doneAction:2);
		sig = PlayBuf.ar(2, buf, rate*BufRateScale.ir( buf ));
		amp = LinExp.kr(vel, 1, 127, 0.01, 1);
		sig = sig * env * amp;
		Out.ar(0, sig);
	}).add;

	context.server.sync;

	synth = Synth.new(\sampler, [
		\inL, context.in_b[0].index,
		\inR, context.in_b[1].index,
		\out, context.out_b.index,
		\amp, 0],
		context.xg);
}

free {
        synth.free;
}
}
1 Like

I should mention on my computer, I can play the samples as a test via:

~keys = Array.newClear(84);

n = {
	var note =84.rand;
	note.postln;
	~keys[note] = Synth.new(\sampler, [
		\buf, ~samples[note].bufnum,
		\vel, 90.127.rand,
		\gate, 1
	]
	);
};

n.value;
1 Like

Remove the “context.server” before “Buffer.read” and it should compile. If not, there might be something going on with the environment variables, “~” I’m not sure.

Try this:

~samples = ~samples.add(Buffer.read(context.server, path.fullPath));
1 Like

That worked, thanks! I have other problems now, but at least it is compiling.

1 Like

Seeing environment variables used in a SC class makes me feel really weird

Make them class vars