Skip to content

Redoing sc-hacks from scratch. Under development!!! - Jan. 2021

Notifications You must be signed in to change notification settings

iani/sc-hacks-redux

Repository files navigation

Sc-Hacks-redux

About

This library provides utilities for live coding in SuperCollider, including a way to share code over the network using OscGroups by Ross Bencina.

Installation

Put the sc-hacks-redux folder or its alias (symbolic link) in the SuperCollider user exensions folder and recompile the class library.

Basics

The +> operator

source +> player

Create a new sound process from the source and play it in the player. The player is a name written as a symbol. The source can be a function, an event, or a symbol.

Function +> player;

Playing a function in a player with +> is similar to running {}.play.

{ WhiteNoise.ar(0.05).dup } +> \myplayer;

The difference is that the synth is stored under the name of the player, and can be released or replaced.

Event +> player;

Playing an event in a player is similar to playing a Pbind using as keys the keys given in the event:

(degree: 1, dur: 0.2) +> \myplayer;

This is not the same as playing a Pbind. Instead, it starts an EventStream which has some additional capabilities explained below.

Symbol +> player;

Symbol +> player starts a synth using the synthdef named by Symbol:

\default +> \myplayer;

Stopping a player with stop

To stop a player, send it the message stop.

{ WhiteNoise.ar(0.05).dup } +> \myplayer;
// after a while:
\myplayer.stop;

Specifying duration of release with argument to stop

A numeric argument to stop sent to a symbol specifies the release time when stopping the player stored in that symbol:

{ WhiteNoise.ar(0.05).dup } +> \myplayer;
// Relese with 5 seconds release time:
\myplayer.stop(5); // same as: \myplayer stop: 5;

Resuming a pattern with start

An EventStream playing in a player be stopped with stop and restarted with start. It will continue playing its streams at the position last stopped:

(degree: Pseq((0..10), inf)) +> \myresume;
\myresume.stop; // run this after a while
\myresume.start; // run this after a while

Modifying a player with ++>

One can use the ++> operator to modify a player while it is playing. A statement of the form anEvent ++> player adds or sets all key-value pairs of anEvent to the player.

If the player is an EventStream (i.e. a playing pattern), the key-value pairs are added to the EventStream. (If the EventStream is not playing, it is started).

(degree: Pseq((0..10), inf)) +> \mymodify;
(degree: Prand((0..10), inf)) ++> \mymodify; // run this after a while
(dur: 0.1) ++> \mymodify; // run this after a while

If the player is a synth, then the synth parameters named by the keys in the event are set to the values in the event:

\default +> \asynth;
(freq: 1000, amp: 0.05) ++> \asynth;

Another example, using more controls defined in the Synth function:

//: Create a synth with several control parameters
(
{ SinOsc.ar(
	SinOsc.kr(\vrate.kr(5)).range(\vlo.kr(400), \vhi.kr(450)),
	0,
	Decay.kr(Dust.kr(\drate.kr(1)), mul: 0.1)
	).dup
} +> \multiparam;
)
//: Set parameters drate and vrate:
(drate: 10, vrate: 20) ++> \multiparam;
//: Set parameters drate, vrat,e vlo and vhi:
(drate: 1, vrate: 1, vlo: 200, vhi: 1000) ++> \multiparam;

Setting a control of a synth with <+

This is an alternative syntax that works for setting a single parameter in a synth or EventStream. The syntax is:

\parameter <+.player value;

Example with synth:

\default +> \myplayer;
// set freq control of myplayer:
\freq <+.myplayer 600;

Example with EventStream:

(degree: Pseq((0..10), inf)) +> \test;
\dur <+.test 0.2;

Other features

Several classes and methods are provided which extend the functionality of SuperCollider. Documentation to these features is found in separate files inside this folder.

See:

OscGroups

OSC

OSCData

EventStream

Project

About

Redoing sc-hacks from scratch. Under development!!! - Jan. 2021

Resources

Stars

Watchers

Forks

Packages

No packages published