forked from eberdahl/SaM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwaveguide_drum.mdl
100 lines (84 loc) · 5.43 KB
/
waveguide_drum.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
# 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.
# To do: Make the GUI elements hierarchical
faustcode:frequencyScaler = 0.3;
faustcode:outputDSP=highpass(4,20.0);
faustcode:vol=0.1*hslider("Z Volume",0.7,0.01,1.0,0.01) : onePoleBLT(10.0); // LP filter with cutoff frequency at 10Hz smoothes volume control signal
faustcode:fc1=hslider("Term cutoff freq 1 [Hz]",35000.0,1000.0,fs,10.0);
faustcode:fc2=hslider("Term cutoff freq 2 [Hz]",28000.0,1000.0,fs,10.0);
faustcode:fc3=hslider("Term cutoff freq 3 [Hz]",32000.0,1000.0,fs,10.0);
faustcode:fc4=hslider("Term cutoff freq 4 [Hz]",21000.0,1000.0,fs,10.0);
faustcode:fcALL=hslider("Term cutoff freq SCALE ALL",0.23,0.01,1.0,0.001);
faustcode:t1reflCoef=(10.0, (hslider("Term reflection loss 1 [dB]",-89.0,-100.0,-1.0,1.0):/(20.0):float)):pow:-(1.0):*(-1.0);
faustcode:t2reflCoef=(10.0, (hslider("Term reflection loss 2 [dB]",-67.0,-100.0,-1.0,1.0):/(20.0):float)):pow:-(1.0):*(1.0);
faustcode:t3reflCoef=(10.0, (hslider("Term reflection loss 3 [dB]",-81.0,-100.0,-1.0,1.0):/(20.0):float)):pow:-(1.0):*(-1.0);
faustcode:t4reflCoef=(10.0, (hslider("Term reflection loss 4 [dB]",-68.0,-100.0,-1.0,1.0):/(20.0):float)):pow:-(1.0):*(1.0);
#faustcode:t1reflCoef=(10.0, (hslider("Term reflection loss 1 [dB]",-60.0,-100.0,-1.0,1.0):/(20.0):float)):pow:-(1.0):*(checkbox("Term 1 positive gain"):*(2):-(1));
#faustcode:t2reflCoef=(10.0, (hslider("Term reflection loss 2 [dB]",-60.0,-100.0,-1.0,1.0):/(20.0):float)):pow:-(1.0):*(checkbox("Term 2 positive gain"):*(2):-(1));
#faustcode:t3reflCoef=(10.0, (hslider("Term reflection loss 3 [dB]",-60.0,-100.0,-1.0,1.0):/(20.0):float)):pow:-(1.0):*(checkbox("Term 3 positive gain"):*(2):-(1));
#faustcode:t4reflCoef=(10.0, (hslider("Term reflection loss 4 [dB]",-60.0,-100.0,-1.0,1.0):/(20.0):float)):pow:-(1.0):*(checkbox("Term 4 positive gain"):*(2):-(1));
faustcode:maxDelTime=0.05;
faustcode:delTime1=0.001*delTimeSc*hslider("Waveguide delay 1 [ms]", 21.0, 0.01, maxDelTime*1000.0, 0.01);
faustcode:delTime2=0.001*delTimeSc*hslider("Waveguide delay 2 [ms]", 30.0, 0.01, maxDelTime*1000.0, 0.01);
faustcode:delTime3=0.001*delTimeSc*hslider("Waveguide delay 3 [ms]", 9.5, 0.01, maxDelTime*1000.0, 0.01);
faustcode:delTime4=0.001*delTimeSc*hslider("Waveguide delay 4 [ms]", 19.0, 0.01, maxDelTime*1000.0, 0.01);
faustcode:delTimeSc=hslider("Waveguide delay SCALE ALL", 0.21, 0.001, 1.0, 0.001);
faustcode:wiSc=hslider("Waveguide impedance SCALE ALL", 0.84, 0.001, 1.0, 0.001);
termination(simpleStringTerm(t1reflCoef,fc1*fcALL)),t1 ;
waveguide(0.5*wiSc, simpleString(maxDelTime, delTime1)),w1,t1 ,junct1;
termination(simpleStringTerm(t2reflCoef,fc2*fcALL)), t2;
waveguide(0.5*wiSc,simpleString(maxDelTime, delTime2)),w2,t2, junct1;
termination(simpleStringTerm(t3reflCoef,fc3*fcALL) ),t3 ;
waveguide(0.5*wiSc, simpleString(maxDelTime, delTime3)),w3,t3 ,junct1;
termination(simpleStringTerm(t4reflCoef,fc4*fcALL)), t4;
waveguide(0.5*wiSc,simpleString(maxDelTime, delTime4)),w4,t4, junct1;
junction(0.0),junct1; # we can have comments after lines as well
faustcode: k=hslider("Pluck stiffness [N/m]",650.0,50.0,1000.0,50.0);
faustcode: R=hslider("Pluck damping [N/(m/s)]",0.15,0.0,2.5,0.01);
pluck(k, R, 0.006, 0.0),touch1 ,junct1, dev1;
port( ),dev1;
port( ),dev2;
audioout,a1,t1:outputDSP:*(vol);
audioout,a2,t2:outputDSP:*(vol);