Skip to content

Instantly share code, notes, and snippets.

@yotamorimoto
Last active July 28, 2021 11:25
Show Gist options
  • Select an option

  • Save yotamorimoto/2338151 to your computer and use it in GitHub Desktop.

Select an option

Save yotamorimoto/2338151 to your computer and use it in GitHub Desktop.
lead
リードシンセとリバーブ
(
// メロディ用のリードシンセ
SynthDef(\lead, { |out=0, gate=1, amp=0.1, freq=440|
var sig, env;
env = EnvGen.kr(Env.adsr(0.01), gate, amp, 0, 1, 2);
sig = Mix.ar(LFTri.ar([freq, freq*2])); // オクターブを重ねる
sig = HPF.ar(sig, 500);
sig = sig * env;
Out.ar(out, sig);
}).add;
// リバーブ
SynthDef(\reverb, { |gate=1, out=0|
var sig, rev, env;
env = Linen.kr(gate, 0.05, 1, 0.01, 2); // 簡易のエンベロープ
sig = In.ar(out, 1) * 0.5;
rev = BPF.ar(sig, 1000); // リバーブへの入力を制限する
// 左右異なる残響を4つ直列でつなぎリバーブをつくる
4.do { rev = AllpassN.ar(rev, 0.050, [0.050.rand, 0.050.rand], 1) };
sig = sig + rev; // 元の音とミックス
sig = sig * env;
ReplaceOut.ar(out, sig);
}).add;
)
(
~leadA = Pfxb(
Pbind(\instrument, \lead,
\dur, Pseq([
4, Pn(0.5, 5),
0.25, 0.25, 0.5, 0.5, 6, 1, 1,
4, Pn(0.5, 5),
0.25, 0.25, 0.5, 0.5, 6, 1, 1
], 1),
\legato, 1.1,
\amp, 0.3,
\scale, [2, 4, 5, 7, 9, 10, 12],
\degree, Pseq([
2, \, 2, 3, 2, 1, 1, 0, -1, -3, 0, 0, 1,
2, \, 2, 3, 2, 1, 1, 0, -1, 0, 4, \, \
], inf),
\octave, 6
),
\reverb
).play;
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment