MM – Physical modelling

This one covers Membranes, OteyPiano, DWGBowedTor and DWGPlucked2. The rest aren’t as interesting IMHO and can also produce ultra harsh piercing sounds.

You can execute the Pbinds and play drums at different pitches on top.

You’ll need to install the ChordSymbol addon:

https://github.com/triss/ChordSymbol

You’ll also need EZConv for (convolution) reverb:

https://github.com/davidgranstrom/EZConv

Finally, get the IR here:

https://drive.google.com/open?id=1VNqi5w8qvcGphdp1VJErzVPqjF9ho96A

//MM Physical model implementations. 2020 Matias Monteagudo.
//This one covers Membranes, OteyPiano, DWGBowedTor and DWGPlucked2. The rest aren't as interesting IMHO and can also produce ultra harsh piercing sounds.

//My interface options. Change at will.

(
Server.local.options.memSize=16384;
Server.local.options.device = "ASIO : ASIO PreSonus FireStudio";
Server.local.options.sampleRate=48000;
Server.local.options.hardwareBufferSize=128;
)

//Add reverb. (Convolution, no less!)

//Load your IR.
(
~path="drop_your_IR_here";
~ezConv=EZConv(~path);
)

~ezConv.numChannels;//Test how many channels your IR has.
~ezConv.free; //Unload the IR. You might want to do this before loading a new one.

//Evaluate the Reverb engine.
(
z.free; //This will free itself before each time you evaulate to avoid overload due to stacking.
(
SynthDef(\Convr, { |out, wet=0.1, dry=1|
	var signal, process;
	signal = In.ar(out, 2);
	process=~ezConv.ar([signal[0],signal[1]],0.1,1); //(signals, leak, mult)
	ReplaceOut.ar(0, (process*wet)+(signal*dry));
}).add;
);

z = Synth(\Convr, [\outbus, 0, \wet, 0.1, \dry, 1], addAction:\addToTail);

)

z.free;//To stop reverb if you need.

//Synth Drum1

(
SynthDef(\drum1, {
	|amp=1, gate=1, panpos=0, ext=1, freq=1, loss=0.99999|
	var sig,exciter,pan;
	exciter=PinkNoise.ar(EnvGen.ar(Env([0,ext,0],[0.001,15],-512,2),gate, doneAction:2)); //Very sharp curve (512) but the envelope lasts 15s, Note doneAction2 to free the node.
	sig=MembraneCircle.ar(exciter,freq,loss,amp);
	pan=Balance2.ar(sig,sig,panpos,1);
	Out.ar(0, pan)
}).add
)

//Test

Synth(\drum1, [\amp,0.06, \panpos,0, \ext,2, \freq,0.002, \loss,0.99999])
Synth(\drum1, [\amp,0.06, \panpos,0, \ext,2, \freq,0.0097, \loss,0.99999])
Synth(\drum1, [\amp,0.06, \panpos,0, \ext,3, \freq,0.082, \loss,0.99999])
Synth(\drum1, [\amp,0.06, \panpos,0, \ext,5, \freq,0.2, \loss,0.99999])
Synth(\drum1, [\amp,0.06, \panpos,0, \ext,5, \freq,0.25, \loss,0.99999])

//Synth Drum2

(
SynthDef(\drum2, {
	|amp=1, gate=1, panpos=0, ext=1, freq=1, loss=1|
	var sig,exciter,pan;
	exciter=PinkNoise.ar(EnvGen.ar(Env([0,ext,0],[0.001,15],-512,2),gate, doneAction:2)); //Very sharp curve (512) but the envelope lasts 15s, Note doneAction2 to free the node.
	sig=MembraneHexagon.ar(exciter,freq,loss,amp);
	pan=Balance2.ar(sig,sig,panpos,1);
	Out.ar(0, pan)
}).add
)

//Test

Synth(\drum2, [\amp,0.06, \panpos,0, \ext,1, \freq,0.002, \loss,0.99999])
Synth(\drum2, [\amp,0.06, \panpos,0, \ext,1, \freq,0.003, \loss,0.99999])
Synth(\drum2, [\amp,0.06, \panpos,0, \ext,1, \freq,0.005, \loss,0.99999])
Synth(\drum2, [\amp,0.06, \panpos,0, \ext,1, \freq,0.007, \loss,0.99999])
Synth(\drum2, [\amp,0.06, \panpos,0, \ext,1, \freq,0.0107, \loss,0.99999])
Synth(\drum2, [\amp,0.06, \panpos,0, \ext,1, \freq,0.021, \loss,0.99999])
Synth(\drum2, [\amp,0.06, \panpos,0, \ext,1, \freq,0.0225, \loss,0.99999])
Synth(\drum2, [\amp,0.06, \panpos,0, \ext,1, \freq,0.0285, \loss,0.99999])
Synth(\drum2, [\amp,0.06, \panpos,0, \ext,1, \freq,0.0345, \loss,0.99999])


//Synth OteyPiano (modified NOT to sound like a piano)

