Skip to content

Instantly share code, notes, and snippets.

@bwestergard
Last active October 12, 2018 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bwestergard/dad112af642ccbfb4aeb2018abd9a62d to your computer and use it in GitHub Desktop.
Save bwestergard/dad112af642ccbfb4aeb2018abd9a62d to your computer and use it in GitHub Desktop.
Modal Transposition Study
TempoClock.default.tempo = 90/120;
(
SynthDef(\tinn, { |amp, freq = 440, sustain = 1, startf = 20000, endf = 80, q = 0.8 |
var detune = 0.01;
var sig = Splay.ar(
VarSaw.ar(LFNoise2.ar(8).exprange(freq * (1-detune), freq * (1+detune)) * [0.99,1/2,1/2.001,1,1.01], width: LFNoise2.ar(1/2).exprange(0.5, XLine.ar(0.5,0.03,sustain/8))) * XLine.ar(1e-10,1, 0.01) * XLine.ar(1,1e-10, sustain, doneAction: 2),
XLine.ar(0.2,1,sustain/3)
);
Out.ar(0, RLPF.ar(sig, XLine.ar(startf, endf, sustain / 16), q) * amp)
}).store
)
(
(
Pbind(
\instrument, \tinn,
\mtranspose, (Pstep([1,1,4,4, 0,0,0,0, 1,1,4,4, 5,3,2,1], 1/2, inf) + (Pstep(Pseq([0,0,1,3], inf), 8, inf) % 7))
) <> Ppar([
Pfindur(8*6,
Pbind(
\octave, 5,
\degree, Pstep(((Array.series(8,7,-1) ! 2) ++ (Array.series(8,0,1) ! 2)).flatten, 1/8, inf),
\dur, Pseq([
2, 2, 1, 1, 1, 1,
Pseq([
Pconst(0.25, 1/8),
Pconst(7.75, Pn(Pshuf([2,1,1,3,1,2,1]))/Pstep([8,4],4))
], inf)
]),
\legato, 16,
\startf, 16000,
\endf, 2000
)
),
Pfindur(8*7,
Pbind(
\octave, 5,
\degree, Pseq([8,4,6,2] ! 2, inf),
\strum, Pseq([\rest,Pn(1/16)]),
\dur, Pseq([1/2,Pn(2)]),
\legato, Pstep([4,8,4,16], 2, inf),
\db, -28,
\startf, 1000,
\endf, 20000,
\q, 0.9
)
),
Pfindur(8*6,
Pbind(
\octave, 3,
\degree, Pstep([0,4,0,4,0,4,1,2], 1/2, inf),
\dur, Pstep([3,1,2,4], 1, inf) / Pstep([8,8,2,4],4, inf),
\legato, 16,
\db, -12,
\startf, 8000,
\endf, 8000,
\q, 0.8
)
)
])
).play
)
@bwestergard
Copy link
Author

Polyphonic variant:

TempoClock.default.tempo = 90/120;

(
SynthDef(\tinn, { |amp, freq = 440, sustain = 1, startf = 20000, endf = 80, q = 0.8 |
	var detune = 0.01;
	var sig = Splay.ar(
		VarSaw.ar(LFNoise2.ar(8).exprange(freq * (1-detune), freq * (1+detune)) * [0.99,1/2,1/2.001,1,1.01], width: LFNoise2.ar(1/2).exprange(0.5, XLine.ar(0.5,0.03,sustain/8))) * XLine.ar(1e-10,1, 0.01) * XLine.ar(1,1e-10, sustain, doneAction: 2),
		XLine.ar(0.2,1,sustain/3)
	    );
	Out.ar(0, RLPF.ar(sig, XLine.ar(startf, endf, sustain / 8), q) * amp)
}).store
)

(
(
Pbind(
	\instrument, \tinn,
	\mtranspose, (Pstep([1,1,4,4, 0,0,0,0, 1,1,4,4, 5,3,2,1], 1/2, inf) + (Pstep(Pseq([0,0,1,3], inf), 8, inf) % 7))
) <> Ppar([
	Pfindur(8*7,
		Pbind(
			\octave, 5,
			\degree, Pstep(((Array.series(8,7,-1).rotate(3) ! 2) ++ (Array.series(8,0,1).rotate(3) ! 2)).flatten, 1/8, inf),
			\dur, Pseq([
				0.25, 2, 2,  1, 1, 1, 1,
				Pseq([
					Pconst(1, 1/8),
					Pconst(7, Pn(Pshuf([2,1,1,3,1,2,1]))/Pstep([8,4],4))
				], inf)
			]),
			\legato, 16,
			\startf, 16000,
			\endf, 2000
		)
	),
	Pfindur(8*7,
		Pbind(
			\octave, 5,
			\degree, Pstep(((Array.series(8,7,-1) ! 2) ++ (Array.series(8,0,1) ! 2)).flatten, 1/8, inf),
			\dur, Pseq([
				2, 2,  1, 1, 1, 1,
				Pseq([
					Pconst(0.25, 1/8),
					Pconst(7.75, Pn(Pshuf([2,1,1,3,1,2,1]))/Pstep([8,4],4))
				], inf)
			]),
			\legato, 16,
			\startf, 16000,
			\endf, 2000
		)
	),
	Pfindur(8*7,
		Pbind(
			\octave, 5,
			\degree, Pseq([8,4,6,2] ! 2, inf),
			\strum, Pseq([\rest,Pn(1/16)]),
			\dur, Pseq([1/2,Pn(2)]),
			\legato, Pstep([4,8,4,16], 2, inf),
			\db, -28,
			\startf, 1000,
			\endf, 20000,
			\q, 0.9
		)
	),
	Pfindur(8*6,
		Pbind(
			\octave, 3,
			\degree, Pstep([0,4,0,4,0,4,1,2], 1/2, inf),
			\dur, Pstep([3,1,2,4], 1, inf) / Pstep([8,8,2,4],4, inf),
			\legato, 16,
			\db, -12,
			\startf, 8000,
			\endf, 8000,
			\q, 0.8
		)
	)
])
).play
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment