forked from eberdahl/SaM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoud.mdl
144 lines (128 loc) · 9.08 KB
/
oud.mdl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# MDL file for Synth-A-Modeler
#
# (c) Edgar Berdahl, 2012
# Audio Communication Group
# Technical University of Berlin
#
# -------------------------------------------------------------------
#
# The above copyright notice including the copyright holders and this
# permission notice shall be included in all copies, substantial
# portions, or derivatives of the Software and Software portions.
#
# The end-user documentation included with the redistribution, if any,
# must include the following acknowledgment: "This software was
# developed at least in part using Synth-A-Modeler, which is a modular
# and open-source environment for designing physical models (see
# https://github.com/eberdahl/SaM)", in the same place and form as other
# third-party acknowledgments. In addition, this acknowledgment must
# appear in the software itself in the same form and location as other
# such third-party acknowledgments.
#
# Alternatively, if software is generated using Synth-A-Modeler, then
# the end-user documentation included with the generated software, if
# any, must include the following statement: "This software was generated
# using Synth-A-Modeler, which is a modular and open-source environment
# for designing physical models (see https://github.com/eberdahl/SaM)",
# in the same place and form as other third-party acknowledgments. In
# addition, this acknowledgment must appear prominently in any software
# generated by Synth-A-Modeler in the same form and location as other
# such third-party acknowledgments, and in such a manner that users
# will be aware that the software was generated by Synth-A-Modeler.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation except subject to the additional
# attribution requirements described beneath the copyright notice above.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the modified GNU General Public
# License along with this program.
port(),dev0; # pos 627,709
port(),dev1;
pluck(k,R,maxdisp,0.0),p0,junct0,dev0;
pluck(k,R,maxdisp,0.0),p1,junct0cpy,dev0;
pluck(k,R,maxdisp,0.0),p2,junct0cpy1,dev0;
pluck(k,R,maxdisp,0.0),p3,junct0cpy2,dev0;
pluck(k,R,maxdisp,0.0),p4,junct0cpy3,dev0;
pluck(k,R,maxdisp,0.0),p5,junct0cpy4,dev0;
pluck(k,R,maxdisp,0.0),p6,junct0cpy5,dev0;
pluck(k,R,maxdisp,0.0),p7,junct0cpy6,dev0;
pluck(k,R,maxdisp,0.0),p8,junct0cpy7,dev0;
pluck(k,R,maxdisp,0.0),p9,junct0cpy8,dev0;
waveguide(2.5,simpleString(0.027,(1.0/(noteC-beatSpeed-beatVar))*relPos-simpleStringTermDelay(bridgeFc))),wg0,bridge,junct0;
waveguide(2.5,simpleString(0.027,(1.0/(noteC-beatSpeed-beatVar))*(1.0-relPos)-simpleStringTermDelay(fretFc))),wg1,fret,junct0;
waveguide(2.5,simpleString(0.027,(1.0/noteC)*relPos-simpleStringTermDelay(bridgeFc))),wg0cpy,bridgecpy,junct0cpy;
waveguide(2.5,simpleString(0.027,(1.0/noteC)*(1.0-relPos)-simpleStringTermDelay(fretFc))),wg1cpy,fretcpy,junct0cpy;
waveguide(2.5,simpleString(0.027,(1.0/(noteG-beatSpeed+beatVar))*relPos-simpleStringTermDelay(bridgeFc))),wg0cpy1,bridgecpy1,junct0cpy1;
waveguide(2.5,simpleString(0.027,(1.0/(noteG-beatSpeed+beatVar))*(1.0-relPos)-simpleStringTermDelay(fretFc))),wg1cpy1,fretcpy1,junct0cpy1;
waveguide(2.5,simpleString(0.027,(1.0/noteG)*relPos-simpleStringTermDelay(bridgeFc))),wg0cpy2,bridgecpy2,junct0cpy2;
waveguide(2.5,simpleString(0.027,(1.0/noteG)*(1.0-relPos)-simpleStringTermDelay(fretFc))),wg1cpy2,fretcpy2,junct0cpy2;
waveguide(2.5,simpleString(0.027,(1.0/(noteD-beatSpeed-beatVar*0.4))*relPos-simpleStringTermDelay(bridgeFc))),wg0cpy3,bridgecpy3,junct0cpy3;
waveguide(2.5,simpleString(0.027,(1.0/(noteD-beatSpeed-beatVar*0.4))*(1.0-relPos)-simpleStringTermDelay(fretFc))),wg1cpy3,fretcpy3,junct0cpy3;
waveguide(2.5,simpleString(0.027,(1.0/noteD)*relPos-simpleStringTermDelay(bridgeFc))),wg0cpy4,bridgecpy4,junct0cpy4;
waveguide(2.5,simpleString(0.027,(1.0/noteD)*(1.0-relPos)-simpleStringTermDelay(fretFc))),wg1cpy4,fretcpy4,junct0cpy4;
waveguide(2.5,simpleString(0.027,(1.0/(noteA-beatSpeed+beatVar*0.66))*relPos-simpleStringTermDelay(bridgeFc))),wg0cpy5,bridgecpy5,junct0cpy5;
waveguide(2.5,simpleString(0.027,(1.0/(noteA-beatSpeed+beatVar*0.66))*(1.0-relPos)-simpleStringTermDelay(fretFc))),wg1cpy5,fretcpy5,junct0cpy5;
waveguide(2.5,simpleString(0.027,(1.0/noteA)*relPos-simpleStringTermDelay(bridgeFc))),wg0cpy6,bridgecpy6,junct0cpy6;
waveguide(2.5,simpleString(0.027,(1.0/noteA)*(1.0-relPos)-simpleStringTermDelay(fretFc))),wg1cpy6,fretcpy6,junct0cpy6;
waveguide(2.5,simpleString(0.027,(1.0/(noteF-beatSpeed))*relPos-simpleStringTermDelay(bridgeFc))),wg0cpy7,bridgecpy7,junct0cpy7;
waveguide(2.5,simpleString(0.027,(1.0/(noteF-beatSpeed))*(1.0-relPos)-simpleStringTermDelay(fretFc))),wg1cpy7,fretcpy7,junct0cpy7;
waveguide(2.5,simpleString(0.027,(1.0/noteF)*relPos-simpleStringTermDelay(bridgeFc))),wg0cpy8,bridgecpy8,junct0cpy8;
waveguide(2.5,simpleString(0.027,(1.0/noteF)*(1.0-relPos)-simpleStringTermDelay(fretFc))),wg1cpy8,fretcpy8,junct0cpy8;
termination(simpleStringTerm(-1.0+pow(10.0,-bridgeAtten:float), bridgeFc)),bridge; # pos 160,146
termination(simpleStringTerm(-1.0+pow(10.0,-fretAtten:float), fretFc)),fret; # pos 672,146
termination(simpleStringTerm(-1.0+pow(10.0,-fretAtten:float), fretFc)),fretcpy; # pos 672,178
termination(simpleStringTerm(-1.0+pow(10.0,-bridgeAtten:float), bridgeFc)),bridgecpy; # pos 160,178
termination(simpleStringTerm(-1.0+pow(10.0,-fretAtten:float), fretFc)),fretcpy1; # pos 672,258
termination(simpleStringTerm(-1.0+pow(10.0,-bridgeAtten:float), bridgeFc)),bridgecpy1; # pos 160,258
termination(simpleStringTerm(-1.0+pow(10.0,-fretAtten:float), fretFc)),fretcpy2; # pos 664,290
termination(simpleStringTerm(-1.0+pow(10.0,-bridgeAtten:float), bridgeFc)),bridgecpy2; # pos 152,290
termination(simpleStringTerm(-1.0+pow(10.0,-fretAtten:float), fretFc)),fretcpy3; # pos 688,370
termination(simpleStringTerm(-1.0+pow(10.0,-bridgeAtten:float), bridgeFc)),bridgecpy3; # pos 152,370
termination(simpleStringTerm(-1.0+pow(10.0,-fretAtten:float), fretFc)),fretcpy4; # pos 688,394
termination(simpleStringTerm(-1.0+pow(10.0,-bridgeAtten:float), bridgeFc)),bridgecpy4; # pos 152,394
termination(simpleStringTerm(-1.0+pow(10.0,-fretAtten:float), fretFc)),fretcpy5; # pos 672,458
termination(simpleStringTerm(-1.0+pow(10.0,-bridgeAtten:float), bridgeFc)),bridgecpy5; # pos 160,458
termination(simpleStringTerm(-1.0+pow(10.0,-fretAtten:float), fretFc)),fretcpy6; # pos 680,482
termination(simpleStringTerm(-1.0+pow(10.0,-bridgeAtten:float), bridgeFc)),bridgecpy6; # pos 160,482
termination(simpleStringTerm(-1.0+pow(10.0,-fretAtten:float), fretFc)),fretcpy7; # pos 688,562
termination(simpleStringTerm(-1.0+pow(10.0,-bridgeAtten:float), bridgeFc)),bridgecpy7; # pos 176,562
termination(simpleStringTerm(-1.0+pow(10.0,-fretAtten:float), fretFc)),fretcpy8; # pos 696,586
termination(simpleStringTerm(-1.0+pow(10.0,-bridgeAtten:float), bridgeFc)),bridgecpy8; # pos 176,586
junction(0.03),junct0; # pos 400,136
junction(0.033),junct0cpy; # pos 400,168
junction(0.015),junct0cpy1; # pos 400,248
junction(0.0153),junct0cpy2; # pos 400,280
junction(0.0),junct0cpy3; # pos 400,360
junction(0.003),junct0cpy4; # pos 400,384
junction(-0.015),junct0cpy5; # pos 400,448
junction(-0.0153),junct0cpy6; # pos 400,472
junction(-0.03),junct0cpy7; # pos 400,552
junction(-0.033),junct0cpy8; # pos 400,576
faustcode: freqMIDI=hslider("Frequency [MIDI]", 27.0, 20.0, 84.0, 0.05);
faustcode: beatSpeed=hslider("Beating speed", 1.0, 0.3, 10.0, 0.1);
faustcode: beatVar=beatSpeed*hslider("Beating variability", 1.0, 0.0, 3.0, 0.01);
faustcode: freq = 440.0*pow(2.0,(freqMIDI-69.0)/12.0);
faustcode: k=hslider("Pluck stiffness [N/m]",100.0,0.0,1000.0,10.0);
faustcode: R=hslider("Pluck damping [N/(m/s)]",0.1,0.0,2.5,0.01);
faustcode: relPos=hslider("Pluck position along length",0.29,0.05,0.95,0.01);
faustcode: maxdisp=hslider("Pluck half-width [m]",0.006,0.001,0.01,0.001);
faustcode: bridgeAtten=hslider("Bridge attenuation",2.5,0.5,7.0,0.01);
faustcode: bridgeFc=hslider("Bridge cutoff freq [Hz]",5000.0,1000.0,fs,10.0);
faustcode: fretAtten=hslider("Fret attenuation",2.5,0.5,7.0,0.01);
faustcode: fretFc=hslider("Fret cutoff freq [Hz]",5000.0,1000.0,fs,10.0);
faustcode: moveStrings=hslider("Waveguides position adjustment",1.0,0.1,1.4,0.01);
faustcode: vol=hslider("Z Volume",0.3,0.01,1.0,0.01) : onePoleBLT(10.0); // LP filter with cutoff frequency at 10Hz smoothes volume control signal
faustcode: outputDSP=highpass(4,20.0);
faustcode: noteF=174.61;
faustcode: noteA=220.0;
faustcode: noteD=293.66;
faustcode: noteG=392.0;
faustcode: noteC=523.25;
audioout,a0,(bridge*1.0+bridgecpy*1.0+bridgecpy1*1.0+bridgecpy2*1.0+bridgecpy3*1.0+bridgecpy4*1.0+bridgecpy5*1.0+bridgecpy6*1.0+bridgecpy7*1.0+bridgecpy8*1.0):outputDSP:bodyResp1:SAMfreereverb; # pos 59,336
audioout,a1,(fret*vol+fretcpy*vol+fretcpy1*vol+fretcpy2*vol+fretcpy3*vol+fretcpy4*vol+fretcpy5*vol+fretcpy6*vol+fretcpy7*vol+fretcpy8*vol):outputDSP:bodyResp2:SAMfreereverb; # pos 851,336