(
SynthDef(\opiano, {
	|amp=1, gate=1, vel=0.5, panpos=0, freq=1|
	var sig,pan;
	sig=OteyPiano.ar( //Careful! in general. Some of these values can result in MAX loud noises and also feedback noises. DO NOT TEST THIS AT LOUD VOLUMES!!
		freq, vel,
		rmin: 0.35, rmax:1, //Min and Max string radius.
		rampl: 4, rampr:8, //Do not match these two. Always good to use multiples of 2.
		rcore:1, //String core radius. Do not set over 2.
		lmin:0.07, lmax:0.9, //Do not invert these.
		lampl:-8, lampr: 8, //lenght of left and right sigmoidal shape. (whatever that is) Note how they mirror eachother. (-8,+8)
		rho:0.1, //String density multiplier. Do not set anywhere below 0.1 (loud noises)
		e:1, //Young modulus mult. Do not set above 4 (loud noises)
		zb:0.3, //Bridge impedance multiplier. Low values equals more volume. Set between 0.01,1.
		zh:0, //Hammer impedance multiplier.
		mh:1, //Mass hammer multiplier.
		k:0.05, //force hammer multiplier.
		alpha:1, //hysteresys hammer multiplier.
		p:0.2,  //stiffness_exponent_hammer multiplier.
		hpos:0.142, //	hammer position. (0 to 1) Do not set to anywhere past 0.5 (loud distortion)
		loss:0.1, //Acts as a damper at 100 or more.
		detune:0.0003, //Inter-String detune.
		hammer_type:1 //Hammer type 1 or 2
	)*EnvGen.ar(Env([0,0.5,0],[0.001,5.5],-4),gate,doneAction:2);
	pan=Balance2.ar(sig,sig,panpos,amp);
	Out.ar(0, pan)
}).add
)

//Test your model here.

(
w=Pbindef( //Note the use of Pbindef here so you can evaluate without starting a new pattern.
	\a, \instrument, \opiano, \scale,Scale.chromatic, \octave, 4, \ctranspose, 0,
    \dur, 1,
	\vel, 1,
	\degree, Pseq([[-1,1,4,7],[1,4,7,11],[4,7,11,13],[7,11,13,16]], inf), //Minor 7 tetrade in all 4 inversion
).play;
)

w.stop;

//BoweedTor (Cello mode)

(
SynthDef(\help_dwgbowed, { |out=0, freq=440, amp=0.5,force=1, gate=1,pos=0.07,c1=0.25,c3=31,pan=0|
    var vib = Gendy1.kr(1,1,1,1,0.1, 4,mul:0.003,add:1);
    var son = DWGBowedTor.ar(freq*vib, amp,force, gate,pos,0.1,c1,c3);
    son = DWGSoundBoard.ar(son);
    son = BPF.ar(son,118,1)+son;
    son = BPF.ar(son,230,1)+son;
    son = BPF.ar(son,290,1)+son;
    son = LPF.ar(son,3000);
    Out.ar(out, Pan2.ar(son * 0.1, pan,3));
}).add;
)

//Pbind

(
x=Pbindef(\b,
    \instrument, \help_dwgbowed, \octave,3, \ctranspose, 2,
	\legato, 0.5,
    \dur , 0.25,
	\force, 0.3,
	\pos, 0.9,
	\c1,0.1,
	\c3,31,
    \degree, Pseq([1,1,1,1,5,8,1,1,1,5,7+2,1,1,5,7+3,1,5,7+2], inf),
    \amp , Pseq([0.9,0.7,0.5],inf),
	\pan, Pwhite(-0.5,0.5),
).play;
)

x.stop;

//Synth Plucked 2
(
SynthDef(\help_dwgplucked, { |out=0, freq=440, amp=0.5, gate=1, c3=20, pan=0, rel=0.1, mistune=1.008, mp=0.55, gc=0.01|
    var env = Env.new([0,1, 1, 0],[0.001,0.006, 0.0005],[5,-5, -8]);
    var inp = amp * LFClipNoise.ar(2000) * EnvGen.ar(env,gate);
    var son = DWGPlucked2.ar(freq, amp, gate,0.1,1,c3,inp,rel,mistune,mp,gc);
    DetectSilence.ar(son, 0.001, doneAction:2);
    Out.ar(out, Pan2.ar(son * 0.1, pan));
}).add;
)

//Pbind

(
y=Pbindef(\c,
    \instrument, \help_dwgplucked, \octave,4, \ctranspose, 2,
	\legato, 0.5,
    \dur , 0.25,
    \degree, Pseq([1,1,1,1,1,5,8,1,1,1,5,7+2,1,1,5,7+3,1,5,7+2], inf),
	\rel, 0.0001,
	\mistune,4,
	\mp,0.55,
	\gc,0.01,
    \amp , Pseq([0.05,0.1,0.2]*2,inf),
	\pan, Pwhite(-0.5,0.5),
).play;
)

y.stop;
Author
554 PM
  • Platform:
  • Category: Sound Synthesizer
  • Revision: 1.0
  • License: GNU Lesser General Public License family
  • Views: 763
  • Modified: 2 years ago
Chat about this patch on Discord!
Appreciate 1

Leave a Reply