Supercollider tips, Q/A


#202

you can use s.sync; instead of 0.01.wait, which should pause the routine until the synthdef is loaded.

I wouldn’t really bother with SynthDefs for testing code like this (they are great for stuff you are planning to re-use though). This would be easier I think:

~demo = {|function, waitTime = 1|
    fork {
		x = function.play;
        waitTime.wait;
        x.free;
    }
};

~demo.({SinOsc.ar(440)});

#203

That’s way better. I thought I had tried that and it didn’t work, but I must’ve gotten something wrong. The synthdef thing was my workaround because of that apparently non-existent problem. But at least now I learned about s.sync, thanks! :slight_smile:


#204

Thanks for all the example code.

Instead of using sclang, I wonder if you could wrap the synth in Env and use that to free the synth?

I’ve just had a look at the Overtone code, and I think that’s what they are doing (I appear to have lost my ability to read Lisp without my brain melting…)

Link to demo macro, appears to wrap the body in a hold. Link to hold, looks like a very simple proxy to Linen.

Finally, the particular instance of .play is from the Function class. If I extend the Function class, I’d be able to:

{ SinOsc.ar(440) }.demo;

Also, the big thing I remember being useful with the demo function from Overtone was that it was used in lots of tutorials and various UGen examples. It was nice not having to hit ctrl-. after pasting example code in!


#205

You can easily extend classes (like Function) with methods (such as demo) in sc files. See ”External method files” section in http://doc.sccode.org/Guides/WritingClasses.html

Hold/Linen approach is of course possible in sc too.


#208

we thought the SuperCollider community could do with a discourse forum.

it is an embryo - any love / care / guidance you might be able to give it at this point would be instrumental to its development.

our hope is that under lines’ wing, scsynth.org might one day mature into a strong, independent, younger sibling.


#209

Excellent.

Is that an ‘official’ SuperCollider forum? Or more of a 3rd party community?


Supercollider tips, Q/A
#210

Happy to see this! 20 chars


#211

Great idea, definitely needed :slight_smile:


#212

This idea was floated on the official sc mailing list some time ago, and was rejected by many of the members…(so I would guess it’s not “official”): https://www.listarc.bham.ac.uk/lists/sc-users-2017/msg54568.html


#213

Yay! C U there… in 20 characters


#214

not an ‘official’ forum.

SuperCollider is a community project, and as such, ‘officialness’ isn’t bestowed from above, it is grows from below.

so we will only really know in retrospect, once the community has voted with their feet.


#215

Please, Please, Post your code. So curious.

(reference; CV GATE control)


#216

also curious
would love to hear/see results


#217

I tested it with Korg SQ-1 and my Mac, sending Start message from SQ-1 and trigger a C4 key note on of a software instrument, and it works. Below is my simple code:

(
MIDIClient.init;
MIDIIn.connectAll;
m = MIDIOut.new(0);

MIDIdef.start(
	\sysrtStart, {
		m.noteOn(15, 60, 127) // MIDI channel 16, Middle C, velocity 127
	}
);
MIDIdef.stop(
	\sysrtStop, {
		m.noteOff(15, 60, 127)
	}
);
)

However it didn’t work on my Pisound, maybe it’s becasue my shell, or I messed up the destination… still trying to figure out.

Also I am not sure above formatting is correct (is it called Nesting?) :sweat_smile: Sorry for too many novice questions.


#218

I would start by checking the MIDIClient.sources richt after the init, this just to checkout if you are getting access to any MIDI in/out

Next i would put a "START MSG".postln; before the noteOn event and check the post window. (this will allow you to check if you are getting any MIDI from the inputs and the start message is getting recognized by supercollider.

Next step is checking the MIDIOut port using MIDIClient.destinations and checking the post window. This will list the available Outputs and then you can check if the final destination for the m.noteOn is the one you desire (new(0) might not be the correct one).

I’m not in front of SC right now, and i don’t have a Pisound…

Nope, it is called indentation

(edit: made my answer a bit more clear, as the previous one was made during a break at work)


#219

Hello, I could use some help in figuring out how to execute something. I have been watching and reading tutorials but can’t quite put the pieces together. What I am trying to do is as follows…

  • a single SinOsc frequency ascending by multiples of a fundamental, i.e- overtones.
  • the amplitude envelope of each new overtone decreasing exponentially
    over a finite duration of time.
  • each new enveloped overtone sent to different output within an 8-channel array, linearly distributed and wrapping back to the first channel, i.e 0…7, 0…7, 0…7, etc.

In other words, what I am trying to create is a single tone raising in pitch by sequential order of its harmonics, each new harmonic is exponentially shorter in duration than the previous harmonic, and each new harmonic is sent to a different channel in an 8 channel circular array, over a defined total duration.

I know this can be achieved with Patterns and Synthdef, but I don’t yet know enough about iteration achieve this by triggering events and developing control structure. Any help such as examples, help files, etc, would be greatly appreciated!!


#220

pretty sure this code should do it:

(
SynthDef (\sine_tone) {
	arg freq = 440, amp = 1, len = 1, bus = 0;
	var sig, env;
	env = Env.step ([ amp ], [ len ]);
	env = EnvGen.kr (env, doneAction: 2);
	sig = SinOsc.ar (freq, 0, env);
	Out.ar (bus, sig);
}.add;
)

(
t = 2; // initial duration
f = 220; // initial frequency
~harmonic_bus_pattern = Pbind (
	\instrument, \sine_tone,
	\delta, t * (2 ** Pseq ((0..-7), inf)),
	\len, Pkey (\delta),
	\amp, (2 ** Pseq ((0..-7), inf)),
	\freq, f * Pseq ((1..8), inf), // corrected
	\bus, Pseq ((0..7), inf),
);
)

~harmonic_bus_pattern.play

have you had a look at Eli Fieldsteel’s excellent SuperCollider tutorials?

also, we have a new forum! here

edit 2: oop sorry I keep messing up the \freq argument. corrected in line.

also note inf as the second argument of Pseq to loop them indefinitely, where previously I had given a 1 to just make them play once and then stop.


#221

I ask a similar question recently regarding csound. But I should’ve perhaps asked also. Are there any mlrv type applications available that run on Supercolider?

Many thanks


#222

I don’t think there is an existing equivalent for SuperCollider, although it couldn’t hurt to have a quick rifle through the sampler category over at sccode.org.

more pertinently, SuperCollider will let you build one to your exact specifications!

here is a tutorial by studioTTTguTTT.

here is a tutorial by Eli Fieldsteel.

would you be wanting to use a monome grid, or a midi-controller?


#223

I’ll be using a monome grid?