Skip to content

Commit

Permalink
Log unsorted results of SC file-extension search
Browse files Browse the repository at this point in the history
  • Loading branch information
Alhadis committed Sep 16, 2020
0 parents commit ffec387
Show file tree
Hide file tree
Showing 1,051 changed files with 478,520 additions and 0 deletions.
45 changes: 45 additions & 0 deletions files/.sclang.sc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Server.program = "/usr/bin/scsynth";

// same for Score
Score.program = Server.program;

// set some server options for different setups
#[\internal, \local].do { |s|
s = Server.perform(s);
s.options.numInputBusChannels = 2; // set the number of output jack ports
s.options.numOutputBusChannels = 2; // set the number of input jack ports
s.options.memSize = 1024 * 54; // 12 Mb for the synth, rt-memory for DelayC and friends
s.options.maxNodes = 1024 * 4; // increase the maximum number of nodes to play simultaneously

// tips:
// s.options.blockSize = 1; //great when using NRT to maximize the resolution of the
// control rate ugens during the render
};

// hook up jack ports to audio channels
"SC_JACK_DEFAULT_INPUTS".setenv(
"system:capture_1,"
"system:capture_2"
);
"SC_JACK_DEFAULT_OUTPUTS".setenv(
"system:playback_1,"
"system:playback_2"
);

//---- now set up our gui portion ----//
GUI.swing; //use swingosc

//"AWT_TOOLKIT".setenv("MToolkit"); //necessary when working with Awesome WM

SwingOSC.program = "/usr/share/SwingOSC/SwingOSC.jar";

//We choose a LookAndFeel - for aesthetic purposes? Actually here we do it to prevent a warning showing in the post window
SwingOSC.default.options.javaOptions = "-Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel";

g = SwingOSC.default;

g.waitForBoot({
Server.local.makeGui; //show local server
Server.internal.makeGui; //show internal server
});

43 changes: 43 additions & 0 deletions files/1.sc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
~filePath = "/home/don/music/sc/playground/sampling/et.wav";

~b0 = Buffer.read(s, ~filePath);
~b0.play;

// Frames
~b0.numFrames;

// Channels
~b0.numChannels;

// Duration
~b0.duration;

// Buffer numbers (bufnums)
~b0.bufnum;

// Buffer sample rate
~b0.sampleRate;
s.sampleRate;

// Summary
~b0.query;

// How to load only part of a sound file into a buffer
// Loading only the first half second of the sound file:
~start = 100000
~end = ~start + s.sampleRate/2;
~b0_part = Buffer.read(s, ~filePath, ~start, ~end)
~b0_part.play;

(
SynthDef.new(\bufrd_test, {
arg amp=1, out=0, buf;
var sig, ptr;
ptr = Line.ar(0, BufFrames.kr(buf)-1, BufDur.kr(buf), doneAction:2);
sig = BufRd.ar(2, buf, ptr);
sig = sig * amp;
Out.ar(out, sig);
}).add;
)

Synth.new(\bufrd_test, [\buf, ~b0.bufnum]);
53 changes: 53 additions & 0 deletions files/1snip.1120044f.sc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

//
// Copyright (c) 1992-2020 Wo Of Ideafarm. All rights reserved. See IDEAFARM.COM for permitted uses.
//
// This proprietary software was crafted at great expense and with great hardship by one man. It took 28 years.
// Respecting the rights of other people is an important part of empowering one another.
//


