I added “\pitch, 1 - xys[1]” to “MultiTouchPad.setAction” This way pitch is dynamic for each living blob. Maybe it was meant to be this way? Anyway it’s fun both ways. Thanks for the new years gift This made me discover MTP.
Simply stopping with command-period doesn’t stop Tongsengmod. One needs to run “MultiTouchPad.stop” before restarting the whole thing.
// It's recommended to disable all Trackpad gestures before playing.
// 1. 安装 git:
// 1. Install git:
// https://git-scm.com
// 2. 打开 Terminal,逐行输入:
// 2. Open Terminal and run:
//
// xcode-select --install
// git clone https://github.com/batuhan/tongsengmod.git
// cd tongsengmod
// make
// sudo make install
// 3. 运行这一句(把光标放到这句内按 Command + 回车):
// 3. Install a Quark :
Quarks.install("MultiTouchPad");
// 4. 运行这一句:
// 4. Run this:
s.reboot();
// 5. 运行这一段。下面还有一段:
// 5. Run this, there's another part below:
(
var scale, buff, revBus, modBus, rev;
revBus = Bus.audio(s, 1);
modBus = Bus.audio(s, 1);
scale = Scale.minorPentatonic(\just).degrees;
buff = Buffer.alloc(s, scale.size, 1, {|a| a.setnMsg(0, scale)});
SynthDef(\reverb,
{
arg inBus, revLvl, time = 0.5, damping = 0.5;
var rev;
rev = GVerb.ar (
In.ar(modBus) * revLvl,
300,
time,
damping,
0.85, // inputbw
5, // spread
0.5,
-5,
0.9,
301,
1
);
Out.ar(0, rev.tanh);
}).add;
SynthDef(\osc,
{
arg pitch, lPingSpd, rPingSpd, modIndex, vol, q, noteMin, noteMax;
var note, freq, modSig, lSnd, rSnd, cs, monoSig;
cs = ControlSpec(noteMin, noteMax, \lin, 1, noteMin);
note = cs.map(pitch);
freq = DegreeToKey.ar(buff.bufnum, note, 12, 1, 0).midicps;
modSig = InFeedback.ar(modBus, 1) * modIndex * freq;
lSnd = RLPF.ar(
Dust.ar(lPingSpd),
freq + modSig,
q,
1
);
rSnd = RLPF.ar(
Dust.ar(rPingSpd),
freq + modSig,
q,
1
);
monoSig = Mix.new([lSnd, rSnd]);
Out.ar(modBus, monoSig.tanh);
Out.ar(revBus, monoSig.tanh);
Out.ar(0, [lSnd, rSnd].tanh);
}
).add;
)
// 6. 运行这一段:
// 6. Run this:
(
var window, oscDict = Dictionary.new, noteRange = [25, 40];
var slider0, slider1;
var maxRange = [15, 45];
var rev, revLvl;
window = Window.new("孟奇 Meng Qi - Ping Garden", Rect(650, 100, 500, 360)).front;
if (MultiTouchPad.guiOn, {"Touch Pad GUI On".postln}, {MultiTouchPad.gui});
window.onClose = {
MultiTouchPad.stop;
oscDict.collect { arg item; item.free };
oscDict.keys.do { arg key; oscDict.removeAt(key) };
rev.free;
};
window.view.decorator = FlowLayout(window.view.bounds, 20@20, 20@10);
slider0 = RangeSlider(window, 40@280)
.lo_(0.18)
.hi_(0.85)
.action_({
|slider|
noteRange[0] = slider.lo.linlin(0.0, 1.0, maxRange[0], maxRange[1]).asInteger;
noteRange[1] = slider.hi.linlin(0.0, 1.0, maxRange[0], maxRange[1]).asInteger;
[slider.lo, noteRange[0], slider.hi, noteRange[1]].postln;
}
);
slider1 = Array.fill(3, { Slider(window.view, 40@280)});
slider1.size.do { |i|
slider1.at(i)
.value_(0.1)
.action_({
var revMix = slider1.at(0).value,
damping = slider1.at(1).value * 0.9 + 0.1,
time = slider1.at(2).value;
rev.set(\revLvl, revMix * 0.5,
\time, time * 10,
\damping, damping
);
}
)
};
StaticText(window, 220@280)
.align_(\left)
.string_(
"Ping Garden
触控板操作
X - 左右声道触发密度,中央静音;
Y - 起始点决定音高
Z - 延音时长 和 调频深度
touch your trackpad
X - ping density left / right;
Y - starting point = pitch
Z - decay & FM index
孟奇 Meng Qi / 2020.02
Instagram : @mengqimusic
微信公众号:合成少数派");
window.view.decorator.nextLine;
4.do {
|i|
StaticText(window, 40@35)
.align_(\left)
.string_(["🎹","🏔","🏞","✨"].at(i))};
rev = Synth(\reverb, [\revLvl, 0.05]);
MultiTouchPad.resetActions.start;
MultiTouchPad.touchAction =
{
|curID, xys|
oscDict.put(curID, Synth.head(s, \osc,
[
\pitch, 1 - xys[1],
\vol, 1,
\noteMin, noteRange[0],
\noteMax, noteRange[1]
]
);
);
};
MultiTouchPad.untouchAction =
{
|curID|
oscDict.at(curID).free;
oscDict.removeAt(curID);
};
MultiTouchPad.setAction =
{
|curID, xys|
oscDict.at(curID).set(
\lPingSpd, xys[0].bilin(0.5, 0.0,1.0,0.0,5.0,0.0),
\rPingSpd, xys[0].bilin(0.5, 0.0,1.0,0.0,0.0,5.0),
\pitch, 1 - xys[1],
\modIndex, xys[2].linexp(0.0, 2.08, 0.01, 2.0),
\q, (2.08 - xys[2]).linexp(0.0, 2.08, 0.001, 0.25)
);
};
)