/*3*/
#define sc_cSSSmARK /*id1*/
#define sc_ccSSSrEPEAT /*id1*/
#define sc_ccSSS /*id1*/
#define sc_cALPHABET1 /*id1*/
#define sc_cADAMeXPORT /*id1*/
#define sc_cADAM /*id1*/
#define sc_cPOPiDgRID /*id1*/
#define sc_cPUSHiDgRID /*id1*/
#define sc_cSYMBOL1 /*id1*/
#define sc_POPdETACHaTTACH /*id1*/
#define sc_PUSHaTTACH /*id1*/
#define sc_PUSHdETACH /*id1*/
#define sc_mmLINEtO /*id1*/
#define sc_ccLINEpEL /*id1*/
#define sc_ccMOVEpEL /*id1*/
#define sc_mmMOVEtO /*id1*/
#define sc_cCOLOR /*id1*/
#define sc_IGNOREqUOTES /*id1*/
#define sc_MARKsYSTEM /*id1*/
#define sc_MARK /*id1*/
#define sc_NULL /*id1*/
#define sc_cFROMuNICODE /*id1*/
#define sc_cFROMgRAPHICS /*id1*/
#define sc_cFROMaSCII /*id1*/
#define sc_cFROMcONTROL /*id1*/
#define sc_PREFIXeXTRA /*id1*/
#define sc_PREFIXuTILITY /*id1*/
#define sc_PREFIXlENGTH /*id1*/
/*3*/

/*1*//*sc*//*1*/

/**/
*/
/*
//
// Respecting the rights of other people is an important part of empowering one another.
// This proprietary software was crafted at great expense and with great hardship by one man. It took 28 years.
//
// Copyright (c) 1992-2020 Wo Of Ideafarm. All rights reserved. See IDEAFARM.COM for permitted uses.
//
130 changes: 130 additions & 0 deletions files/23-wavetables-1.sc
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
s.boot;
s.quit;
s.scope;
FreqScope.new;

// Osc is the primary UGen for oscillating over wavetables and it is a linear
// interpolation that, unline SinOsc, can operate on a custom wavetable stored
// in a buffer. There is also COsc (chorusing) and VOsc (variable).

// Shaper uses a wavetable as a transfer function in order to alter the shape
// of an input signal. This will be covered more in part 2.

// Signal is a language-side ordered collection (like an array that can only
// contain floats) used for representing a sampled function in an offline
// context (away from the audio server). The size should be a power of 2.
// 1024 is a good place to start. We can either use sineFill on Signal or an
// Env with its asSignal message.

// In order to get sound from a Signal, the buffer must be converted to wavetable
// format (most things like SinOsc, VOsc, etc need this format as well) using the
// asWavetable message.

// To plot wavetable format, use:
// ~wt.collect({arg n; n}).plot;
// which converts it to an array.

// only need to do this once
// 2048 is the size of the wavetable (twice the size of the signal)
b = Buffer.alloc(s, 2048);


///////////////////////////////////////////////////////////

// Using Signal.sineFill and multiple amplitudes
// to create additive synthesis with multile sine waves
(
~amps = [1] ++ ({[0, exprand(0.05,0.5)].choose}!31);
~sig = Signal.sineFill(
1024,
~amps,
0!32
);
~wt = ~sig.asWavetable;
b.loadCollection(~wt);
// ~wt.plot('sc:env');
// ~sig.plot('sc:signal');
)

b.plot('sc:buffer');

{Osc.ar(b, MouseX.kr(10, 10000, 1), mul:0.2!2)}.play;
// and with the right channel one octive higher and slightly detuned
{Osc.ar(b, MouseX.kr(10, 10000, 1)*[1,2.01], mul:0.2!2)}.play;
s.freeAll;

///////////////////////////////////////////////////////////

// Using an envelope with asSignal and then
// asWavetable to create an abstract shape
// The times (2nd argument) are proportional values
(
var env, sig, wt;
// env = Env([0,0.6,-0.9,0.3,0],[4,3,2,1],\lin);
// env = Env([0,0.6,-0.9,0.3,0],[4,3,2,1],\sine);
env = Env([0,0.6,-0.9,0.3,0],[4,3,2,1],{rrand(-20,20)}!4);
sig = env.asSignal(1024);
wt = sig.asWavetable;
b.loadCollection(wt);
wt.plot;
// sig.plot;
)

b.plot;

{Osc.ar(b, MouseX.kr(10, 10000, 1)*[1,2.01], mul:0.2!2)}.play;


///////////////////////////////////////////////////////////

// Totally random envelopes
(
var env, sig, wt, numSegs;
numSegs = rrand(4,20);
env = Env(
(({rrand(0.0,1.0)}!(numSegs+1)) * [1,-1]).scramble,
{exprand(1,20)}!numSegs,
{rrand(-20,20)}!numSegs
);
sig = env.asSignal(1024);
wt = sig.asWavetable;
b.loadCollection(wt);
)

b.plot('sc:buffer');

{Osc.ar(b, MouseX.kr(10, 10000, 1)*[1,2.01], mul:0.2!2)}.play;


///////////////////////////////////////////////////////////

// Using Signal.waveFill to take full control over the signal shape
// waveFill acts a lot like collect (you pass it a function)
(
var sig, wt;
sig = Signal.newClear(1024);
sig.waveFill({
arg x, old, i;
var out;
out = sin(x.pow(1.5));
out = out * 1.5;
out = out.fold(-1,1);
out = out.cubed;
}, 0, 2pi);
wt = sig.asWavetable;
b.loadCollection(wt);
)

b.plot('sc:buffer');

{Osc.ar(b, MouseX.kr(10, 10000, 1)*[1,2.01], mul:0.2!2)}.play;
s.freeAll;


///////////////////////////////////////////////////////////

// So there are at least 4 different ways to create wavetables:
// - Signal.sineFill
// - b.sine1/2/3 (example not in this file)
// - Env().asSignal
// - Signal.waveFill
93 changes: 93 additions & 0 deletions files/24-wavetables-2.sc
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
s.boot;
s.quit;
s.scope;
FreqScope.new;

// This tutorial is about morphing between multiple wavetables
// In a musical piece, we don't want a hard cut between different wavetables
// VOsc is designed to morph/mix between different wavetables
// First we need at least 2 wavetables
(
~wt0 = Signal.sineFill(
1024,
1/(1..8),
0!8
).asWavetable;

~wt1 = Signal.sineFill(
1024,
[1,0,1/2,1,1/4],
[0,0,pi,0,pi]
).asWavetable;
)

~wt0.plot;
~wt1.plot;

// Load them into buffers on the local server
(
~b0 = Buffer.loadCollection(s, ~wt0);
~b1 = Buffer.loadCollection(s, ~wt1);
)

// And now play them
(
{
var sig;
// morph between bufnum 0 and 1 using the mouse
sig = VOsc.ar(MouseX.kr(0,1), 300, mul:0.2!2);
}.play;
)

// let's use a SynthDef to clean things up and make it more flexible

(
SynthDef(\vosc, { | out=0 |
var sig, bufpos;
bufpos = MouseX.kr(0,1);
sig = VOsc.ar(bufpos, 300, mul:0.2!2);
Out.ar(out, sig);
}).add;
)

Synth(\vosc);

// Note: all the buffers VOsc uses must be the same size
// but this is still sloppy because we have to hardcode the actual bufnums

~buf = Buffer.allocConsecutive(4, s, 2048);

(
~wt = Array.fill(4, {
var numSegs = rrand(4,20);
Env(
[0]++(({rrand(0.0,1.0)}!(numSegs-1)) * [1,-1]).scramble++[0],
{exprand(1,20)}!numSegs,
{rrand(-20,20)}!numSegs
).asSignal(1024).asWavetable;
});
)

(
~buf.do({
arg buf, i;
buf.loadCollection(~wt[i]);
});
)

~wt.do({arg n, i; n.plot('sc:'++~buf[i].bufnum.asString)});

(
SynthDef.new(\vosc, {
arg out=0, buf=0, numBufs=2, freq=300, amp=0.2;
var sig, bufpos, detuneSig;
detuneSig = LFNoise1.kr(0.2!8).bipolar(0.2).midiratio;
bufpos = buf + LFNoise1.kr(0.5).range(0, numBufs-1);
sig = VOsc.ar(bufpos, freq*detuneSig);
sig = Splay.ar(sig);
sig = LeakDC.ar(sig) * amp;
Out.ar(out, sig);
}).add;
)

Synth(\vosc, [\freq, 43.midicps, \buf, ~buf[0].bufnum, \numBufs, 4]);
Loading

0 comments on commit ffec387

Please sign in to comment.