├── PathToDevice.txt ├── physicalmodeling.lib ├── .gitignore ├── Makefile.compile ├── pdhelp ├── oud-help.pd ├── pluck_one_string_pitch_control-help.pd ├── touch_a_membrane_on_top-help.pd ├── touch_a_membrane_underneath-help.pd ├── guiro-help.pd ├── bounce_mass_on_membrane-help.pd ├── percussion_fourth_try_presets-help.pd ├── touch_a_resonator-help.pd └── haptic_drum_demo-help.pd ├── help-patches ├── audioout-help.mdl ├── mass-help.mdl ├── port-help.mdl ├── ground-help.mdl ├── junction-help.mdl ├── resonators-help.mdl ├── termination-help.mdl ├── waveguide-help.mdl ├── touch-help.mdl ├── link-help.mdl └── pluck-help.mdl ├── Makefile.sccompile ├── README.md ├── PureDataFireFaderSimulator.pd ├── Makefile.mspcompile ├── Makefile.HOWTO ├── SAM-preprocessor ├── Makefile.qtcompile ├── ground_link.mdl ├── ground_touch.mdl ├── ground_pluck.mdl ├── wiggle_a_mass.mdl ├── Makefile.pdcompile ├── pluck_a_resonator.mdl ├── pluck_a_mass_on_link.mdl ├── touch_a_modal_resonator.mdl ├── pluck_a_mass_on_link_alex.mdl ├── guiro.mdl ├── SAM-reg-ex ├── touch_several_modal_resonators.mdl ├── touch_several_fixed_modal_resonators_with_virtual_drumstick.mdl ├── simple_snare.mdl ├── pluck_one_string_pitch_control.mdl ├── waveguide_drum.mdl ├── pluck_six_half_strings.mdl ├── throw_many_masses.mdl ├── oud.mdl ├── SAM-fx.lib ├── simple_snare_example_presets.mdl ├── haptic_drum_simulation.mdl ├── Makefile └── jack-qt.old.FAUST0.9.46andFAUST0.9.58.cpp /PathToDevice.txt: -------------------------------------------------------------------------------- 1 | /dev/cu.usbmodem1d11 2 | -------------------------------------------------------------------------------- /physicalmodeling.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eberdahl/SaM/HEAD/physicalmodeling.lib -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.mdx 2 | *.dsp 3 | *.ps 4 | jackqtdir/ 5 | puredatadir/ 6 | SAM-debug-compilation.txt 7 | -------------------------------------------------------------------------------- /Makefile.compile: -------------------------------------------------------------------------------- 1 | dspsrc := $(wildcard *.dsp) 2 | cppsrc := $(addprefix $(DEST), $(dspsrc:.dsp=.cpp)) 3 | appl := $(addprefix $(DEST), $(dspsrc:.dsp=$(EXT))) 4 | 5 | 6 | all : $(appl) 7 | 8 | 9 | $(DEST)%$(EXT) : %.dsp 10 | faust $(VEC) -a $(ARCH) $< -o $@.cpp 11 | $(CXX) $@.cpp $(CXXFLAGS) $(LIB) -o $@ 12 | 13 | 14 | clean : 15 | rm -f $(DEST) 16 | -------------------------------------------------------------------------------- /pdhelp/oud-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 991 378 554 517 10; 2 | #X obj 340 492 dac~; 3 | #X obj 252 36 hsl 128 15 -50 50 0 0 empty empty empty -2 -8 0 10 -262144 4 | -1 -1 2000 1; 5 | #X floatatom 418 113 5 0 0 0 - - -; 6 | #N canvas 58 176 158 175 make-smooth-audio-signal~ 0; 7 | #X obj 19 13 inlet; 8 | #X obj 19 37 * 0.001; 9 | #X obj 19 86 line~; 10 | #X msg 19 64 \$1 20; 11 | #X obj 79 66 outlet; 12 | #X obj 19 135 outlet~; 13 | #X obj 19 110 lp2~ 10 0.707 200; 14 | #X connect 0 0 1 0; 15 | #X connect 1 0 3 0; 16 | #X connect 1 0 4 0; 17 | #X connect 2 0 6 0; 18 | #X connect 3 0 2 0; 19 | #X connect 6 0 5 0; 20 | #X restore 249 56 pd make-smooth-audio-signal~; 21 | #X obj 195 150 oud; 22 | #X connect 1 0 3 0; 23 | #X connect 3 0 4 1; 24 | #X connect 3 1 2 0; 25 | #X connect 4 3 0 0; 26 | #X connect 4 4 0 1; 27 | -------------------------------------------------------------------------------- /pdhelp/pluck_one_string_pitch_control-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 993 373 554 517 10; 2 | #X obj 142 154 pluck_one_string_pitch_control; 3 | #X obj 340 492 dac~; 4 | #X obj 252 36 hsl 128 15 -50 50 0 0 empty empty empty -2 -8 0 10 -262144 5 | -1 -1 0 1; 6 | #X floatatom 418 113 5 0 0 0 - - -; 7 | #N canvas 58 176 158 175 make-smooth-audio-signal~ 0; 8 | #X obj 19 13 inlet; 9 | #X obj 19 37 * 0.001; 10 | #X obj 19 86 line~; 11 | #X msg 19 64 \$1 20; 12 | #X obj 79 66 outlet; 13 | #X obj 19 135 outlet~; 14 | #X obj 19 110 lp2~ 10 0.707 200; 15 | #X connect 0 0 1 0; 16 | #X connect 1 0 3 0; 17 | #X connect 1 0 4 0; 18 | #X connect 2 0 6 0; 19 | #X connect 3 0 2 0; 20 | #X connect 6 0 5 0; 21 | #X restore 249 56 pd make-smooth-audio-signal~; 22 | #X connect 0 3 1 0; 23 | #X connect 0 4 1 1; 24 | #X connect 2 0 4 0; 25 | #X connect 4 0 0 1; 26 | #X connect 4 1 3 0; 27 | -------------------------------------------------------------------------------- /pdhelp/touch_a_membrane_on_top-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 529 319 611 350 10; 2 | #X obj 384 165 r \$0-read; 3 | #X obj 384 195 faust-control \$0; 4 | #X obj 384 225 s \$0-write; 5 | #X obj 43 198 r \$0-in; 6 | #X obj 43 258 s \$0-out; 7 | #X obj 80 60 hsl 128 15 -50 50 0 0 empty empty empty -2 -8 0 10 -262144 8 | -1 -1 8600 1; 9 | #X floatatom 233 106 8 0 0 0 - - -; 10 | #N canvas 0 24 158 175 make-smooth-audio-signal~ 0; 11 | #X obj 19 13 inlet; 12 | #X obj 19 86 line~; 13 | #X msg 19 64 \$1 20; 14 | #X obj 79 66 outlet; 15 | #X obj 19 135 outlet~; 16 | #X obj 19 110 lp2~ 10 0.707 200; 17 | #X obj 19 37 * 0.0006; 18 | #X connect 0 0 6 0; 19 | #X connect 1 0 5 0; 20 | #X connect 2 0 1 0; 21 | #X connect 5 0 4 0; 22 | #X connect 6 0 2 0; 23 | #X connect 6 0 3 0; 24 | #X restore 68 84 pd make-smooth-audio-signal~; 25 | #X text 21 99 dev1; 26 | #X text 24 108 pos; 27 | #X text 264 95 Finger position; 28 | #X text 266 107 m; 29 | #X text 66 45 Position of finger interacting with resonator; 30 | #X obj 137 313 dac~; 31 | #X obj 147 282 *~ 0.1; 32 | #X obj 43 228 touch_a_membrane_on_top~; 33 | #X connect 0 0 1 0; 34 | #X connect 1 0 2 0; 35 | #X connect 3 0 15 0; 36 | #X connect 5 0 7 0; 37 | #X connect 7 0 15 1; 38 | #X connect 7 1 6 0; 39 | #X connect 14 0 13 0; 40 | #X connect 14 0 13 1; 41 | #X connect 15 0 4 0; 42 | #X connect 15 2 14 0; 43 | -------------------------------------------------------------------------------- /pdhelp/touch_a_membrane_underneath-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 529 319 611 350 10; 2 | #X obj 384 165 r \$0-read; 3 | #X obj 384 195 faust-control \$0; 4 | #X obj 384 225 s \$0-write; 5 | #X obj 43 198 r \$0-in; 6 | #X obj 43 258 s \$0-out; 7 | #X obj 80 60 hsl 128 15 -50 50 0 0 empty empty empty -2 -8 0 10 -262144 8 | -1 -1 0 1; 9 | #X floatatom 233 106 8 0 0 0 - - -; 10 | #N canvas 0 24 158 175 make-smooth-audio-signal~ 0; 11 | #X obj 19 13 inlet; 12 | #X obj 19 86 line~; 13 | #X msg 19 64 \$1 20; 14 | #X obj 79 66 outlet; 15 | #X obj 19 135 outlet~; 16 | #X obj 19 110 lp2~ 10 0.707 200; 17 | #X obj 19 37 * 0.0006; 18 | #X connect 0 0 6 0; 19 | #X connect 1 0 5 0; 20 | #X connect 2 0 1 0; 21 | #X connect 5 0 4 0; 22 | #X connect 6 0 2 0; 23 | #X connect 6 0 3 0; 24 | #X restore 68 84 pd make-smooth-audio-signal~; 25 | #X text 21 99 dev1; 26 | #X text 24 108 pos; 27 | #X text 264 95 Finger position; 28 | #X text 266 107 m; 29 | #X text 66 45 Position of finger interacting with resonator; 30 | #X obj 137 313 dac~; 31 | #X obj 147 282 *~ 0.1; 32 | #X obj 43 228 touch_a_membrane_underneath~; 33 | #X connect 0 0 1 0; 34 | #X connect 1 0 2 0; 35 | #X connect 3 0 15 0; 36 | #X connect 5 0 7 0; 37 | #X connect 7 0 15 1; 38 | #X connect 7 1 6 0; 39 | #X connect 14 0 13 0; 40 | #X connect 14 0 13 1; 41 | #X connect 15 0 4 0; 42 | #X connect 15 2 14 0; 43 | -------------------------------------------------------------------------------- /help-patches/audioout-help.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program; if not, write to the Free Software 21 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | faustcode: outputDSP=highpass(4,20.0); 36 | 37 | 38 | audioout,a0,0.0; # pos 83,168 39 | ## comment("Audioout",55,ff000000),comment0; # pos 116,35 40 | ## comment("Audio-only output",16,ff000000),comment3; # pos 75,71 41 | ## comment("Parameters:||-identifier|- source|- optional",16,ff000000),comment5; # pos 279,135 42 | -------------------------------------------------------------------------------- /Makefile.sccompile: -------------------------------------------------------------------------------- 1 | # Makefile to produce supercollider plugins with Faust: 2 | # 'foo.dsp' -> 'foo.so|scx' and 'foo.sc' 3 | # These two files (scsynth plugin and sclang extension), can be copied to 4 | # $HOME/share/SuperCollider/Extensions (Linux) or 5 | # $HOME/Library/Application Support/SuperCollider/Extensions (Mac OS X) 6 | # 7 | # The shell script /tools/faust2appls/faust2supercollider 8 | # needs to be installed somewhere in the user's search path. 9 | 10 | system := $(shell uname -s) 11 | ifeq ($(system), Darwin) 12 | EXT := scx 13 | else 14 | EXT := so 15 | endif 16 | 17 | dspsrc := $(wildcard *.dsp) 18 | libsrc := $(wildcard *.lib) 19 | incsrc := $(wildcard *.h) 20 | allsrc := $(dspsrc) $(libsrc) $(incsrc) 21 | 22 | ifeq ($(DEST),) 23 | DEST := ./supercolliderdir 24 | endif 25 | 26 | F2SC = faust2supercollider -sd 27 | 28 | ### allocate a unique directory for staging 29 | TMP := $(shell mktemp -d -t F2SC.XXXXXX) 30 | ### -------------------------------------------- 31 | 32 | # NOTE: Some source files need others, so best to copy all together: 33 | all : $(allsrc) $(DEST) $(TMP) 34 | cp -i $(allsrc) $(TMP) || echo "Cannot copy temp source to $(TMP)" 35 | (cd $(TMP); for i in $(dspsrc); do $(F2SC) $$i; done) 36 | mv $(TMP)/*.sc $(TMP)/*.$(EXT) $(DEST) 37 | rm -rf $(TMP) 38 | 39 | $(DEST): 40 | mkdir -p $(DEST) 41 | 42 | $(TMP): 43 | mkdir -p $(TMP) 44 | -------------------------------------------------------------------------------- /pdhelp/guiro-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 667 353 618 476 10; 2 | #X obj 287 158 hsl 128 15 -50 50 0 0 empty empty empty -2 -8 0 10 -262144 3 | -1 -1 0 1; 4 | #X floatatom 453 235 5 0 0 0 - - -; 5 | #N canvas 58 176 158 175 make-smooth-audio-signal~ 0; 6 | #X obj 19 13 inlet; 7 | #X obj 19 37 * 0.001; 8 | #X obj 19 86 line~; 9 | #X msg 19 64 \$1 20; 10 | #X obj 79 66 outlet; 11 | #X obj 19 135 outlet~; 12 | #X obj 19 110 lp2~ 10 0.707 200; 13 | #X connect 0 0 1 0; 14 | #X connect 1 0 3 0; 15 | #X connect 1 0 4 0; 16 | #X connect 2 0 6 0; 17 | #X connect 3 0 2 0; 18 | #X connect 6 0 5 0; 19 | #X restore 284 178 pd make-smooth-audio-signal~; 20 | #X text 446 208 Finger position; 21 | #X text 282 139 Position of finger interacting with resonator; 22 | #X obj 359 434 dac~; 23 | #X obj 171 230 guiro; 24 | #X floatatom 156 137 5 0 0 0 - - -; 25 | #X floatatom 181 137 5 0 0 0 - - -; 26 | #X floatatom 208 137 5 0 0 0 - - -; 27 | #X obj 115 140 / 127; 28 | #X floatatom 115 215 5 0 0 0 - - -; 29 | #X obj 115 165 * 100; 30 | #X obj 115 190 - 50; 31 | #X obj 140 108 ctlin 1; 32 | #X connect 0 0 2 0; 33 | #X connect 2 0 6 1; 34 | #X connect 2 1 1 0; 35 | #X connect 6 3 5 0; 36 | #X connect 6 4 5 1; 37 | #X connect 10 0 12 0; 38 | #X connect 12 0 13 0; 39 | #X connect 13 0 11 0; 40 | #X connect 13 0 0 0; 41 | #X connect 14 0 7 0; 42 | #X connect 14 0 10 0; 43 | #X connect 14 1 8 0; 44 | #X coords 0 476 1 475 235 170 0; 45 | -------------------------------------------------------------------------------- /help-patches/mass-help.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program; if not, write to the Free Software 21 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | 23 | 24 | 25 | mass(0.001,0.0,0.0),m0; # pos 88,176 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | faustcode: outputDSP=highpass(4,20.0); 37 | 38 | 39 | ## comment("Mass",55,ff000000),comment0; # pos 64,35 40 | ## comment("A one-dimensional mass.",16,ff000000),comment3; # pos 91,87 41 | ## comment("Parameters:||- mass|- position|- velocity|- identifier|- label",16,ff000000),comment5; # pos 223,191 42 | -------------------------------------------------------------------------------- /help-patches/port-help.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program; if not, write to the Free Software 21 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | 23 | 24 | 25 | port(),dev0; # pos 91,213 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | faustcode: outputDSP=highpass(4,20.0); 37 | 38 | 39 | ## comment("Port",55,ff000000),comment0; # pos 61,43 40 | ## comment("A port to the real world, which corresponds |to one position input and one force output.",16,ff000000),comment1; # pos 176,95 41 | ## comment("Parameters:||- identifier|- labels",16,ff000000),comment2; # pos 310,166 42 | -------------------------------------------------------------------------------- /help-patches/ground-help.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program; if not, write to the Free Software 21 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | 23 | 24 | 25 | ground(0.0),g0; # pos 85,198 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | faustcode: outputDSP=highpass(4,20.0); 37 | 38 | 39 | ## comment("Ground",55,ff000000),comment0; # pos 99,43 40 | ## comment("The ground object is like an infinite mass|that never moves. It always stays at the|same position.",16,ff000000),comment3; # pos 169,111 41 | ## comment("Parameters:||- position|- identifier|- labels",16,ff000000),comment5; # pos 247,199 42 | -------------------------------------------------------------------------------- /help-patches/junction-help.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program; if not, write to the Free Software 21 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | junction(0.0),junct0; # pos 80,184 34 | 35 | 36 | faustcode: outputDSP=highpass(4,20.0); 37 | 38 | 39 | ## comment("Junction",55,ff000000),comment0; # pos 110,35 40 | ## comment("A junction allows one or more waveguides and up to|one other element to be connected together.",16,ff000000),comment3; # pos 199,87 41 | ## comment("Parameters:||- displacement|- identifier|- labels",16,ff000000),comment4; # pos 255,183 42 | -------------------------------------------------------------------------------- /help-patches/resonators-help.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program; if not, write to the Free Software 21 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | 23 | 24 | 25 | resonators(200.0,1.5,0.01),r0; # pos 88,200 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | faustcode: outputDSP=highpass(4,20.0); 37 | 38 | 39 | ## comment("Resonator",55,ff000000),comment0; # pos 138,35 40 | ## comment("The resonator object is a mass-like object that|tends to oscillate at frequency f, decay time",16,ff000000),comment1; # pos 195,87 41 | ## comment("Parameters:||- frequency|- decay|- mass|- identifier|- labels",16,ff000000),comment2; # pos 263,199 42 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Synth-A-Modeler v0.4 2 | -------------------- 3 | July 10, 2013 4 | 5 | 6 | It's not a synthesizer---it's a Synth-A-Modeler! 7 | 8 | 9 | 10 | The Synth-A-Modeler compiler, enables musicians to synthesize binary DSP modules according to mechanical analog model specications. This open-source tool promotes modular design 11 | and ease of use. By leveraging the Faust DSP programming environment, an output Pd, Max/MSP, SuperCollider, VST, LADSPA, or other external module is created, allowing the musician to hear the sound of the physical model in real time using an audio host application. 12 | 13 | 14 | 15 | 16 | To download: 17 | git clone https://github.com/eberdahl/SaM.git 18 | 19 | Documentation: 20 | http://lac.linuxaudio.org/2012/papers/34.pdf 21 | (more soon) 22 | 23 | To use SaM with the FireFader, see: 24 | https://ccrma.stanford.edu/wiki/SynthAModelerFireFaderLab 25 | 26 | 27 | 28 | 29 | 30 | After you install git, you can just run 31 | 32 | git clone https://github.com/eberdahl/SaM.git 33 | 34 | to download Synth-A-Modeler into a new directory. Then go into that directory by typing 35 | cd SaM 36 | Then try to use the Make command as if you were using Faust to build the Synth-A-Modeler modules. Currently the following targets are supported: 37 | 38 | make puredata 39 | 40 | make map 41 | 42 | make jackqt 43 | 44 | 45 | otherwise you will have to create your own Makefiles from the Faust examples (see Makefile.HOWTO.txt). 46 | -------------------------------------------------------------------------------- /help-patches/termination-help.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program; if not, write to the Free Software 21 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | termination(simpleStringTerm(-0.996, 20)),term0; # pos 112,202 32 | 33 | 34 | 35 | 36 | faustcode: outputDSP=highpass(4,20.0); 37 | 38 | 39 | ## comment("Termination",55,ff000000),comment0; # pos 166,35 40 | ## comment("A termination represents an object like a bridge|or a nut. In other words, a termination marks |the end of one or more waveguides",16,ff000000),comment1; # pos 207,95 41 | ## comment("Parameters:||- termType|- identifier|- labels",16,ff000000),comment2; # pos 279,191 42 | -------------------------------------------------------------------------------- /help-patches/waveguide-help.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program; if not, write to the Free Software 21 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | waveguide(1.0,simpleString(0.033,0.017)),wg0,junct0,term0; 30 | 31 | 32 | termination(simpleStringTerm(-0.996, 20)),term0; # pos 192,210 33 | 34 | 35 | junction(0.0),junct0; # pos 48,200 36 | 37 | 38 | faustcode: outputDSP=highpass(4,20.0); 39 | 40 | 41 | ## comment("Waveguide",55,ff000000),comment0; # pos 155,43 42 | ## comment("A waveguide uses wave variables to|represent the vibration of a string",16,ff000000),comment1; # pos 160,95 43 | ## comment("Parameters:||- impedance|- stringType|- identifier|- left object|- right object|- labels",16,ff000000),comment2; # pos 324,207 44 | -------------------------------------------------------------------------------- /help-patches/touch-help.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program; if not, write to the Free Software 21 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | 23 | 24 | 25 | mass(0.001,0.0,0.0),m0; # pos 72,176 26 | port(),dev0; # pos 83,285 27 | 28 | 29 | touch(100.0,0.1,0.0),t0,m0,dev0; 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | faustcode: outputDSP=highpass(4,20.0); 39 | 40 | 41 | ## comment("Touch",55,ff000000),comment0; # pos 89,43 42 | ## comment("Link-type objects connect from one mass-like object|to another mass-like object. For that reason, each of|the links must specify the two mass-like objects that|it connects.",16,ff000000),comment3; # pos 216,103 43 | ## comment("Parameters:||- stiffness|- damping|- offset|- identifier|- start vertex|- end vertex|- labels",16,ff000000),comment4; # pos 298,223 44 | -------------------------------------------------------------------------------- /help-patches/link-help.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program; if not, write to the Free Software 21 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | 23 | 24 | 25 | mass(0.001,0.0,0.0),m0; # pos 48,216 26 | mass(0.001,0.0,0.0),m1; # pos 176,216 27 | 28 | 29 | link(100.0,0.1,0.0),l0,m0,m1; 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | faustcode: outputDSP=highpass(4,20.0); 39 | 40 | 41 | ## comment("Linear Link",55,ff000000),comment0; # pos 156,43 42 | ## comment("Link-type objects connect from one mass-like object|to another mass-like object. For that reason, each of|the links must specify the two mass-like objects that|it connects.",16,ff000000),comment3; # pos 216,119 43 | ## comment("Parameters:||- stiffness|- damping|- offset|- identifier|- start vertex|- end vertex|- labels",16,ff000000),comment4; # pos 322,239 44 | -------------------------------------------------------------------------------- /help-patches/pluck-help.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program; if not, write to the Free Software 21 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | 23 | 24 | 25 | mass(0.001,0.0,0.0),m1; # pos 80,184 26 | port(),dev0; # pos 91,301 27 | 28 | 29 | pluck(300.0,0.1,0.003,0.0),p0,m1,dev0; 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | faustcode: outputDSP=highpass(4,20.0); 39 | 40 | 41 | ## comment("Pluck",55,ff000000),comment0; # pos 75,35 42 | ## comment("Parameters:||- stiffness|- damping|- displacement|- offset|- identifier|- start vertex|- end vertex|- labels",16,ff000000),comment4; # pos 298,223 43 | ## comment("Link-type objects connect from one mass-like object|to another mass-like object. For that reason, each of|the links must specify the two mass-like objects that|it connects.",16,ff000000),comment3; # pos 200,95 44 | -------------------------------------------------------------------------------- /pdhelp/bounce_mass_on_membrane-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 529 319 611 350 10; 2 | #X obj 384 165 r \$0-read; 3 | #X obj 384 195 faust-control \$0; 4 | #X obj 384 225 s \$0-write; 5 | #X obj 43 198 r \$0-in; 6 | #X obj 43 258 s \$0-out; 7 | #X obj 80 60 hsl 128 15 -50 50 0 0 empty empty empty -2 -8 0 10 -262144 8 | -1 -1 9200 1; 9 | #X floatatom 233 106 8 0 0 0 - - -; 10 | #N canvas 0 24 158 175 make-smooth-audio-signal~ 0; 11 | #X obj 19 13 inlet; 12 | #X obj 19 86 line~; 13 | #X msg 19 64 \$1 20; 14 | #X obj 79 66 outlet; 15 | #X obj 19 135 outlet~; 16 | #X obj 19 110 lp2~ 10 0.707 200; 17 | #X obj 19 37 * 0.0006; 18 | #X connect 0 0 6 0; 19 | #X connect 1 0 5 0; 20 | #X connect 2 0 1 0; 21 | #X connect 5 0 4 0; 22 | #X connect 6 0 2 0; 23 | #X connect 6 0 3 0; 24 | #X restore 68 84 pd make-smooth-audio-signal~; 25 | #X text 21 99 dev1; 26 | #X text 24 108 pos; 27 | #X text 285 95 Finger position; 28 | #X text 286 107 m; 29 | #X text 66 45 Position of finger interacting with resonator; 30 | #X obj 137 313 dac~; 31 | #X obj 147 282 *~ 0.1; 32 | #X obj 43 228 bounce_mass_on_membrane~; 33 | #X obj 212 272 metro 20; 34 | #X obj 212 250 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 35 | 1; 36 | #X obj 212 226 loadbang; 37 | #X obj 212 295 snapshot~; 38 | #X floatatom 212 318 8 0 0 0 - - -; 39 | #X obj 305 272 metro 20; 40 | #X obj 305 250 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 41 | 1; 42 | #X obj 305 226 loadbang; 43 | #X obj 305 295 snapshot~; 44 | #X floatatom 305 318 8 0 0 0 - - -; 45 | #X connect 0 0 1 0; 46 | #X connect 1 0 2 0; 47 | #X connect 3 0 15 0; 48 | #X connect 5 0 7 0; 49 | #X connect 7 0 15 1; 50 | #X connect 7 1 6 0; 51 | #X connect 14 0 13 0; 52 | #X connect 14 0 13 1; 53 | #X connect 15 0 4 0; 54 | #X connect 15 2 14 0; 55 | #X connect 15 2 19 0; 56 | #X connect 15 4 24 0; 57 | #X connect 16 0 19 0; 58 | #X connect 17 0 16 0; 59 | #X connect 18 0 17 0; 60 | #X connect 19 0 20 0; 61 | #X connect 21 0 24 0; 62 | #X connect 22 0 21 0; 63 | #X connect 23 0 22 0; 64 | #X connect 24 0 25 0; 65 | -------------------------------------------------------------------------------- /PureDataFireFaderSimulator.pd: -------------------------------------------------------------------------------- 1 | #N canvas 571 22 477 810 10; 2 | #X obj 237 25 hsl 128 15 -50 50 0 0 empty empty empty -2 -8 0 10 -262144 3 | -1 -1 0 1; 4 | #X floatatom 357 67 5 0 0 0 - - -; 5 | #X floatatom 318 693 7 0 0 0 - - -; 6 | #X text 364 692 dB; 7 | #X obj 118 781 dac~; 8 | #X obj 293 712 gainvu~ 300; 9 | #X obj 361 569 vu 15 120 empty empty 8 -8 0 10 -66577 -1 1 0; 10 | #X obj 417 582 vsl 15 128 0 127 0 1 empty empty empty 8 -8 0 10 -262144 11 | -1 -1 9000 1; 12 | #X floatatom 400 718 7 0 0 0 - - -; 13 | #X text 445 718 dB; 14 | #X obj 67 711 gainvu~ 300; 15 | #X floatatom 105 738 7 0 0 0 - - -; 16 | #X text 151 737 dB; 17 | #X obj 148 614 vu 15 120 empty empty 8 -8 0 10 -66577 -1 1 0; 18 | #N canvas 58 176 158 175 FireFaderSimulator 0; 19 | #X obj 19 13 inlet; 20 | #X obj 19 37 * 0.001; 21 | #X obj 19 86 line~; 22 | #X msg 19 64 \$1 20; 23 | #X obj 79 66 outlet; 24 | #X obj 19 135 outlet~; 25 | #X obj 19 110 lp2~ 10 0.707 200; 26 | #X connect 0 0 1 0; 27 | #X connect 1 0 3 0; 28 | #X connect 1 0 4 0; 29 | #X connect 2 0 6 0; 30 | #X connect 3 0 2 0; 31 | #X connect 6 0 5 0; 32 | #X restore 234 45 pd FireFaderSimulator; 33 | #X text 391 67 m; 34 | #X text 304 66 Position; 35 | #X text 238 106 dev2; 36 | #X obj 4 25 hsl 128 15 -50 50 0 0 empty empty empty -2 -8 0 10 -262144 37 | -1 -1 0 1; 38 | #X floatatom 124 67 5 0 0 0 - - -; 39 | #N canvas 58 176 158 175 FireFaderSimulator 0; 40 | #X obj 19 13 inlet; 41 | #X obj 19 37 * 0.001; 42 | #X obj 19 86 line~; 43 | #X msg 19 64 \$1 20; 44 | #X obj 79 66 outlet; 45 | #X obj 19 135 outlet~; 46 | #X obj 19 110 lp2~ 10 0.707 200; 47 | #X connect 0 0 1 0; 48 | #X connect 1 0 3 0; 49 | #X connect 1 0 4 0; 50 | #X connect 2 0 6 0; 51 | #X connect 3 0 2 0; 52 | #X connect 6 0 5 0; 53 | #X restore 1 45 pd FireFaderSimulator; 54 | #X text 158 67 m; 55 | #X text 71 66 Position; 56 | #X text 124 105 dev1; 57 | #X text 290 116 FireFader simulation patch; 58 | #X text 290 131 Edgar Berdahl \, TU Berlin \, 2013; 59 | #X obj 6 123 samtargetdspname; 60 | #X text -1 3 samtargetdspname demonstration patch; 61 | #X connect 0 0 14 0; 62 | #X connect 5 0 4 1; 63 | #X connect 5 1 8 0; 64 | #X connect 5 2 6 0; 65 | #X connect 6 1 2 0; 66 | #X connect 7 0 5 1; 67 | #X connect 7 0 10 1; 68 | #X connect 10 0 4 0; 69 | #X connect 10 2 13 0; 70 | #X connect 13 1 11 0; 71 | #X connect 14 0 26 2; 72 | #X connect 14 1 1 0; 73 | #X connect 18 0 20 0; 74 | #X connect 20 0 26 1; 75 | #X connect 20 1 19 0; 76 | #X connect 26 3 10 0; 77 | #X connect 26 4 5 0; 78 | -------------------------------------------------------------------------------- /Makefile.mspcompile: -------------------------------------------------------------------------------- 1 | #-------------------------------------------------------------------------------# 2 | # Makefile to produce Max MSP externals on MacOSX 3 | # 4 | #------------------------------------------------------------------------------- 5 | 6 | # Lists dsp file we have to compile 7 | dspsrc := $(wildcard *.mdl) 8 | cppsrc := $(addprefix $(DEST), $(dspsrc:.mdl=.cpp)) 9 | appl := $(addprefix $(DEST), $(dspsrc:.mdl=~.mxo)) 10 | dspfile := $(dspsrc:.mdl=.dsp) 11 | mdxfile := $(dspsrc:.mdl=.mdx) 12 | processor := $(shell uname -p) 13 | 14 | # Path to Max/MSP SDK 15 | #SDK :=/usr/local/include/c74support/ 16 | SDK :=/Applications/Max5/MaxSDK-5.1.7/c74support/ 17 | MAXINC :=$(SDK)/max-includes -I/usr/local/lib/faust 18 | MSPINC :=$(SDK)/msp-includes 19 | 20 | # MacOSX Frameworks we are going to use 21 | FRAMEWORKS := -framework Carbon -I$(MAXINC) -I$(MSPINC) -F$(MAXINC) -F$(MSPINC) -framework MaxAPI -framework MaxAudioAPI 22 | 23 | # Compilation and optimisation options 24 | OPTIONS := -arch i386 -O3 -mfpmath=sse -msse -msse2 -msse3 -ffast-math -Wl,-Y,1455 -bundle 25 | 26 | # Which compiler we use 27 | CC=g++ 28 | #CC=/Developer/usr/bin/llvm-g++ 29 | 30 | 31 | all : $(mdxfile) $(dspfile) $(appl) 32 | 33 | %.mdx : %.mdl 34 | perl SAM-preprocessor $< $@ 35 | 36 | %.dsp : %.mdx 37 | perl Synth-A-Modeler $< $@ 38 | 39 | $(DEST)%~.mxo : %.dsp Info.plist.template 40 | install -d $@/Contents/MacOS 41 | faust $(VEC) -a $(ARCH) $< -o $@/$(<:.dsp=.cpp) 42 | $(CC) $(FRAMEWORKS) $(OPTIONS) $@/$(<:.dsp=.cpp) -o $@/Contents/MacOS/$(<:.dsp=~) 43 | sed s/FOO/$(<:.dsp=~)/ $@/Contents/Info.plist 44 | 45 | Info.plist.template : 46 | echo '' > Info.plist.template 47 | echo '' >> Info.plist.template 48 | echo '' >> Info.plist.template 49 | echo '' >> Info.plist.template 50 | echo ' CFBundleExecutable' >> Info.plist.template 51 | echo ' FOO' >> Info.plist.template 52 | echo ' CFBundleName' >> Info.plist.template 53 | echo ' FOO' >> Info.plist.template 54 | echo ' CFBundlePackageType' >> Info.plist.template 55 | echo ' iLaX' >> Info.plist.template 56 | echo '' >> Info.plist.template 57 | echo '' >> Info.plist.template 58 | 59 | clean : 60 | rm -f $(DEST) 61 | -------------------------------------------------------------------------------- /Makefile.HOWTO: -------------------------------------------------------------------------------- 1 | If you are using Synth-A-Modeler with a different target than the ones we have tested so far (or you are upgrading to a much newer version of Faust), you will need a properly configured makefile. 2 | 3 | In the following, we explain the changes made to the makefiles in faust-0.9.46/examples to arrive at the new makefiles. (Note that we recommend using at least faust 0.9.58 or later.) 4 | 5 | 6 | 1) First of all, it is really helpful to be able to compile only a single model at a time by specifying the model name (without any extensions) using SAMTARGET= when calling make. To enable this feature, go to Makefile.pdcompile and change 7 | dspsrc := $(wildcard *.dsp) 8 | to 9 | ifdef SAMTARGET 10 | dspsrc := $(SAMTARGET).mdl 11 | else 12 | dspsrc := $(wildcard *.mdl) 13 | endif 14 | 15 | 2) Next, the following variables need to be edited so that they are referenced according to an input "mdl" file instead of an input "dsp" file: 16 | cppsrc := $(addprefix $(DEST), $(dspsrc:.mdl=.cpp)) 17 | dspfile := $(dspsrc:.mdl=.dsp) 18 | mdxfile := $(dspsrc:.mdl=.mdx) 19 | patches := $(addprefix $(DEST), $(dspsrc:.mdl=.pd)) 20 | 21 | And further down, similarly these also need to depend on "mdl" files: 22 | ifeq ($(system), Darwin) 23 | modules := $(addprefix $(DEST), $(dspsrc:.mdl=~.pd_darwin)) 24 | else 25 | modules := $(addprefix $(DEST), $(dspsrc:.mdl=~.pd_linux)) 26 | endif 27 | 28 | 29 | 3) The mdx files also need to be included in the build targets: 30 | allmodules: $(mdxfile) $(dspfile) $(todo) 31 | 32 | 33 | 4) We need to cause perl to be called for building any mdx or dsp files: 34 | %.mdx : %.mdl 35 | @perl SAM-preprocessor $< $@ 36 | 37 | %.dsp : %.mdx 38 | perl Synth-A-Modeler $< $@ 39 | 40 | 41 | 5) Make sure that faust is using double-precision computations: 42 | faust -a $(ARCH) -double $< -o $@ 43 | 44 | 45 | 6) I personally like to have a separate directory "pdhelp" to store pre-specified help files (that I make by modifying the 46 | automatically generated pd-faust files) so that they don't get deleted if I run "make clean". So I add the 47 | following lines also, note they only copy over help files that start with the same name as the original mdl file: 48 | # If there are pre-specified help files, then copy them over 49 | cp pdhelp/$(<:.dsp=*) $(DEST) & 50 | 51 | 52 | 53 | 54 | 55 | - Edgar Berdahl, January 2013 -------------------------------------------------------------------------------- /pdhelp/percussion_fourth_try_presets-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 438 159 469 311 10; 2 | #X obj 10 180 r \$0-in; 3 | #X obj 10 210 percussion_fourth_try_presets~; 4 | #X obj 10 240 s \$0-out; 5 | #X obj 10 30 nbx 5 14 0 23 0 0 \$0-percussion-fourth-try-presets/Preset-number 6 | \$0-percussion-fourth-try-presets/Preset-number Preset-number 0 -6 7 | 0 10 -262144 -1 -1 8 256; 8 | #X obj 47 3 bng 15 250 50 1 \$0-init \$0-ignore empty 0 -6 0 10 -262144 9 | -1 -1; 10 | #X obj 67 3 tgl 15 1 \$0-active \$0-active empty 0 -6 0 10 -262144 11 | -1 -1 1 1; 12 | #X obj 539 8 r \$0-init; 13 | #X obj 858 10 s \$0-in; 14 | #X obj 1062 10 s \$0-read; 15 | #X obj 1266 10 r \$0-write; 16 | #X msg 539 28 1; 17 | #X obj 539 48 s \$0-active; 18 | #X obj 858 30 r \$0-active; 19 | #X msg 858 50 active \$1; 20 | #X obj 1266 30 route active; 21 | #X obj 1266 50 s \$0-active; 22 | #X msg 539 68 0; 23 | #X obj 539 88 s \$0-percussion-fourth-try-presets/Preset-number; 24 | #X obj 858 70 r \$0-percussion-fourth-try-presets/Preset-number; 25 | #X msg 858 90 /percussion-fourth-try-presets/Preset-number \$1; 26 | #X obj 1266 70 route /percussion-fourth-try-presets/Preset-number; 27 | #X obj 1266 90 s \$0-percussion-fourth-try-presets/Preset-number; 28 | #X obj 153 266 dac~; 29 | #X obj 165 140 hsl 128 15 -50 50 0 0 empty empty empty -2 -8 0 10 -262144 30 | -1 -1 500 1; 31 | #X floatatom 327 182 5 0 0 0 - - -; 32 | #N canvas 0 22 158 175 make-smooth-audio-signal~ 0; 33 | #X obj 19 13 inlet; 34 | #X obj 19 37 * 0.001; 35 | #X obj 19 86 line~; 36 | #X msg 19 64 \$1 20; 37 | #X obj 79 66 outlet; 38 | #X obj 19 135 outlet~; 39 | #X obj 19 110 lp2~ 10 0.707 200; 40 | #X connect 0 0 1 0; 41 | #X connect 1 0 3 0; 42 | #X connect 1 0 4 0; 43 | #X connect 2 0 6 0; 44 | #X connect 3 0 2 0; 45 | #X connect 6 0 5 0; 46 | #X restore 162 160 pd make-smooth-audio-signal~; 47 | #X text 105 171 dev1; 48 | #X text 108 180 pos; 49 | #X text 358 171 Finger position; 50 | #X text 360 183 m; 51 | #X text 160 121 Position of finger interacting with resonator; 52 | #X text 117 238 aLeft; 53 | #X text 182 242 aRight; 54 | #X connect 0 0 1 0; 55 | #X connect 1 0 2 0; 56 | #X connect 1 3 22 0; 57 | #X connect 1 4 22 1; 58 | #X connect 6 0 16 0; 59 | #X connect 9 0 14 0; 60 | #X connect 10 0 11 0; 61 | #X connect 12 0 13 0; 62 | #X connect 13 0 7 0; 63 | #X connect 14 0 15 0; 64 | #X connect 14 1 20 0; 65 | #X connect 16 0 17 0; 66 | #X connect 18 0 19 0; 67 | #X connect 19 0 7 0; 68 | #X connect 20 0 21 0; 69 | #X connect 23 0 25 0; 70 | #X connect 25 0 1 1; 71 | #X connect 25 1 24 0; 72 | #X coords 0 -1 1 1 85 50 1 0 0; 73 | -------------------------------------------------------------------------------- /SAM-preprocessor: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # 3 | # Edgar Berdahl, Jan 21 2012 4 | # Updated February 2012 5 | # 6 | # First argument is input filename for MDL file 7 | # Second argument is output filename for MDX file 8 | # 9 | # For example: ./SAM-preprocessor examplelinks.mdl examplelinks.mdx 10 | # 11 | # ALL NUMBERS IN MDL FILES SHOULD BE FLOATING-POINT NUMBERS (NOT INTEGERS) 12 | 13 | 14 | # Here we include the regular expression definitions necessary for parsing model specification files. 15 | require 'SAM-reg-ex'; 16 | 17 | 18 | use v5.10; 19 | 20 | use warnings; 21 | $filename = $ARGV[0]; # e.g. "examplelinks.mdl"; 22 | $filenameout = $ARGV[1]; # e.g. "examplelinks.mdx"; 23 | my $indx = 0; # index variable used over and over again 24 | 25 | 26 | 27 | #say "Starting SAM-preprocessor..."; 28 | 29 | 30 | # First remove all of the comments and write the result into $tmp_filename 31 | $tmp_filename = "tempSAM3981.tmp"; 32 | open my $fh_tmp_out, '>', $tmp_filename 33 | or die "Cannot write '$tmp_filename'"; 34 | open $filehandle, '<', $filename 35 | or die "Cannot read '$filename': $!\n"; 36 | #my $beforeComment = qr/(\A[^\n\r#]*)/; # Contains anything except newlines, returns, and pound symbols (#) 37 | #my $afterComment = qr/([^\n\r]*)/; # Contains anything except newlines and returns 38 | my $beforeComment = qr/([^#]*)/; # Contains anything except pound symbols (#) 39 | my $afterComment = qr/(.*)/; # Contains anything 40 | my $filterOutComments = qr/\A${beforeComment}#${afterComment}$/; 41 | while (<$filehandle>) 42 | { 43 | chomp; 44 | $theline = $_; 45 | 46 | # Each line out is simply the line in up until the point where a pound symbol (#) is reached 47 | if ($theline =~ qr/$filterOutComments/) { 48 | #say "1=" . $1 . ", 2=" . $2; 49 | say $fh_tmp_out $1; 50 | } else { 51 | say $fh_tmp_out $theline; # If there are no comments in the line 52 | } 53 | } 54 | close $fh_tmp_out; 55 | $filename = $tmp_filename; # Starting now we read out of the temporary file 56 | 57 | 58 | 59 | 60 | # Open MDX file for output and prepare to write into it 61 | open my $fh_out, '>', $filenameout 62 | or die "Cannot write '$filenameout': $!\n"; 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | # For now just copy over all lines 72 | open $filehandle, '<', $filename 73 | or die "Cannot read '$filename': $!\n"; 74 | while (<$filehandle>) 75 | { 76 | chomp; 77 | $theline = $_; 78 | 79 | say $fh_out $theline; 80 | } 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | # Delete the temporary file if it still exists 91 | close $filehandle; 92 | if (-e $tmp_filename) 93 | { 94 | unlink($tmp_filename); 95 | } 96 | 97 | 98 | 99 | 100 | #say "SAM-preprocessor finished."; 101 | -------------------------------------------------------------------------------- /Makefile.qtcompile: -------------------------------------------------------------------------------- 1 | ###-------------------------------------------- 2 | ### DEST : directory where to put binaries 3 | ### ARCH : faust architecture file 4 | 5 | system := $(shell uname -s) 6 | 7 | ifdef SAMTARGET 8 | dspsrc := $(SAMTARGET).mdl 9 | else 10 | dspsrc := $(wildcard *.mdl) 11 | endif 12 | 13 | cppsrc := $(addprefix $(DEST), $(dspsrc:.mdl=.cpp)) 14 | dspfile := $(dspsrc:.mdl=.dsp) 15 | mdxfile := $(dspsrc:.mdl=.mdx) 16 | 17 | 18 | ### check what type of applications to build (MacOSX Darwin or Linux) 19 | ifeq ($(system), Darwin) 20 | appls := $(addprefix $(DEST), $(dspsrc:.mdl=.app)) 21 | SPEC := -spec macx-g++ QMAKE_CXXFLAGS=-fpermissive 22 | #SPEC := -spec macx-g++ QMAKE_CXXFLAGS="-fpermissive -fbracket-depth=2048" 23 | else 24 | appls := $(addprefix $(DEST), $(dspsrc:.mdl=)) 25 | SPEC := 26 | endif 27 | ### -------------------------------------------- 28 | 29 | 30 | ### allocate a unique directory 31 | TDR := $(shell mktemp -d -t FAUST.XXXXXX) 32 | TMP = $(TDR)/$(<:.dsp=) 33 | ### -------------------------------------------- 34 | 35 | 36 | all : $(mdxfile) $(dspfile) $(appls) 37 | 38 | 39 | ### Darwin 40 | %.mdx : %.mdl 41 | @perl SAM-preprocessor $< $@ 42 | %.dsp : %.mdx 43 | perl Synth-A-Modeler $< $@ 44 | 45 | $(DEST)%.app : %.dsp 46 | install -d $(TMP) 47 | faust -double -a $(ARCH) $(VEC) $< -o $(TMP)/$<.cpp 48 | #cd $(TMP); qmake -project "$(DEFS)" "INCLUDEPATH+=/usr/local/lib/faust/" "INCLUDEPATH+=/usr/local/include/faust/" "INCLUDEPATH+=/usr/local/lib/faust/osclib" "LIBS+=$(LIB)" "HEADERS+=/usr/local/include/faust/gui/faustqt.h" "CXXFLAGS+=-fbracket-depth=2048" 49 | cd $(TMP); qmake -project "$(DEFS)" "INCLUDEPATH+=/usr/local/lib/faust/" "INCLUDEPATH+=/usr/local/include/faust/" "INCLUDEPATH+=/usr/local/lib/faust/osclib" "LIBS+=$(LIB)" "HEADERS+=/usr/local/include/faust/gui/faustqt.h" 50 | cd $(TMP); qmake $(SPEC) 51 | make -C $(TMP) 52 | rm -rf $@ 53 | mv $(TMP)/$(<:.dsp=.app) $(DEST) 54 | rm -rf $(TDR) 55 | 56 | 57 | ### Linux 58 | hdir1 := $(wildcard /usr/local/include/faust/gui/faustqt.h) 59 | #hdir1 := $(wildcard /usr/local/lib/faust/gui/faustqt.h) 60 | hdir2 := $(wildcard /usr/share/faust/faustqt.h) 61 | hdir3 := $(wildcard /usr/local/lib/faust/faustqt.h) 62 | hdir23 := $(if $(hdir2),$(dir $(hdir2)),$(dir $(hdir3))) 63 | hdir := $(if $(hdir1),$(dir $(hdir1)),$(hdir23)) 64 | qm4 := $(shell which qmake-qt4) 65 | qm := $(if $(qm4),$(qm4),qmake) 66 | 67 | %.mdx : %.mdl 68 | perl SAM-preprocessor $< $@ 69 | %.dsp : %.mdx 70 | perl Synth-A-Modeler $< $@ 71 | 72 | $(DEST)% : %.dsp 73 | rm -rf $(TMP) 74 | install -d $(TMP) 75 | faust -double -a $(ARCH) $(VEC) $< -o $(TMP)/$<.cpp 76 | cd $(TMP); $(qm) -project "$(DEFS)" "INCLUDEPATH+=/usr/local/lib/faust/" "INCLUDEPATH+=/usr/local/lib/faust/osclib" "LIBS+=$(LIB)" "HEADERS+=$(hdir)faustqt.h" 77 | cd $(TMP); $(qm) $(SPEC) 78 | make -C $(TMP) 79 | mv $(TMP)/$(<:.dsp=) $@ 80 | rm -rf $(TMP) 81 | 82 | clean: 83 | rm -rf $(DEST) 84 | -------------------------------------------------------------------------------- /ground_link.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # (c) Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # The above copyright notice including the copyright holders and this 10 | # permission notice shall be included in all copies, substantial 11 | # portions, or derivatives of the Software and Software portions. 12 | # 13 | # The end-user documentation included with the redistribution, if any, 14 | # must include the following acknowledgment: "This software was 15 | # developed at least in part using Synth-A-Modeler, which is a modular 16 | # and open-source environment for designing physical models (see 17 | # https://github.com/eberdahl/SaM)", in the same place and form as other 18 | # third-party acknowledgments. In addition, this acknowledgment must 19 | # appear in the software itself in the same form and location as other 20 | # such third-party acknowledgments. 21 | # 22 | # Alternatively, if software is generated using Synth-A-Modeler, then 23 | # the end-user documentation included with the generated software, if 24 | # any, must include the following statement: "This software was generated 25 | # using Synth-A-Modeler, which is a modular and open-source environment 26 | # for designing physical models (see https://github.com/eberdahl/SaM)", 27 | # in the same place and form as other third-party acknowledgments. In 28 | # addition, this acknowledgment must appear prominently in any software 29 | # generated by Synth-A-Modeler in the same form and location as other 30 | # such third-party acknowledgments, and in such a manner that users 31 | # will be aware that the software was generated by Synth-A-Modeler. 32 | # 33 | # This program is free software: you can redistribute it and/or modify 34 | # it under the terms of the GNU General Public License version 3 as 35 | # published by the Free Software Foundation except subject to the additional 36 | # attribution requirements described beneath the copyright notice above. 37 | # 38 | # This program is distributed in the hope that it will be useful, 39 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 40 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 41 | # GNU General Public License for more details. 42 | # 43 | # You should have received a copy of the modified GNU General Public 44 | # License along with this program. 45 | 46 | 47 | 48 | port(),dev0; # pos 187,61 49 | ground(0.0),g0; # pos 45,46 50 | port(),dev1; # pos 299,61 51 | 52 | 53 | link(k,R,positionOffset),t0,dev0,g0; 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | faustcode: k=hslider("Stiffness [N/m]",50.0,0.0,350.0,2.5); 63 | faustcode: R=hslider("Damping [N/(m/s)]",0.1,-2.0,3.5,0.001); 64 | faustcode: positionOffset=hslider("Position offset [m]",0.0,-0.035,0.035,0.001); 65 | 66 | audioout,a0,0.0; # pos 43,160 67 | audioout,a1,0.0; # pos 187,160 68 | -------------------------------------------------------------------------------- /ground_touch.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # (c) Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # The above copyright notice including the copyright holders and this 10 | # permission notice shall be included in all copies, substantial 11 | # portions, or derivatives of the Software and Software portions. 12 | # 13 | # The end-user documentation included with the redistribution, if any, 14 | # must include the following acknowledgment: "This software was 15 | # developed at least in part using Synth-A-Modeler, which is a modular 16 | # and open-source environment for designing physical models (see 17 | # https://github.com/eberdahl/SaM)", in the same place and form as other 18 | # third-party acknowledgments. In addition, this acknowledgment must 19 | # appear in the software itself in the same form and location as other 20 | # such third-party acknowledgments. 21 | # 22 | # Alternatively, if software is generated using Synth-A-Modeler, then 23 | # the end-user documentation included with the generated software, if 24 | # any, must include the following statement: "This software was generated 25 | # using Synth-A-Modeler, which is a modular and open-source environment 26 | # for designing physical models (see https://github.com/eberdahl/SaM)", 27 | # in the same place and form as other third-party acknowledgments. In 28 | # addition, this acknowledgment must appear prominently in any software 29 | # generated by Synth-A-Modeler in the same form and location as other 30 | # such third-party acknowledgments, and in such a manner that users 31 | # will be aware that the software was generated by Synth-A-Modeler. 32 | # 33 | # This program is free software: you can redistribute it and/or modify 34 | # it under the terms of the GNU General Public License version 3 as 35 | # published by the Free Software Foundation except subject to the additional 36 | # attribution requirements described beneath the copyright notice above. 37 | # 38 | # This program is distributed in the hope that it will be useful, 39 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 40 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 41 | # GNU General Public License for more details. 42 | # 43 | # You should have received a copy of the modified GNU General Public 44 | # License along with this program. 45 | 46 | 47 | 48 | 49 | port(),dev0; # pos 187,61 50 | port(),dev1; # pos 299,61 51 | 52 | ground(0.0),g0; # pos 45,46 53 | 54 | touch(k*1.0,R*1.0,positionOffset),t0,dev0,g0; 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | faustcode: k=hslider("Stiffness [N/m]",100.0,0.0,400.0,10.0); 64 | faustcode: R=hslider("Damping [N/(m/s)]",0.1,0.0,3.5,0.001); 65 | faustcode: positionOffset=hslider("Position offset [m]",0.0,-0.035,0.035,0.001); 66 | 67 | audioout,a0,0.0; # pos 43,160 68 | audioout,a1,0.0; # pos 187,160 69 | -------------------------------------------------------------------------------- /ground_pluck.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # (c) Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # The above copyright notice including the copyright holders and this 10 | # permission notice shall be included in all copies, substantial 11 | # portions, or derivatives of the Software and Software portions. 12 | # 13 | # The end-user documentation included with the redistribution, if any, 14 | # must include the following acknowledgment: "This software was 15 | # developed at least in part using Synth-A-Modeler, which is a modular 16 | # and open-source environment for designing physical models (see 17 | # https://github.com/eberdahl/SaM)", in the same place and form as other 18 | # third-party acknowledgments. In addition, this acknowledgment must 19 | # appear in the software itself in the same form and location as other 20 | # such third-party acknowledgments. 21 | # 22 | # Alternatively, if software is generated using Synth-A-Modeler, then 23 | # the end-user documentation included with the generated software, if 24 | # any, must include the following statement: "This software was generated 25 | # using Synth-A-Modeler, which is a modular and open-source environment 26 | # for designing physical models (see https://github.com/eberdahl/SaM)", 27 | # in the same place and form as other third-party acknowledgments. In 28 | # addition, this acknowledgment must appear prominently in any software 29 | # generated by Synth-A-Modeler in the same form and location as other 30 | # such third-party acknowledgments, and in such a manner that users 31 | # will be aware that the software was generated by Synth-A-Modeler. 32 | # 33 | # This program is free software: you can redistribute it and/or modify 34 | # it under the terms of the GNU General Public License version 3 as 35 | # published by the Free Software Foundation except subject to the additional 36 | # attribution requirements described beneath the copyright notice above. 37 | # 38 | # This program is distributed in the hope that it will be useful, 39 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 40 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 41 | # GNU General Public License for more details. 42 | # 43 | # You should have received a copy of the modified GNU General Public 44 | # License along with this program. 45 | 46 | 47 | 48 | 49 | port(),dev0; # pos 187,61 50 | port(),dev1; # pos 299,61 51 | 52 | ground(0.0),g0; # pos 45,46 53 | 54 | pluck(k,R,maxdisp,positionOffset),t0,dev0,g0; 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | faustcode: k=hslider("Stiffness [N/m]",100.0,0.0,400.0,10.0); 64 | faustcode: R=hslider("Damping [N/(m/s)]",0.1,0.0,3.5,0.001); 65 | faustcode: maxdisp=hslider("Pluck half-width [m]",0.016,0.001,0.02,0.001); 66 | faustcode: positionOffset=hslider("Position offset [m]",0.0,-0.035,0.035,0.001); 67 | 68 | audioout,a0,0.0; # pos 43,160 69 | audioout,a1,0.0; # pos 187,160 70 | -------------------------------------------------------------------------------- /wiggle_a_mass.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # (c) Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # The above copyright notice including the copyright holders and this 10 | # permission notice shall be included in all copies, substantial 11 | # portions, or derivatives of the Software and Software portions. 12 | # 13 | # The end-user documentation included with the redistribution, if any, 14 | # must include the following acknowledgment: "This software was 15 | # developed at least in part using Synth-A-Modeler, which is a modular 16 | # and open-source environment for designing physical models (see 17 | # https://github.com/eberdahl/SaM)", in the same place and form as other 18 | # third-party acknowledgments. In addition, this acknowledgment must 19 | # appear in the software itself in the same form and location as other 20 | # such third-party acknowledgments. 21 | # 22 | # Alternatively, if software is generated using Synth-A-Modeler, then 23 | # the end-user documentation included with the generated software, if 24 | # any, must include the following statement: "This software was generated 25 | # using Synth-A-Modeler, which is a modular and open-source environment 26 | # for designing physical models (see https://github.com/eberdahl/SaM)", 27 | # in the same place and form as other third-party acknowledgments. In 28 | # addition, this acknowledgment must appear prominently in any software 29 | # generated by Synth-A-Modeler in the same form and location as other 30 | # such third-party acknowledgments, and in such a manner that users 31 | # will be aware that the software was generated by Synth-A-Modeler. 32 | # 33 | # This program is free software: you can redistribute it and/or modify 34 | # it under the terms of the GNU General Public License version 3 as 35 | # published by the Free Software Foundation except subject to the additional 36 | # attribution requirements described beneath the copyright notice above. 37 | # 38 | # This program is distributed in the hope that it will be useful, 39 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 40 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 41 | # GNU General Public License for more details. 42 | # 43 | # You should have received a copy of the modified GNU General Public 44 | # License along with this program. 45 | 46 | 47 | 48 | 49 | port(),dev0; # pos 171,77 50 | mass(massVal,0.0,0.0),m1; # pos 45,46 51 | port(),dev1; # pos 299,61 52 | ground(0.0),g; # pos 299,61 53 | 54 | 55 | link(k,R,0.0),l1,m1,dev0; 56 | link(0.0,mR,0.0),l2,m1,g; 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | faustcode: k=hslider("Link stiffness [N/m]",50.0,0.0,400.0,10.0); 65 | faustcode: R=hslider("Link Damping [N/(m/s)]",0.2,0.0,5.0,0.001); 66 | faustcode: mR=hslider("Mass Damping [N/(m/s)]",0.123,0.0,5.0,0.001); 67 | faustcode: massVal=hslider("Mass [kg]",0.5,0.02,2.5,0.01); 68 | faustcode: outputDSP=highpass(4,20.0); 69 | 70 | 71 | audioout,a0,0.0; # pos 43,160 72 | audioout,a1,0.0; # pos 187,160 73 | -------------------------------------------------------------------------------- /Makefile.pdcompile: -------------------------------------------------------------------------------- 1 | 2 | ###-------------------------------------------- 3 | ### Build puredata externals on Darwin or Linux 4 | ### 5 | 6 | system := $(shell uname -s) 7 | DEST := pddir/ 8 | 9 | ifdef SAMTARGET 10 | dspsrc := $(SAMTARGET).mdl 11 | else 12 | dspsrc := $(wildcard *.mdl) 13 | endif 14 | 15 | cppsrc := $(addprefix $(DEST), $(dspsrc:.mdl=.cpp)) 16 | dspfile := $(dspsrc:.mdl=.dsp) 17 | mdxfile := $(dspsrc:.mdl=.mdx) 18 | patches := $(addprefix $(DEST), $(dspsrc:.mdl=.pd)) 19 | FAUST2PD := faust2pd 20 | F2PDFLAGS := -r 10 -s 21 | 22 | ###-------------------------------------------- 23 | ### compilation flags for Linux 24 | ### 25 | LINUXCFLAGS := -DPD -fPIC -Wall -O3 -mfpmath=sse -msse -msse2 -msse3 -ffast-math 26 | LINUXINCLUDE := -I/usr/include/pdextended 27 | 28 | ###-------------------------------------------- 29 | ### compilation flags for Darwin 30 | ### 31 | DARWINCFLAGS := -DPD -fPIC -Wall -O3 -msse -msse2 -msse3 -ffast-math -Wextra-tokens -Wno-unused-variable 32 | DYNLOAD_FLAGS := -bundle -undefined suppress -flat_namespace 33 | DARWININCLUDE := -I/Applications/Pd-extended.app/Contents/Resources/include/ 34 | 35 | ###-------------------------------------------- 36 | ### check what type of modules to build (MacOSX Darwin or Linux) 37 | ### 38 | ifeq ($(system), Darwin) 39 | modules := $(addprefix $(DEST), $(dspsrc:.mdl=~.pd_darwin)) 40 | else 41 | modules := $(addprefix $(DEST), $(dspsrc:.mdl=~.pd_linux)) 42 | endif 43 | 44 | 45 | ###-------------------------------------------- 46 | ### Will use faust2pd to create the GUI patches 47 | ### only if it is installed 48 | 49 | helper:=$(shell which faust2pd) 50 | hasfaust2pd := $(findstring /faust2pd, $(helper)) 51 | 52 | ifeq ($(hasfaust2pd),) 53 | todo:=$(modules) 54 | else 55 | todo:=$(modules) $(patches) 56 | endif 57 | 58 | ###-------------------------------------------- 59 | 60 | 61 | allmodules: $(mdxfile) $(dspfile) $(todo) 62 | 63 | %.mdx : %.mdl 64 | @perl SAM-preprocessor $< $@ 65 | 66 | %.dsp : %.mdx 67 | perl Synth-A-Modeler $< $@ 68 | 69 | $(DEST)%.cpp: %.dsp 70 | # $(dspfile) # EJB: I don't know why that was in here, so I commented it out ... 71 | faust -a $(ARCH) -double $< -o $@ 72 | # If there are pre-specified help files, then copy them over 73 | cp pdhelp/$(<:.dsp=*) $(DEST) & 74 | 75 | $(DEST)%.pd: %.dsp 76 | sed 's/samtargetdspname/$(<:.dsp=)/g' PureDataFireFaderSimulator.pd > $(DEST)$(<:.dsp=-FireFaderSimulator.pd) 77 | faust -xml $< -o /dev/null 78 | $(FAUST2PD) $(F2PDFLAGS) $<.xml 79 | mv $(<:.dsp=.pd) $(DEST) 80 | rm -f $<.xml 81 | 82 | $(DEST)%~.pd_linux: $(DEST)%.cpp 83 | $(CXX) $(LINUXCFLAGS) $(LINUXINCLUDE) -shared -Dmydsp=$(patsubst %~.pd_linux,%,$(notdir $@)) $< -o $@ 84 | 85 | # On Darwin we create both 32-bits and 64-bits intel code 86 | $(DEST)%~.pd_darwin: $(DEST)%.cpp 87 | $(CXX) -arch i386 $(DARWINCFLAGS) $(DARWININCLUDE) $(DYNLOAD_FLAGS) -Dmydsp=$(patsubst %~.pd_darwin,%,$(notdir $@)) $< -o $@.i386 88 | $(CXX) -arch x86_64 $(DARWINCFLAGS) $(DARWININCLUDE) $(DYNLOAD_FLAGS) -Dmydsp=$(patsubst %~.pd_darwin,%,$(notdir $@)) $< -o $@.x86_64 89 | lipo -create $@.i386 $@.x86_64 -output $@ 90 | rm $@.i386 $@.x86_64 91 | 92 | clean: 93 | rm -rf $(DEST) 94 | -------------------------------------------------------------------------------- /pluck_a_resonator.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # (c) Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # The above copyright notice including the copyright holders and this 10 | # permission notice shall be included in all copies, substantial 11 | # portions, or derivatives of the Software and Software portions. 12 | # 13 | # The end-user documentation included with the redistribution, if any, 14 | # must include the following acknowledgment: "This software was 15 | # developed at least in part using Synth-A-Modeler, which is a modular 16 | # and open-source environment for designing physical models (see 17 | # https://github.com/eberdahl/SaM)", in the same place and form as other 18 | # third-party acknowledgments. In addition, this acknowledgment must 19 | # appear in the software itself in the same form and location as other 20 | # such third-party acknowledgments. 21 | # 22 | # Alternatively, if software is generated using Synth-A-Modeler, then 23 | # the end-user documentation included with the generated software, if 24 | # any, must include the following statement: "This software was generated 25 | # using Synth-A-Modeler, which is a modular and open-source environment 26 | # for designing physical models (see https://github.com/eberdahl/SaM)", 27 | # in the same place and form as other third-party acknowledgments. In 28 | # addition, this acknowledgment must appear prominently in any software 29 | # generated by Synth-A-Modeler in the same form and location as other 30 | # such third-party acknowledgments, and in such a manner that users 31 | # will be aware that the software was generated by Synth-A-Modeler. 32 | # 33 | # This program is free software: you can redistribute it and/or modify 34 | # it under the terms of the GNU General Public License version 3 as 35 | # published by the Free Software Foundation except subject to the additional 36 | # attribution requirements described beneath the copyright notice above. 37 | # 38 | # This program is distributed in the hope that it will be useful, 39 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 40 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 41 | # GNU General Public License for more details. 42 | # 43 | # You should have received a copy of the modified GNU General Public 44 | # License along with this program. 45 | 46 | 47 | 48 | 49 | port(),dev0; # pos 203,61 50 | resonators(freq1*1.0,2.5,m*1.0),r0; # pos 64,32 51 | port(),dev0cpy; # pos 331,61 52 | 53 | 54 | pluck(k*1.0,R*1.0,maxDisp*1.0,0.00),p0,dev0,r0; 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | faustcode: vol=hslider("Volume",0.2,0.0,3.0,0.05); 64 | faustcode: k=hslider("Pluck stiffness [N/m]",600.0,10.0,1000.0,10.0); 65 | faustcode: R=hslider("Pluck damping [N/(m/s)]", 0.12, 0.0, 0.5, 0.01); 66 | faustcode: freq1=hslider("Resonator frequency [Hz]", 50.0, 20.0, 1000.0, 10.0); 67 | faustcode: maxDisp=hslider("Pluck max displacement [m]",0.007,0.001,0.02,0.001); 68 | faustcode: m=hslider("Resonator mass [kg]",0.015,0.0005,0.25,0.0005); 69 | 70 | 71 | audioout,a0,r0*vol*3000.0; # pos 51,160 72 | audioout,a1,p0*vol*0.10; # pos 147,160 73 | -------------------------------------------------------------------------------- /pluck_a_mass_on_link.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # (c) Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # The above copyright notice including the copyright holders and this 10 | # permission notice shall be included in all copies, substantial 11 | # portions, or derivatives of the Software and Software portions. 12 | # 13 | # The end-user documentation included with the redistribution, if any, 14 | # must include the following acknowledgment: "This software was 15 | # developed at least in part using Synth-A-Modeler, which is a modular 16 | # and open-source environment for designing physical models (see 17 | # https://github.com/eberdahl/SaM)", in the same place and form as other 18 | # third-party acknowledgments. In addition, this acknowledgment must 19 | # appear in the software itself in the same form and location as other 20 | # such third-party acknowledgments. 21 | # 22 | # Alternatively, if software is generated using Synth-A-Modeler, then 23 | # the end-user documentation included with the generated software, if 24 | # any, must include the following statement: "This software was generated 25 | # using Synth-A-Modeler, which is a modular and open-source environment 26 | # for designing physical models (see https://github.com/eberdahl/SaM)", 27 | # in the same place and form as other third-party acknowledgments. In 28 | # addition, this acknowledgment must appear prominently in any software 29 | # generated by Synth-A-Modeler in the same form and location as other 30 | # such third-party acknowledgments, and in such a manner that users 31 | # will be aware that the software was generated by Synth-A-Modeler. 32 | # 33 | # This program is free software: you can redistribute it and/or modify 34 | # it under the terms of the GNU General Public License version 3 as 35 | # published by the Free Software Foundation except subject to the additional 36 | # attribution requirements described beneath the copyright notice above. 37 | # 38 | # This program is distributed in the hope that it will be useful, 39 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 40 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 41 | # GNU General Public License for more details. 42 | # 43 | # You should have received a copy of the modified GNU General Public 44 | # License along with this program. 45 | 46 | 47 | 48 | 49 | port(),dev0 ; # pos 267,61 50 | ground(0.0),g0; # pos 45,46 51 | port(),dev0cpy; # pos 363,61 52 | mass(m*1.0,0.0,0.0),m0; # pos 160,32 53 | 54 | 55 | link(rk*1.0,rR*1.0,0.0),l0,m0,g0 ; 56 | pluck(k*1.0,R*1.0,maxDisp*1.0,0.0),p0,dev0,m0; 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | faustcode: vol=hslider("Volume",0.1,0.0,1.5,0.02); 66 | faustcode: k=hslider("Pluck stiffness [N/m]",600.0,10.0,1000.0,10.0); 67 | faustcode: R=hslider("Pluck damping [N/(m/s)]", 0.07, 0.0, 0.5, 0.01); 68 | faustcode: maxDisp=hslider("Pluck max displacement [m]",0.007,0.001,0.02,0.001); 69 | faustcode: m=hslider("Resonator mass [kg]",0.01,0.0005,0.1,0.0005); 70 | faustcode: rR=hslider("Resonator damping [N/(m/s)]",0.01,0.0,0.2,0.001); 71 | faustcode: rk=hslider("Resonator stiffness [N/m]",600.0,0.0,1000.0,10.0); 72 | 73 | 74 | audioout,a0,m0*vol*3000.0; # pos 51,160 75 | audioout,a1,p0*vol*0.10; # pos 147,160 76 | -------------------------------------------------------------------------------- /touch_a_modal_resonator.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # (c) Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # The above copyright notice including the copyright holders and this 10 | # permission notice shall be included in all copies, substantial 11 | # portions, or derivatives of the Software and Software portions. 12 | # 13 | # The end-user documentation included with the redistribution, if any, 14 | # must include the following acknowledgment: "This software was 15 | # developed at least in part using Synth-A-Modeler, which is a modular 16 | # and open-source environment for designing physical models (see 17 | # https://github.com/eberdahl/SaM)", in the same place and form as other 18 | # third-party acknowledgments. In addition, this acknowledgment must 19 | # appear in the software itself in the same form and location as other 20 | # such third-party acknowledgments. 21 | # 22 | # Alternatively, if software is generated using Synth-A-Modeler, then 23 | # the end-user documentation included with the generated software, if 24 | # any, must include the following statement: "This software was generated 25 | # using Synth-A-Modeler, which is a modular and open-source environment 26 | # for designing physical models (see https://github.com/eberdahl/SaM)", 27 | # in the same place and form as other third-party acknowledgments. In 28 | # addition, this acknowledgment must appear prominently in any software 29 | # generated by Synth-A-Modeler in the same form and location as other 30 | # such third-party acknowledgments, and in such a manner that users 31 | # will be aware that the software was generated by Synth-A-Modeler. 32 | # 33 | # This program is free software: you can redistribute it and/or modify 34 | # it under the terms of the GNU General Public License version 3 as 35 | # published by the Free Software Foundation except subject to the additional 36 | # attribution requirements described beneath the copyright notice above. 37 | # 38 | # This program is distributed in the hope that it will be useful, 39 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 40 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 41 | # GNU General Public License for more details. 42 | # 43 | # You should have received a copy of the modified GNU General Public 44 | # License along with this program. 45 | 46 | 47 | 48 | # Specify audio target GUI widgets 49 | faustcode:resonanceFrequency=hslider("Resonance Frequency", 30.0, 20.0, 800.0, 4.0); 50 | faustcode:decayTimeOfResonator=hslider("Decay Time of Resonator", 1.0, 0.01, 5.0, 0.01); 51 | faustcode:massOfResonator=hslider("Mass of Resonator", 0.003, 0.0002, 0.01, 0.0002); 52 | faustcode:interactionStiffness=hslider("Touch Interaction Stiffness", 300.0, 50.0, 500.0, 50.0); 53 | faustcode:interactionDamping=hslider("Touch Interaction Damping", 0.01, 0.002, 0.1, 0.002); 54 | 55 | 56 | faustcode: outputDSP=highpass(4,20.0); 57 | faustcode: vol=0.05*hslider("Ze volume",3000.0,50.0,10000.0,10.0); 58 | 59 | 60 | # Model itself 61 | resonators(resonanceFrequency, decayTimeOfResonator, massOfResonator),r1; 62 | port( ),dev1; 63 | port( ),dev2; 64 | 65 | touch(interactionStiffness,interactionDamping,0.0),tt,r1,dev1; 66 | 67 | audioout,aLeft,r1:*(vol):outputDSP; 68 | audioout,aRight,r1:*(vol):outputDSP; 69 | -------------------------------------------------------------------------------- /pluck_a_mass_on_link_alex.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # (c) Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # The above copyright notice including the copyright holders and this 10 | # permission notice shall be included in all copies, substantial 11 | # portions, or derivatives of the Software and Software portions. 12 | # 13 | # The end-user documentation included with the redistribution, if any, 14 | # must include the following acknowledgment: "This software was 15 | # developed at least in part using Synth-A-Modeler, which is a modular 16 | # and open-source environment for designing physical models (see 17 | # https://github.com/eberdahl/SaM)", in the same place and form as other 18 | # third-party acknowledgments. In addition, this acknowledgment must 19 | # appear in the software itself in the same form and location as other 20 | # such third-party acknowledgments. 21 | # 22 | # Alternatively, if software is generated using Synth-A-Modeler, then 23 | # the end-user documentation included with the generated software, if 24 | # any, must include the following statement: "This software was generated 25 | # using Synth-A-Modeler, which is a modular and open-source environment 26 | # for designing physical models (see https://github.com/eberdahl/SaM)", 27 | # in the same place and form as other third-party acknowledgments. In 28 | # addition, this acknowledgment must appear prominently in any software 29 | # generated by Synth-A-Modeler in the same form and location as other 30 | # such third-party acknowledgments, and in such a manner that users 31 | # will be aware that the software was generated by Synth-A-Modeler. 32 | # 33 | # This program is free software: you can redistribute it and/or modify 34 | # it under the terms of the GNU General Public License version 3 as 35 | # published by the Free Software Foundation except subject to the additional 36 | # attribution requirements described beneath the copyright notice above. 37 | # 38 | # This program is distributed in the hope that it will be useful, 39 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 40 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 41 | # GNU General Public License for more details. 42 | # 43 | # You should have received a copy of the modified GNU General Public 44 | # License along with this program. 45 | 46 | 47 | 48 | port(),dev0 ; # pos 267,61 49 | ground(0.0),g0; # pos 45,46 50 | port(),dev0cpy; # pos 363,61 51 | mass(m*1.0,0.0,0.0),m0; # pos 160,32 52 | 53 | 54 | link(rk*1.0,rR*1.0,0.0),l0,m0,g0 ; 55 | pluck(k*1.0,R*1.0,maxDisp*1.0,0.0),p0,dev0,m0; 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | faustcode: vol=hslider("Volume",0.1,0.0,1.5,0.02); 65 | faustcode: k=hslider("Pluck stiffness [N/m]",600.0,10.0,1000.0,10.0); 66 | faustcode: R=hslider("Pluck damping [N/(m/s)]", 0.07, 0.0, 0.5, 0.01); 67 | faustcode: maxDisp=hslider("Pluck max displacement [m]",0.007,0.001,0.02,0.001); 68 | faustcode: m=hslider("Resonator mass [kg]",0.01,0.0005,0.1,0.0005); 69 | faustcode: rR=hslider("Resonator damping [N/(m/s)]",0.01,0.0,0.2,0.001); 70 | faustcode: rk=hslider("Resonator stiffness [N/m]",600.0,0.0,1000.0,10.0); 71 | 72 | 73 | audioout,a0,(m0*vol*3000.0):highpass(3,30.0); # pos 51,160 74 | audioout,a1,(p0*vol*0.10):highpass(3,30.0); # pos 147,160 75 | -------------------------------------------------------------------------------- /guiro.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # (c) Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # The above copyright notice including the copyright holders and this 10 | # permission notice shall be included in all copies, substantial 11 | # portions, or derivatives of the Software and Software portions. 12 | # 13 | # The end-user documentation included with the redistribution, if any, 14 | # must include the following acknowledgment: "This software was 15 | # developed at least in part using Synth-A-Modeler, which is a modular 16 | # and open-source environment for designing physical models (see 17 | # https://github.com/eberdahl/SaM)", in the same place and form as other 18 | # third-party acknowledgments. In addition, this acknowledgment must 19 | # appear in the software itself in the same form and location as other 20 | # such third-party acknowledgments. 21 | # 22 | # Alternatively, if software is generated using Synth-A-Modeler, then 23 | # the end-user documentation included with the generated software, if 24 | # any, must include the following statement: "This software was generated 25 | # using Synth-A-Modeler, which is a modular and open-source environment 26 | # for designing physical models (see https://github.com/eberdahl/SaM)", 27 | # in the same place and form as other third-party acknowledgments. In 28 | # addition, this acknowledgment must appear prominently in any software 29 | # generated by Synth-A-Modeler in the same form and location as other 30 | # such third-party acknowledgments, and in such a manner that users 31 | # will be aware that the software was generated by Synth-A-Modeler. 32 | # 33 | # This program is free software: you can redistribute it and/or modify 34 | # it under the terms of the GNU General Public License version 3 as 35 | # published by the Free Software Foundation except subject to the additional 36 | # attribution requirements described beneath the copyright notice above. 37 | # 38 | # This program is distributed in the hope that it will be useful, 39 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 40 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 41 | # GNU General Public License for more details. 42 | # 43 | # You should have received a copy of the modified GNU General Public 44 | # License along with this program. 45 | 46 | 47 | 48 | 49 | port(),dev0; # pos 43,285 50 | port(),dev1; # pos 491,93 51 | resonators(200.0,decayTime*1.0,0.01),r0; # pos 352,288 52 | resonators(700.0,decayTime*1.0,0.01),r1; # pos 352,192 53 | resonators(500.0,decayTime*1.0,0.01),r2; # pos 352,128 54 | resonators(300.0,decayTime*1.0,0.01),r3; # pos 352,64 55 | resonators(70.0,decayTime*1.0,0.01),r0cpy; # pos 352,416 56 | resonators(150.0,decayTime*1.0,0.01),r1cpy; # pos 352,352 57 | 58 | 59 | pluck(k*1.0,R*1.0,maxdist*1.0,0.00),p0,dev0,r0; 60 | pluck(k*1.0,R*1.0,maxdist*1.0,0.01),p1,dev0,r1; 61 | pluck(k*1.0,R*1.0,maxdist*1.0,0.02),p2,dev0,r2; 62 | pluck(k*1.0,R*1.0,maxdist*1.0,0.03),p3,dev0,r3; 63 | pluck(k*1.0,R*1.0,maxdist*1.0,-0.01),p4,dev0,r1cpy; 64 | pluck(k*1.0,R*1.0,maxdist*1.0,-0.02),p5,dev0,r0cpy; 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | faustcode: k=hslider("Pluck stiffness [N/m]",140.0,50.0,800.0,10.0); 74 | faustcode: R=hslider("Pluck damping [N/(m/s)]",0.35,0.0,0.5,0.01); 75 | faustcode: maxdist=hslider("Pluck width [m]",0.005,0.001,0.01,0.001); 76 | faustcode: vol=hslider("Volume",75.0,5.0,1000.0,5.0); 77 | faustcode: decayTime=hslider("Resonator decay time [s]",0.29,0.01,3.0,0.01); 78 | 79 | 80 | audioout,a0,r0*vol*2.0+r2*vol*6.0+r0cpy*vol*2.0; # pos 275,480 81 | audioout,a1,r1*vol*6.0+r3*vol*4.0+r1cpy*vol*1.4; # pos 467,320 82 | -------------------------------------------------------------------------------- /SAM-reg-ex: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | #Perhaps I should also be using the following lines, but it works without officially making this a "package." 4 | #package SAM-reg-ex; 5 | ##file: SAM-reg-ex.pm 6 | 7 | # We need to use this package in order to be able to export the variable names. 8 | use Exporter 'import'; 9 | 10 | 11 | 12 | 13 | # First define the regular expressions that will be used for parsing the MDL file 14 | our $mylabel = qr/([a-zA-Z\d]*)/; # for a single label # NOTE EARLIER THIS WAS + INSTEAD OF *, WHICH COULD POSSIBLE BREAK THE adjust COMMANDS 15 | our $mylabels = qr/([a-zA-Z,\d\s]*)/; # for comma-separated labels with whitespaces 16 | 17 | #our $myval = qr/([-\+Ee\.\d]+)/; # A "floating-point" number can contain the characters +, -, e, E, ., and any digit and in any order -- maybe this is broken? 18 | #our $myParams = qr/(\s*[-\+\.eE,\s\d]+\s*)/; # To represent comma-represented lists of numbers ... this was previously my $myParams = qr/([-\d\.eE,\s]+)?/; 19 | # Actually, maybe we should just assume that any text included within parenthesis will both be parsable by Faust and by any "controladjust" commands (just disallow newlines, returns, alarms, escapes, and form feeds) 20 | my $myParams = qr/(\s*[^\n\r\a\e\f]*\s*)/; 21 | 22 | # A single parameter is analogous but may not contain any commas 23 | my $myParam = qr/(\s*[^\n\r\a\e\f,]*\s*)/; 24 | 25 | #### Now I have changed my parameter lists to allow references to variable names, mathematical operations, really anything understood by Faust. 26 | #### Thus, each parameter is really just any non-zero text that doesn't include commas, newlines, returns, alarms, escapes, and form feeds 27 | ####our $myParams = qr/(\s*[[^,\n\r\a\e\f]+,\s\d]+\s*)/; 28 | ####our $myParams = qr/(\s*[\w,\s\d]+\s*)/; 29 | 30 | 31 | our $link = qr/(link|pluck|touch|linkCA|BUT|pulseTouch|pulseTouchGeneral|pulseTouchTable)/; 32 | our $linkline = qr/\A\s*${link}\(\s*${myParams}\s*\)\s*,\s*${mylabel}\s*,\s*${mylabel}\s*,\s*${mylabel}\s*;\s*$/; 33 | 34 | our $vertex = qr/(mass|port|ground|resonators|massCA)/; 35 | our $vertexline = qr/\A\s*${vertex}\(\s*${myParams}\s*\)\s*,\s*${mylabel}\s*;\s*$/; 36 | 37 | our $audiooutDetails = qr/(.+)/; 38 | our $audiooutline = qr/\A\s*audioout\s*,\s*${mylabel}\s*,${audiooutDetails};\s*$/; 39 | #our $moreAudioOutSums = qr/(.*)/; 40 | #our $audiooutParseSum = qr/\A\s*,\s*${mylabel}\s*,\s*${myval}\s*${moreAudioOutSums}/; 41 | 42 | our $faustCode = qr/(.*)/; 43 | our $faustCodeLine = qr/\A\s*faustcode:\s*${faustCode}$/; 44 | 45 | our $adjustIndex = qr/([\d]+)/; 46 | #our $adjustline = qr/\A\s*controladjust\s*,\s*${mylabel}\s*,\s*${mylabel}\s*:\s*${adjustIndex}\s*;\s*$/; 47 | our $adjustline = qr/\A\s*controladjust\s*,\s*${mylabel}\s*,\s*${mylabel}\s*:\s*${adjustIndex}\s*;\s*$/; 48 | 49 | our $terminationline = qr/\A\s*termination\(\s*${myParams}\s*\)\s*,\s*${mylabel}\s*;\s*$/; 50 | our $waveguideline = qr/\A\s*waveguide\(\s*${myParam}\s*,\s*${myParams}\s*\)\s*,\s*${mylabel}\s*,\s*${mylabel}\s*,\s*${mylabel}\s*;\s*$/; 51 | 52 | our $junctioninteraction = qr/(junctionlink|junctionlinkUnderneath|junctiontouch|junctiontouchUnderneath|junctionpluck|junctionpluckUnderneath)/; 53 | our $junctioninteractionline = qr/\A\s*${junctioninteraction}\(\s*${myParams}\s*\)\s*,\s*${mylabel}\s*,\s*${mylabel}\s*;\s*$/; 54 | our $junctionline = qr/\A\s*junction\(\s*${myParams}\s*\)\s*,\s*${mylabel}\s*;\s*$/; 55 | 56 | push @EXPORT, qw( $mylabel $mylabels $link $linkline $vertex $vertexline $audiooutDetails $audiooutline $faustCode $faustCodeLine $adjustIndex $adjustline $terminationline $waveguideline $junctioninteractionline $junctionline ); 57 | 58 | # If we were going to export functions, then we would use syntax akin to the following 59 | #our @EXPORT = qw( myFunction1 myFunction2 ); 60 | 61 | 1; 62 | -------------------------------------------------------------------------------- /touch_several_modal_resonators.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # (c) Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # The above copyright notice including the copyright holders and this 10 | # permission notice shall be included in all copies, substantial 11 | # portions, or derivatives of the Software and Software portions. 12 | # 13 | # The end-user documentation included with the redistribution, if any, 14 | # must include the following acknowledgment: "This software was 15 | # developed at least in part using Synth-A-Modeler, which is a modular 16 | # and open-source environment for designing physical models (see 17 | # https://github.com/eberdahl/SaM)", in the same place and form as other 18 | # third-party acknowledgments. In addition, this acknowledgment must 19 | # appear in the software itself in the same form and location as other 20 | # such third-party acknowledgments. 21 | # 22 | # Alternatively, if software is generated using Synth-A-Modeler, then 23 | # the end-user documentation included with the generated software, if 24 | # any, must include the following statement: "This software was generated 25 | # using Synth-A-Modeler, which is a modular and open-source environment 26 | # for designing physical models (see https://github.com/eberdahl/SaM)", 27 | # in the same place and form as other third-party acknowledgments. In 28 | # addition, this acknowledgment must appear prominently in any software 29 | # generated by Synth-A-Modeler in the same form and location as other 30 | # such third-party acknowledgments, and in such a manner that users 31 | # will be aware that the software was generated by Synth-A-Modeler. 32 | # 33 | # This program is free software: you can redistribute it and/or modify 34 | # it under the terms of the GNU General Public License version 3 as 35 | # published by the Free Software Foundation except subject to the additional 36 | # attribution requirements described beneath the copyright notice above. 37 | # 38 | # This program is distributed in the hope that it will be useful, 39 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 40 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 41 | # GNU General Public License for more details. 42 | # 43 | # You should have received a copy of the modified GNU General Public 44 | # License along with this program. 45 | 46 | 47 | 48 | 49 | resonators(f1,tau,m*(440.0/f1)^3,f2,tau*1.4,m*(440.0/f2)^3,f3,tau*0.8,m*(440.0/f3)^3,f4,tau*0.5,m*(440.0/f4)^3),reson1; # pos 384,160 50 | #resonators(f1,tau,m,f2,tau*1.4,m,f3,tau*0.8,m,f4,tau*0.5,m),reson1; # pos 384,160 51 | port(),dev1; # pos 387,285 52 | port(),dev2; # pos 267,157 53 | 54 | 55 | touch(interactionStiffness,interactionDamping,0.0),tt,reson1,dev1; 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | faustcode: f=300; // Reference frequency for the initial resonance frequency choices 65 | faustcode: f1=hslider("Resonance Frequency1", f, 40.0, 3000.0, 4.0); 66 | faustcode: f2=hslider("Resonance Frequency2", f*1.4142, 40.0, 3000.0, 4.0); 67 | faustcode: f3=hslider("Resonance Frequency3", f*1.7321, 40.0, 3000.0, 4.0); 68 | faustcode: f4=hslider("Resonance Frequency4", f*2.2361, 40.0, 3000.0, 4.0); 69 | faustcode: tau=hslider("Decay Time of Resonator", 1.0, 0.01, 5.0, 0.01); 70 | faustcode: m=hslider("Mass of Resonator", 0.003, 0.0004, 0.008, 0.0002); 71 | faustcode: interactionStiffness=hslider("Touch Interaction Stiffness", 250.0, 0.0, 500.0, 50.0); 72 | faustcode: interactionDamping=hslider("Touch Interaction Damping", 0.09, 0.002, 0.3, 0.002); 73 | faustcode: outputDSP=highpass(4,30.0); 74 | faustcode: vol=hslider("Z Volume",0.03,0.001,0.10,0.001) : onePoleBLT(10.0); // LP filter with cutoff frequency at 10Hz smoothes 75 | 76 | 77 | audioout,aLeft,reson1*100000.0:*(vol):outputDSP; # pos 355,40 78 | audioout,aRight,reson1*100000.0:*(vol):outputDSP; # pos 555,96 79 | -------------------------------------------------------------------------------- /touch_several_fixed_modal_resonators_with_virtual_drumstick.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # (c) Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # The above copyright notice including the copyright holders and this 10 | # permission notice shall be included in all copies, substantial 11 | # portions, or derivatives of the Software and Software portions. 12 | # 13 | # The end-user documentation included with the redistribution, if any, 14 | # must include the following acknowledgment: "This software was 15 | # developed at least in part using Synth-A-Modeler, which is a modular 16 | # and open-source environment for designing physical models (see 17 | # https://github.com/eberdahl/SaM)", in the same place and form as other 18 | # third-party acknowledgments. In addition, this acknowledgment must 19 | # appear in the software itself in the same form and location as other 20 | # such third-party acknowledgments. 21 | # 22 | # Alternatively, if software is generated using Synth-A-Modeler, then 23 | # the end-user documentation included with the generated software, if 24 | # any, must include the following statement: "This software was generated 25 | # using Synth-A-Modeler, which is a modular and open-source environment 26 | # for designing physical models (see https://github.com/eberdahl/SaM)", 27 | # in the same place and form as other third-party acknowledgments. In 28 | # addition, this acknowledgment must appear prominently in any software 29 | # generated by Synth-A-Modeler in the same form and location as other 30 | # such third-party acknowledgments, and in such a manner that users 31 | # will be aware that the software was generated by Synth-A-Modeler. 32 | # 33 | # This program is free software: you can redistribute it and/or modify 34 | # it under the terms of the GNU General Public License version 3 as 35 | # published by the Free Software Foundation except subject to the additional 36 | # attribution requirements described beneath the copyright notice above. 37 | # 38 | # This program is distributed in the hope that it will be useful, 39 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 40 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 41 | # GNU General Public License for more details. 42 | # 43 | # You should have received a copy of the modified GNU General Public 44 | # License along with this program. 45 | 46 | 47 | 48 | 49 | 50 | faustcode: f0=hslider("Resonance Frequency 0",890, 40.0, 3000.0, 4.0); 51 | faustcode: tau=hslider("Decay Time of Resonator",1.9632, 0.01, 5.0, 0.01); 52 | 53 | resonators(f0*1,tau*1,m*1,f0*1.8315,tau*0.97297,m*0.69187,f0*2.8315,tau*0.89189,m*0.13873,f0*3.382,tau*0.54054,m*0.28468,f0*4.3708,tau*0.45946,m*0.76812,f0*5.3596,tau*0.35135,m*0.31639,f0*7.7528,tau*0.13514,m*0.06071,f0*8.1011,tau*0.13514,m*0.21944,f0*9.236,tau*0.10811,m*0.1121,f0*10.382,tau*0.13514,m*0.13839,f0*12.2247,tau*0.081081,m*0.11011,f0*15.7865,tau*0.081081,m*0.097149),reson1; # pos 384,160 54 | 55 | 56 | 57 | port(),dev1; # pos 387,285 58 | port(),dev2; # pos 267,157 59 | 60 | mass(md,0.0,0.0),mdrumstick; 61 | link(holdingStiffness,holdingDamping,0.0),ll,dev1,mdrumstick; 62 | touch(interactionStiffness,interactionDamping,0.0),tt,reson1,mdrumstick; 63 | 64 | 65 | 66 | faustcode: m=hslider("Mass of Resonator", 0.0043, 0.0005, 0.03, 0.0002); 67 | faustcode: md=hslider("Mass of Drumstick", 0.006, 0.001, 0.01, 0.0002); 68 | faustcode: holdingStiffness=hslider("Holding Stiffness", 60.0, 10.0, 150.0, 5.0); 69 | faustcode: holdingDamping=hslider("Holding Damping", 0.1, 0.002, 0.1, 0.002); 70 | faustcode: interactionStiffness=hslider("Touch Interaction Stiffness", 200.0, 50.0, 2500.0, 50.0); 71 | faustcode: interactionDamping=hslider("Touch Interaction Damping", 0.082, 0.002, 0.1, 0.002); 72 | faustcode: outputDSP=highpass(4,50.0); 73 | faustcode: vol=hslider("Z Volume",0.3,0.01,1.0,0.01) : onePoleBLT(10.0); // LP filter with cutoff frequency at 10Hz smoothes 74 | 75 | 76 | 77 | audioout,aLeft,reson1*100000.0:*(vol):outputDSP; # pos 355,40 78 | audioout,aRight,reson1*100000.0:*(vol):outputDSP; # pos 555,96 79 | -------------------------------------------------------------------------------- /simple_snare.mdl: -------------------------------------------------------------------------------- 1 | # This is a very simple snare "drum" model of two small masses bouncing 2 | # on top of a resonant membrane. The sound output corresponds to 3 | # the positions of the bouncing masses. 4 | 5 | 6 | 7 | # MDL file for Synth-A-Modeler 8 | # 9 | # (c) Edgar Berdahl, 2012 10 | # Audio Communication Group 11 | # Technical University of Berlin 12 | # 13 | # ------------------------------------------------------------------- 14 | # 15 | # The above copyright notice including the copyright holders and this 16 | # permission notice shall be included in all copies, substantial 17 | # portions, or derivatives of the Software and Software portions. 18 | # 19 | # The end-user documentation included with the redistribution, if any, 20 | # must include the following acknowledgment: "This software was 21 | # developed at least in part using Synth-A-Modeler, which is a modular 22 | # and open-source environment for designing physical models (see 23 | # https://github.com/eberdahl/SaM)", in the same place and form as other 24 | # third-party acknowledgments. In addition, this acknowledgment must 25 | # appear in the software itself in the same form and location as other 26 | # such third-party acknowledgments. 27 | # 28 | # Alternatively, if software is generated using Synth-A-Modeler, then 29 | # the end-user documentation included with the generated software, if 30 | # any, must include the following statement: "This software was generated 31 | # using Synth-A-Modeler, which is a modular and open-source environment 32 | # for designing physical models (see https://github.com/eberdahl/SaM)", 33 | # in the same place and form as other third-party acknowledgments. In 34 | # addition, this acknowledgment must appear prominently in any software 35 | # generated by Synth-A-Modeler in the same form and location as other 36 | # such third-party acknowledgments, and in such a manner that users 37 | # will be aware that the software was generated by Synth-A-Modeler. 38 | # 39 | # This program is free software: you can redistribute it and/or modify 40 | # it under the terms of the GNU General Public License version 3 as 41 | # published by the Free Software Foundation except subject to the additional 42 | # attribution requirements described beneath the copyright notice above. 43 | # 44 | # This program is distributed in the hope that it will be useful, 45 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 46 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 47 | # GNU General Public License for more details. 48 | # 49 | # You should have received a copy of the modified GNU General Public 50 | # License along with this program. 51 | 52 | 53 | 54 | 55 | faustcode:touchStiffnL=hslider("touchStiffnL", 18000.0, 2000.0, 20000.0, 1000.0); 56 | faustcode:touchStiffnR=hslider("touchStiffnR", 13000.0, 2000.0, 20000.0, 1000.0); 57 | faustcode:massL=hslider("massL", 0.000007, 0.000003, 0.00001, 0.000001); 58 | faustcode:massR=hslider("massR", 0.000004, 0.000003, 0.00001, 0.000001); 59 | faustcode:massMembrane=hslider("massMembrane", 0.08, 0.0001, 0.1, 0.0001); 60 | faustcode:decayTimeMembrane =hslider("decayTimeMembrane", 0.08, 0.01, 1.0, 0.01); 61 | faustcode:freqMembrane=hslider("freqMembrane",170.0, 30.0, 2000.0, 10.0); 62 | faustcode:touchDamp=hslider("touchDamp",0.01,0.00,0.5,0.01); 63 | faustcode:gravParam=hslider("gravParam",30.0,1.0,100.0,1.0); 64 | faustcode:vol=hslider("Ze Volume",27.0,-40.0,40.0,1.0) : db2linear : onePoleBLT(2.0); // LP filter with cutoff frequency at 2Hz helps eliminate zipper noise 65 | 66 | 67 | mass(massL,0.0,0.0),msnr1; 68 | mass(massR,0.0,0.0),msnr2; 69 | resonators(freqMembrane, decayTimeMembrane, massMembrane),r1; 70 | ground(0.0),g; 71 | #ground(-0.1),gunder; 72 | port( ),dev1; 73 | port( ),dev2; 74 | 75 | 76 | # For the snares 77 | touch(touchStiffnL,0.03,0.0),ttsrn1,r1,msnr1; 78 | link(gravParam,0.00,0.0), lsrn1,g,msnr1; 79 | 80 | touch(touchStiffnR,0.03,0.0),ttsrn2,r1,msnr2; 81 | link(gravParam,0.00,0.0), lsrn2,g,msnr2; 82 | 83 | 84 | 85 | link(50.0,0.001,0.0),ldev2,dev2,g; 86 | touch(100.0,touchDamp,0.0),tt,dev1,r1; 87 | 88 | # Actually for this particular model, the highpass filter isn't necessary ... 89 | #audioout,a1,((r1*(0.0)+msnr1*(1000.0)):*(vol)); 90 | #audioout,a2,(r1*(0.0)+msnr2*(1000.0)); 91 | #audioout,a1,(r1*(0.0)+msnr1*(1000.0)):*(vol); 92 | #audioout,a2,(r1*(0.0)+msnr2*(1000.0)):*(vol); 93 | audioout,a1,(r1*(0.0)+msnr1*(1000.0)):*(vol):defaultOutputDSP; 94 | audioout,a2,(r1*(0.0)+msnr2*(1000.0)):*(vol):defaultOutputDSP; 95 | -------------------------------------------------------------------------------- /pluck_one_string_pitch_control.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # (c) Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # The above copyright notice including the copyright holders and this 10 | # permission notice shall be included in all copies, substantial 11 | # portions, or derivatives of the Software and Software portions. 12 | # 13 | # The end-user documentation included with the redistribution, if any, 14 | # must include the following acknowledgment: "This software was 15 | # developed at least in part using Synth-A-Modeler, which is a modular 16 | # and open-source environment for designing physical models (see 17 | # https://github.com/eberdahl/SaM)", in the same place and form as other 18 | # third-party acknowledgments. In addition, this acknowledgment must 19 | # appear in the software itself in the same form and location as other 20 | # such third-party acknowledgments. 21 | # 22 | # Alternatively, if software is generated using Synth-A-Modeler, then 23 | # the end-user documentation included with the generated software, if 24 | # any, must include the following statement: "This software was generated 25 | # using Synth-A-Modeler, which is a modular and open-source environment 26 | # for designing physical models (see https://github.com/eberdahl/SaM)", 27 | # in the same place and form as other third-party acknowledgments. In 28 | # addition, this acknowledgment must appear prominently in any software 29 | # generated by Synth-A-Modeler in the same form and location as other 30 | # such third-party acknowledgments, and in such a manner that users 31 | # will be aware that the software was generated by Synth-A-Modeler. 32 | # 33 | # This program is free software: you can redistribute it and/or modify 34 | # it under the terms of the GNU General Public License version 3 as 35 | # published by the Free Software Foundation except subject to the additional 36 | # attribution requirements described beneath the copyright notice above. 37 | # 38 | # This program is distributed in the hope that it will be useful, 39 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 40 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 41 | # GNU General Public License for more details. 42 | # 43 | # You should have received a copy of the modified GNU General Public 44 | # License along with this program. 45 | 46 | 47 | 48 | # To do: Maybe make the wave impedance adjustable via the GUI ... 49 | 50 | 51 | 52 | # To specify frequency in Hz 53 | # faustcode: freq=hslider("Frequency [Hz]", 80.0, 20.0, 1000.0, 5.0); 54 | 55 | # To specify frequency using MIDI note numbers 56 | faustcode: freqMIDI=hslider("Frequency [MIDI]", 28.0, 20.0, 84.0, 0.05); 57 | faustcode: freq = 440.0*pow(2.0,(freqMIDI-69.0)/12.0); 58 | 59 | faustcode: k=hslider("Pluck stiffness [N/m]",750.0,50.0,1000.0,50.0); 60 | faustcode: R=hslider("Pluck damping [N/(m/s)]",0.4,0.0,2.5,0.01); 61 | faustcode: relPos=hslider("Pluck position along length",0.4,0.01,0.99,0.01); 62 | faustcode: maxdisp=hslider("Pluck half-width [m]",0.006,0.001,0.01,0.001); 63 | faustcode: bridgeAtten=hslider("Bridge attenuation",5.5,0.5,7.0,0.01); 64 | faustcode: bridgeFc=hslider("Bridge cutoff freq [Hz]",5200.0,1000.0,fs,10.0); 65 | faustcode: fretAtten=hslider("Fret attenuation",3.46,0.5,7.0,0.01); 66 | faustcode: R0=hslider("String wave impedance",1.6,0.25,7.5,0.1); 67 | faustcode: fretFc=hslider("Fret cutoff freq [Hz]",4180.0,1000.0,fs,10.0); 68 | faustcode: moveStrings=hslider("Waveguides position adjustment",1.0,0.1,1.4,0.01); 69 | faustcode: vol=hslider("Z Volume",0.22,0.01,1.0,0.01) : onePoleBLT(10.0); // LP filter with cutoff frequency at 10Hz smoothes volume control signal 70 | faustcode: outputDSP=highpass(4,20.0); 71 | 72 | 73 | 74 | port(),dev0; # pos 395,45 75 | port(),dev1; # pos 363,277 76 | 77 | 78 | 79 | pluck(k,R,maxdisp,0.0),p0,junct0,dev0; 80 | 81 | 82 | 83 | # These waveguide delay lengths are NOT compensated by the delay introduced by the terminations: 84 | # waveguide(R0,simpleString(0.027,(1.0/freq)*relPos)),wg0,bridge,junct0; 85 | # waveguide(R0,simpleString(0.027,(1.0/freq)*(1.0-relPos))),wg1,fret,junct0; 86 | 87 | # These waveguide delay lengths are compensated by the delay introduced by the terminations: 88 | waveguide(R0,simpleString(0.027,(1.0/freq)*relPos-simpleStringTermDelay(bridgeFc))),wg0,bridge,junct0; 89 | waveguide(R0,simpleString(0.027,(1.0/freq)*(1.0-relPos)-simpleStringTermDelay(fretFc))),wg1,fret,junct0; 90 | 91 | 92 | 93 | termination(simpleStringTerm(-1.0+pow(10.0,-bridgeAtten:float), bridgeFc)),bridge; # pos 32,154 94 | termination(simpleStringTerm(-1.0+pow(10.0,-fretAtten:float), fretFc)),fret; # pos 440,146 95 | 96 | 97 | 98 | junction(0.0),junct0; # pos 248,96 99 | 100 | 101 | 102 | audioout,a0,(bridge*vol):outputDSP; # pos 51,280 103 | audioout,a1,(fret*vol):outputDSP; # pos 507,272 104 | -------------------------------------------------------------------------------- /pdhelp/touch_a_resonator-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 104 96 433 425 10; 2 | #X obj 9 106 touch_a_resonator~; 3 | #X obj 105 152 dac~; 4 | #X obj 117 26 hsl 128 15 -50 50 0 0 empty empty empty -2 -8 0 10 -262144 5 | -1 -1 12700 1; 6 | #X floatatom 279 68 5 0 0 0 - - -; 7 | #N canvas 0 22 158 175 make-smooth-audio-signal~ 0; 8 | #X obj 19 13 inlet; 9 | #X obj 19 37 * 0.001; 10 | #X obj 19 86 line~; 11 | #X msg 19 64 \$1 20; 12 | #X obj 79 66 outlet; 13 | #X obj 19 135 outlet~; 14 | #X obj 19 110 lp2~ 10 0.707 200; 15 | #X connect 0 0 1 0; 16 | #X connect 1 0 3 0; 17 | #X connect 1 0 4 0; 18 | #X connect 2 0 6 0; 19 | #X connect 3 0 2 0; 20 | #X connect 6 0 5 0; 21 | #X restore 114 46 pd make-smooth-audio-signal~; 22 | #X text 67 61 dev1; 23 | #X text 70 70 pos; 24 | #X text 310 57 Finger position; 25 | #X text 312 69 m; 26 | #X obj 11 81 r \$0-in; 27 | #X text 16 178 Generated Fri Apr 13 12:55:38 2012 by faust2pd v2.3. 28 | See http://faust.grame.fr and http://pure-lang.googlecode.com.; 29 | #X text 112 7 Position of finger interacting with resonator; 30 | #X text 61 125 aLeft; 31 | #X text 123 121 aRight; 32 | #X obj 15 -172 hsl 128 15 0.0004 0.008 0 0 \$0-touch-a-resonator/Mass-of-Resonator 33 | \$0-touch-a-resonator/Mass-of-Resonator Mass-of-Resonator -2 -6 0 10 34 | -262144 -1 -1 2900 1; 35 | #X obj 165 -172 nbx 5 14 0.0004 0.008 0 0 \$0-touch-a-resonator/Mass-of-Resonator 36 | \$0-touch-a-resonator/Mass-of-Resonator empty 0 -6 0 10 -262144 -1 37 | -1 0.00213543 256; 38 | #X obj 15 -142 hsl 128 15 400 8000 0 0 \$0-touch-a-resonator/Stiffness-of-Resonator 39 | \$0-touch-a-resonator/Stiffness-of-Resonator Stiffness-of-Resonator 40 | -2 -6 0 10 -262144 -1 -1 9700 1; 41 | #X obj 165 -142 nbx 5 14 400 8000 0 0 \$0-touch-a-resonator/Stiffness-of-Resonator 42 | \$0-touch-a-resonator/Stiffness-of-Resonator empty 0 -6 0 10 -262144 43 | -1 -1 6204.72 256; 44 | #X obj 15 -112 hsl 128 15 0.002 0.1 0 0 \$0-touch-a-resonator/Touch-Interaction-Damping 45 | \$0-touch-a-resonator/Touch-Interaction-Damping Touch-Interaction-Damping 46 | -2 -6 0 10 -262144 -1 -1 0 1; 47 | #X obj 165 -112 nbx 5 14 0.002 0.1 0 0 \$0-touch-a-resonator/Touch-Interaction-Damping 48 | \$0-touch-a-resonator/Touch-Interaction-Damping empty 0 -6 0 10 -262144 49 | -1 -1 0.002 256; 50 | #X obj 15 -82 hsl 128 15 50 500 0 0 \$0-touch-a-resonator/Touch-Interaction-Stiffness 51 | \$0-touch-a-resonator/Touch-Interaction-Stiffness Touch-Interaction-Stiffness 52 | -2 -6 0 10 -262144 -1 -1 9100 1; 53 | #X obj 165 -82 nbx 5 14 50 500 0 0 \$0-touch-a-resonator/Touch-Interaction-Stiffness 54 | \$0-touch-a-resonator/Touch-Interaction-Stiffness empty 0 -6 0 10 -262144 55 | -1 -1 372.441 256; 56 | #X obj 202 -199 bng 15 250 50 1 \$0-init \$0-ignore empty 0 -6 0 10 57 | -262144 -1 -1; 58 | #X obj 222 -199 tgl 15 1 \$0-active \$0-active empty 0 -6 0 10 -262144 59 | -1 -1 1 1; 60 | #X obj 455 -192 r \$0-init; 61 | #X obj 879 -192 s \$0-in; 62 | #X obj 1091 -192 s \$0-read; 63 | #X obj 1303 -192 r \$0-write; 64 | #X msg 455 -172 1; 65 | #X obj 455 -152 s \$0-active; 66 | #X obj 879 -172 r \$0-active; 67 | #X msg 879 -152 active \$1; 68 | #X obj 1303 -172 route active; 69 | #X obj 1303 -152 s \$0-active; 70 | #X msg 455 -132 0.001; 71 | #X obj 455 -112 s \$0-touch-a-resonator/Mass-of-Resonator; 72 | #X obj 879 -132 r \$0-touch-a-resonator/Mass-of-Resonator; 73 | #X msg 879 -112 /touch-a-resonator/Mass-of-Resonator \$1; 74 | #X obj 1303 -132 route /touch-a-resonator/Mass-of-Resonator; 75 | #X obj 1303 -112 s \$0-touch-a-resonator/Mass-of-Resonator; 76 | #X msg 455 -92 4200; 77 | #X obj 455 -72 s \$0-touch-a-resonator/Stiffness-of-Resonator; 78 | #X obj 879 -92 r \$0-touch-a-resonator/Stiffness-of-Resonator; 79 | #X msg 879 -72 /touch-a-resonator/Stiffness-of-Resonator \$1; 80 | #X obj 1303 -92 route /touch-a-resonator/Stiffness-of-Resonator; 81 | #X obj 1303 -72 s \$0-touch-a-resonator/Stiffness-of-Resonator; 82 | #X msg 455 -52 0.03; 83 | #X obj 455 -32 s \$0-touch-a-resonator/Touch-Interaction-Damping; 84 | #X obj 879 -52 r \$0-touch-a-resonator/Touch-Interaction-Damping; 85 | #X msg 879 -32 /touch-a-resonator/Touch-Interaction-Damping \$1; 86 | #X obj 1303 -52 route /touch-a-resonator/Touch-Interaction-Damping 87 | ; 88 | #X obj 1303 -32 s \$0-touch-a-resonator/Touch-Interaction-Damping; 89 | #X msg 455 -12 100; 90 | #X obj 455 8 s \$0-touch-a-resonator/Touch-Interaction-Stiffness; 91 | #X obj 879 -12 r \$0-touch-a-resonator/Touch-Interaction-Stiffness 92 | ; 93 | #X msg 879 8 /touch-a-resonator/Touch-Interaction-Stiffness \$1; 94 | #X obj 1303 -12 route /touch-a-resonator/Touch-Interaction-Stiffness 95 | ; 96 | #X obj 1303 8 s \$0-touch-a-resonator/Touch-Interaction-Stiffness; 97 | #X connect 0 3 1 0; 98 | #X connect 0 4 1 1; 99 | #X connect 2 0 4 0; 100 | #X connect 4 0 0 1; 101 | #X connect 4 1 3 0; 102 | #X connect 9 0 0 0; 103 | #X connect 24 0 34 0; 104 | #X connect 24 0 40 0; 105 | #X connect 24 0 46 0; 106 | #X connect 24 0 52 0; 107 | #X connect 27 0 32 0; 108 | #X connect 28 0 29 0; 109 | #X connect 30 0 31 0; 110 | #X connect 31 0 25 0; 111 | #X connect 32 0 33 0; 112 | #X connect 32 1 38 0; 113 | #X connect 34 0 35 0; 114 | #X connect 36 0 37 0; 115 | #X connect 37 0 25 0; 116 | #X connect 38 0 39 0; 117 | #X connect 38 1 44 0; 118 | #X connect 40 0 41 0; 119 | #X connect 42 0 43 0; 120 | #X connect 43 0 25 0; 121 | #X connect 44 0 45 0; 122 | #X connect 44 1 50 0; 123 | #X connect 46 0 47 0; 124 | #X connect 48 0 49 0; 125 | #X connect 49 0 25 0; 126 | #X connect 50 0 51 0; 127 | #X connect 50 1 56 0; 128 | #X connect 52 0 53 0; 129 | #X connect 54 0 55 0; 130 | #X connect 55 0 25 0; 131 | #X connect 56 0 57 0; 132 | -------------------------------------------------------------------------------- /waveguide_drum.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # (c) Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # The above copyright notice including the copyright holders and this 10 | # permission notice shall be included in all copies, substantial 11 | # portions, or derivatives of the Software and Software portions. 12 | # 13 | # The end-user documentation included with the redistribution, if any, 14 | # must include the following acknowledgment: "This software was 15 | # developed at least in part using Synth-A-Modeler, which is a modular 16 | # and open-source environment for designing physical models (see 17 | # https://github.com/eberdahl/SaM)", in the same place and form as other 18 | # third-party acknowledgments. In addition, this acknowledgment must 19 | # appear in the software itself in the same form and location as other 20 | # such third-party acknowledgments. 21 | # 22 | # Alternatively, if software is generated using Synth-A-Modeler, then 23 | # the end-user documentation included with the generated software, if 24 | # any, must include the following statement: "This software was generated 25 | # using Synth-A-Modeler, which is a modular and open-source environment 26 | # for designing physical models (see https://github.com/eberdahl/SaM)", 27 | # in the same place and form as other third-party acknowledgments. In 28 | # addition, this acknowledgment must appear prominently in any software 29 | # generated by Synth-A-Modeler in the same form and location as other 30 | # such third-party acknowledgments, and in such a manner that users 31 | # will be aware that the software was generated by Synth-A-Modeler. 32 | # 33 | # This program is free software: you can redistribute it and/or modify 34 | # it under the terms of the GNU General Public License version 3 as 35 | # published by the Free Software Foundation except subject to the additional 36 | # attribution requirements described beneath the copyright notice above. 37 | # 38 | # This program is distributed in the hope that it will be useful, 39 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 40 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 41 | # GNU General Public License for more details. 42 | # 43 | # You should have received a copy of the modified GNU General Public 44 | # License along with this program. 45 | 46 | 47 | 48 | 49 | # To do: Make the GUI elements hierarchical 50 | 51 | faustcode:frequencyScaler = 0.3; 52 | faustcode:outputDSP=highpass(4,20.0); 53 | 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 54 | faustcode:fc1=hslider("Term cutoff freq 1 [Hz]",35000.0,1000.0,fs,10.0); 55 | faustcode:fc2=hslider("Term cutoff freq 2 [Hz]",28000.0,1000.0,fs,10.0); 56 | faustcode:fc3=hslider("Term cutoff freq 3 [Hz]",32000.0,1000.0,fs,10.0); 57 | faustcode:fc4=hslider("Term cutoff freq 4 [Hz]",21000.0,1000.0,fs,10.0); 58 | faustcode:fcALL=hslider("Term cutoff freq SCALE ALL",0.23,0.01,1.0,0.001); 59 | 60 | 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); 61 | 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); 62 | 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); 63 | 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); 64 | #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)); 65 | #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)); 66 | #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)); 67 | #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)); 68 | 69 | faustcode:maxDelTime=0.05; 70 | faustcode:delTime1=0.001*delTimeSc*hslider("Waveguide delay 1 [ms]", 21.0, 0.01, maxDelTime*1000.0, 0.01); 71 | faustcode:delTime2=0.001*delTimeSc*hslider("Waveguide delay 2 [ms]", 30.0, 0.01, maxDelTime*1000.0, 0.01); 72 | faustcode:delTime3=0.001*delTimeSc*hslider("Waveguide delay 3 [ms]", 9.5, 0.01, maxDelTime*1000.0, 0.01); 73 | faustcode:delTime4=0.001*delTimeSc*hslider("Waveguide delay 4 [ms]", 19.0, 0.01, maxDelTime*1000.0, 0.01); 74 | faustcode:delTimeSc=hslider("Waveguide delay SCALE ALL", 0.21, 0.001, 1.0, 0.001); 75 | 76 | faustcode:wiSc=hslider("Waveguide impedance SCALE ALL", 0.84, 0.001, 1.0, 0.001); 77 | 78 | termination(simpleStringTerm(t1reflCoef,fc1*fcALL)),t1 ; 79 | waveguide(0.5*wiSc, simpleString(maxDelTime, delTime1)),w1,t1 ,junct1; 80 | 81 | termination(simpleStringTerm(t2reflCoef,fc2*fcALL)), t2; 82 | waveguide(0.5*wiSc,simpleString(maxDelTime, delTime2)),w2,t2, junct1; 83 | 84 | termination(simpleStringTerm(t3reflCoef,fc3*fcALL) ),t3 ; 85 | waveguide(0.5*wiSc, simpleString(maxDelTime, delTime3)),w3,t3 ,junct1; 86 | 87 | termination(simpleStringTerm(t4reflCoef,fc4*fcALL)), t4; 88 | waveguide(0.5*wiSc,simpleString(maxDelTime, delTime4)),w4,t4, junct1; 89 | 90 | junction(0.0),junct1; # we can have comments after lines as well 91 | 92 | faustcode: k=hslider("Pluck stiffness [N/m]",650.0,50.0,1000.0,50.0); 93 | faustcode: R=hslider("Pluck damping [N/(m/s)]",0.15,0.0,2.5,0.01); 94 | pluck(k, R, 0.006, 0.0),touch1 ,junct1, dev1; 95 | 96 | port( ),dev1; 97 | port( ),dev2; 98 | 99 | audioout,a1,t1:outputDSP:*(vol); 100 | audioout,a2,t2:outputDSP:*(vol); 101 | -------------------------------------------------------------------------------- /pluck_six_half_strings.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # (c) Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # The above copyright notice including the copyright holders and this 10 | # permission notice shall be included in all copies, substantial 11 | # portions, or derivatives of the Software and Software portions. 12 | # 13 | # The end-user documentation included with the redistribution, if any, 14 | # must include the following acknowledgment: "This software was 15 | # developed at least in part using Synth-A-Modeler, which is a modular 16 | # and open-source environment for designing physical models (see 17 | # https://github.com/eberdahl/SaM)", in the same place and form as other 18 | # third-party acknowledgments. In addition, this acknowledgment must 19 | # appear in the software itself in the same form and location as other 20 | # such third-party acknowledgments. 21 | # 22 | # Alternatively, if software is generated using Synth-A-Modeler, then 23 | # the end-user documentation included with the generated software, if 24 | # any, must include the following statement: "This software was generated 25 | # using Synth-A-Modeler, which is a modular and open-source environment 26 | # for designing physical models (see https://github.com/eberdahl/SaM)", 27 | # in the same place and form as other third-party acknowledgments. In 28 | # addition, this acknowledgment must appear prominently in any software 29 | # generated by Synth-A-Modeler in the same form and location as other 30 | # such third-party acknowledgments, and in such a manner that users 31 | # will be aware that the software was generated by Synth-A-Modeler. 32 | # 33 | # This program is free software: you can redistribute it and/or modify 34 | # it under the terms of the GNU General Public License version 3 as 35 | # published by the Free Software Foundation except subject to the additional 36 | # attribution requirements described beneath the copyright notice above. 37 | # 38 | # This program is distributed in the hope that it will be useful, 39 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 40 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 41 | # GNU General Public License for more details. 42 | # 43 | # You should have received a copy of the modified GNU General Public 44 | # License along with this program. 45 | 46 | 47 | 48 | 49 | port(),dev0; # pos 869,78 50 | port(),dev1; # pos 817,371 51 | 52 | 53 | pluck(k*plSc,R*plSc,maxdisp,0.025*moveStrings),p0,junct0,dev0; 54 | pluck(k*plSc,R*plSc,maxdisp,0.015*moveStrings),p1,junct0cpy2,dev0; 55 | pluck(k*plSc,R*plSc,maxdisp,0.005*moveStrings),p2,junct0cpy3,dev0; 56 | pluck(k*plSc,R*plSc,maxdisp,-0.005*moveStrings),p3,junct0cpy4,dev0; 57 | pluck(k*plSc,R*plSc,maxdisp,-0.015*moveStrings),p4,junct0cpy5,dev0; 58 | pluck(k*plSc,R*plSc,maxdisp,-0.025*moveStrings),p5,junct0cpy6,dev0; 59 | 60 | # Calculate bridge cutoff frequencies by linearly interpolating between bridgeFcLow and bridgeFcHigh as a function of the frequency 61 | faustcode: bridgeFc1 = (maxFreq-freq1)/(maxFreq-minFreq)*bridgeFcLow + (freq1-minFreq)/(maxFreq-minFreq)*bridgeFcHigh; 62 | faustcode: bridgeFc2 = (maxFreq-freq2)/(maxFreq-minFreq)*bridgeFcLow + (freq2-minFreq)/(maxFreq-minFreq)*bridgeFcHigh; 63 | faustcode: bridgeFc3 = (maxFreq-freq3)/(maxFreq-minFreq)*bridgeFcLow + (freq3-minFreq)/(maxFreq-minFreq)*bridgeFcHigh; 64 | faustcode: bridgeFc4 = (maxFreq-freq4)/(maxFreq-minFreq)*bridgeFcLow + (freq4-minFreq)/(maxFreq-minFreq)*bridgeFcHigh; 65 | faustcode: bridgeFc5 = (maxFreq-freq5)/(maxFreq-minFreq)*bridgeFcLow + (freq5-minFreq)/(maxFreq-minFreq)*bridgeFcHigh; 66 | faustcode: bridgeFc6 = (maxFreq-freq6)/(maxFreq-minFreq)*bridgeFcLow + (freq6-minFreq)/(maxFreq-minFreq)*bridgeFcHigh; 67 | 68 | waveguide(waveImp,simpleString(1.0/minFreq/2.0,1.0/freq1/2.0-simpleStringTermDelay(bridgeFc1))),wg0,term0,junct0; 69 | waveguide(waveImp,simpleString(1.0/minFreq/2.0,1.0/freq2/2.0-simpleStringTermDelay(bridgeFc2))),wg0cpy2,term0cpy2,junct0cpy2; 70 | waveguide(waveImp,simpleString(1.0/minFreq/2.0,1.0/freq3/2.0-simpleStringTermDelay(bridgeFc3))),wg0cpy3,term0cpy3,junct0cpy3; 71 | waveguide(waveImp,simpleString(1.0/minFreq/2.0,1.0/freq4/2.0-simpleStringTermDelay(bridgeFc4))),wg0cpy4,term0cpy4,junct0cpy4; 72 | waveguide(waveImp,simpleString(1.0/minFreq/2.0,1.0/freq5/2.0-simpleStringTermDelay(bridgeFc5))),wg0cpy5,term0cpy5,junct0cpy5; 73 | waveguide(waveImp,simpleString(1.0/minFreq/2.0,1.0/freq6/2.0-simpleStringTermDelay(bridgeFc6))),wg0cpy6,term0cpy6,junct0cpy6; 74 | 75 | termination(simpleStringTerm(-1.0*pow(0.001,1.0/freq1/T60), bridgeFc1)),term0; 76 | termination(simpleStringTerm(-1.0*pow(0.001,1.0/freq2/T60), bridgeFc2)),term0cpy2; 77 | termination(simpleStringTerm(-1.0*pow(0.001,1.0/freq3/T60), bridgeFc3)),term0cpy3; 78 | termination(simpleStringTerm(-1.0*pow(0.001,1.0/freq4/T60), bridgeFc4)),term0cpy4; 79 | termination(simpleStringTerm(-1.0*pow(0.001,1.0/freq5/T60), bridgeFc5)),term0cpy5; 80 | termination(simpleStringTerm(-1.0*pow(0.001,1.0/freq6/T60), bridgeFc6)),term0cpy6; 81 | 82 | junction(0.0),junct0; # pos 313,156 83 | junction(0.0),junct0cpy2; # pos 403,166 84 | junction(0.0),junct0cpy3; # pos 483,166 85 | junction(0.0),junct0cpy4; # pos 563,166 86 | junction(0.0),junct0cpy5; # pos 663,166 87 | junction(0.0),junct0cpy6; # pos 763,166 88 | 89 | 90 | faustcode: minNote = 16.0; 91 | faustcode: maxNote = 96.0; 92 | faustcode: mtof = _:-(69.0):/(12.0) <: (2.0,_) : pow : *(440.0) : _; 93 | faustcode: minFreq = mtof(minNote); 94 | faustcode: maxFreq = mtof(maxNote); 95 | faustcode: freq1 = hslider("Note1", 50.0, minNote, maxNote, 0.05):mtof; 96 | faustcode: freq2 = hslider("Note2", 52.0, minNote, maxNote, 0.05):mtof; 97 | faustcode: freq3 = hslider("Note3", 55.0, minNote, maxNote, 0.05):mtof; 98 | faustcode: freq4 = hslider("Note4", 59.0, minNote, maxNote, 0.05):mtof; 99 | faustcode: freq5 = hslider("Note5", 64.0, minNote, maxNote, 0.05):mtof; 100 | faustcode: freq6 = hslider("Note6", 76.0, minNote, maxNote, 0.05):mtof; 101 | faustcode: avgFreq = (freq1+freq2+freq3+freq4+freq5+freq6)/6.0; 102 | 103 | 104 | 105 | faustcode: T60=hslider("T60 [sec]",16.0,0.1,50.0,0.05); 106 | faustcode: bridgeFcLow=hslider("Bridge cutoff freq for low notes [Hz]",6500.0,1000.0,fs,10.0); 107 | faustcode: bridgeFcHigh=hslider("Bridge cutoff freq for high notes [Hz]",13000.0,1000.0,fs,10.0); 108 | faustcode: k=hslider("Pluck stiffness [N/m]",250.0,0.0,1000.0,50.0); 109 | faustcode: R=hslider("Pluck damping [N/(m/s)]",0.02,0.0,3.0,0.01); 110 | faustcode: maxdisp=hslider("Pluck half-width [m]",0.004,0.001,0.01,0.001); 111 | faustcode: moveStrings=hslider("Waveguides position adjustment",1.0,0.1,1.4,0.01); 112 | faustcode: vol=hslider("Z Volume",0.15,0.01,1.0,0.01); 113 | faustcode: waveImp=hslider("Wave impedance [N/(m/s)]",0.8,0.1,10.0,0.1); 114 | faustcode: plSc=hslider("Pluck impedance scaler",1.0,0.0,3.0,0.01); 115 | 116 | 117 | # This one causes the lower notes to be a little bit louder 118 | #faustcode: nlScaleOutput = sqrt; 119 | 120 | # This one causes the lower notes to be a lot louder 121 | #faustcode: nlScaleOutput = _; 122 | 123 | # This one causes no frequency-dependent scaling of note volumes 124 | faustcode: nlScaleOutput = *(0.0):+(1.0); 125 | 126 | 127 | 128 | 129 | audioout,a0,(term0*nlScaleOutput(avgFreq/freq1)+term0cpy2*nlScaleOutput(avgFreq/freq2)+term0cpy4*nlScaleOutput(avgFreq/freq4)):*(vol):highpass(4,80.0); # pos 117,334 130 | audioout,a1,(term0cpy6*nlScaleOutput(avgFreq/freq6)+term0cpy3*nlScaleOutput(avgFreq/freq3)+term0cpy5*nlScaleOutput(avgFreq/freq5)):*(vol):highpass(4,80.0); # pos 572,327 131 | -------------------------------------------------------------------------------- /throw_many_masses.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # (c) Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # The above copyright notice including the copyright holders and this 10 | # permission notice shall be included in all copies, substantial 11 | # portions, or derivatives of the Software and Software portions. 12 | # 13 | # The end-user documentation included with the redistribution, if any, 14 | # must include the following acknowledgment: "This software was 15 | # developed at least in part using Synth-A-Modeler, which is a modular 16 | # and open-source environment for designing physical models (see 17 | # https://github.com/eberdahl/SaM)", in the same place and form as other 18 | # third-party acknowledgments. In addition, this acknowledgment must 19 | # appear in the software itself in the same form and location as other 20 | # such third-party acknowledgments. 21 | # 22 | # Alternatively, if software is generated using Synth-A-Modeler, then 23 | # the end-user documentation included with the generated software, if 24 | # any, must include the following statement: "This software was generated 25 | # using Synth-A-Modeler, which is a modular and open-source environment 26 | # for designing physical models (see https://github.com/eberdahl/SaM)", 27 | # in the same place and form as other third-party acknowledgments. In 28 | # addition, this acknowledgment must appear prominently in any software 29 | # generated by Synth-A-Modeler in the same form and location as other 30 | # such third-party acknowledgments, and in such a manner that users 31 | # will be aware that the software was generated by Synth-A-Modeler. 32 | # 33 | # This program is free software: you can redistribute it and/or modify 34 | # it under the terms of the GNU General Public License version 3 as 35 | # published by the Free Software Foundation except subject to the additional 36 | # attribution requirements described beneath the copyright notice above. 37 | # 38 | # This program is distributed in the hope that it will be useful, 39 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 40 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 41 | # GNU General Public License for more details. 42 | # 43 | # You should have received a copy of the modified GNU General Public 44 | # License along with this program. 45 | 46 | 47 | 48 | 49 | 50 | 51 | faustcode:m1Mass=hslider("Maximum mass [kg]", 0.01865,0.0002,0.075,0.0001); 52 | faustcode:m2Mass=m1Mass*0.1; 53 | faustcode:m3Mass=m1Mass*0.15; 54 | faustcode:m4Mass=m1Mass*0.2; 55 | faustcode:m5Mass=m1Mass*0.25; 56 | faustcode:m6Mass=m1Mass*0.3; 57 | faustcode:m7Mass=m1Mass*0.35; 58 | faustcode:m8Mass=m1Mass*0.4; 59 | faustcode:m9Mass=m1Mass*0.45; 60 | faustcode:m10Mass=m1Mass*0.5; 61 | faustcode:m11Mass=m1Mass*0.55; 62 | faustcode:m12Mass=m1Mass*0.6; 63 | faustcode:m13Mass=m1Mass*0.65; 64 | faustcode:m14Mass=m1Mass*0.7; 65 | faustcode:m15Mass=m1Mass*0.75; 66 | faustcode:m16Mass=m1Mass*0.8; 67 | faustcode:m17Mass=m1Mass*0.85; 68 | faustcode:m18Mass=m1Mass*0.9; 69 | faustcode:m19Mass=m1Mass*0.95; 70 | faustcode:m20Mass=m1Mass*1.05; 71 | 72 | 73 | faustcode:touchm1Stiffness=hslider("Touch stiffness [N/(m)]", 130.0,1.0,500.0,1.0); 74 | faustcode:touchm1Damping=hslider("Touch damping [N/(m/s)]", 0.01,0.0,0.2,0.001); 75 | faustcode:trickDamping=hslider("Damping to ground [N/(m/s)]", 0.01,0.0,0.5,0.001); 76 | faustcode:fc=hslider("Ze Highpass cutoff frequency [Hz]", 200.0,20.0,2000.0,10.0) : onePoleBLT(1.0); 77 | faustcode:vol=hslider("Ze Volume",16.0,-10.0,70.0,1.0) : db2linear : onePoleBLT(2.0); // LP filter with cutoff frequency at 2Hz helps eliminate zipper noise 78 | 79 | 80 | touch(touchm1Stiffness,touchm1Damping,0.0),touchm1,dev1,m1; 81 | touch(touchm1Stiffness,touchm1Damping,0.0),touchm2,dev1,m2; 82 | touch(touchm1Stiffness,touchm1Damping,0.0),touchm3,dev1,m3; 83 | touch(touchm1Stiffness,touchm1Damping,0.0),touchm4,dev1,m4; 84 | touch(touchm1Stiffness,touchm1Damping,0.0),touchm5,dev1,m5; 85 | touch(touchm1Stiffness,touchm1Damping,0.0),touchm6,dev1,m6; 86 | touch(touchm1Stiffness,touchm1Damping,0.0),touchm7,dev1,m7; 87 | touch(touchm1Stiffness,touchm1Damping,0.0),touchm8,dev1,m8; 88 | touch(touchm1Stiffness,touchm1Damping,0.0),touchm9,dev1,m9; 89 | touch(touchm1Stiffness,touchm1Damping,0.0),touchm10,dev1,m10; 90 | touch(touchm1Stiffness,touchm1Damping,0.0),touchm11,dev1,m11; 91 | touch(touchm1Stiffness,touchm1Damping,0.0),touchm12,dev1,m12; 92 | touch(touchm1Stiffness,touchm1Damping,0.0),touchm13,dev1,m13; 93 | touch(touchm1Stiffness,touchm1Damping,0.0),touchm14,dev1,m14; 94 | touch(touchm1Stiffness,touchm1Damping,0.0),touchm15,dev1,m15; 95 | touch(touchm1Stiffness,touchm1Damping,0.0),touchm16,dev1,m16; 96 | touch(touchm1Stiffness,touchm1Damping,0.0),touchm17,dev1,m17; 97 | touch(touchm1Stiffness,touchm1Damping,0.0),touchm18,dev1,m18; 98 | touch(touchm1Stiffness,touchm1Damping,0.0),touchm19,dev1,m19; 99 | touch(touchm1Stiffness,touchm1Damping,0.0),touchm20,dev1,m20; 100 | 101 | link(0.0,trickDamping,0.0),l1,grnd,m1; 102 | link(0.0,trickDamping,0.0),l2,grnd,m2; 103 | link(0.0,trickDamping,0.0),l3,grnd,m3; 104 | link(0.0,trickDamping,0.0),l4,grnd,m4; 105 | link(0.0,trickDamping,0.0),l5,grnd,m5; 106 | link(0.0,trickDamping,0.0),l6,grnd,m6; 107 | link(0.0,trickDamping,0.0),l7,grnd,m7; 108 | link(0.0,trickDamping,0.0),l8,grnd,m8; 109 | link(0.0,trickDamping,0.0),l9,grnd,m9; 110 | link(0.0,trickDamping,0.0),l10,grnd,m10; 111 | link(0.0,trickDamping,0.0),l11,grnd,m11; 112 | link(0.0,trickDamping,0.0),l12,grnd,m12; 113 | link(0.0,trickDamping,0.0),l13,grnd,m13; 114 | link(0.0,trickDamping,0.0),l14,grnd,m14; 115 | link(0.0,trickDamping,0.0),l15,grnd,m15; 116 | link(0.0,trickDamping,0.0),l16,grnd,m16; 117 | link(0.0,trickDamping,0.0),l17,grnd,m17; 118 | link(0.0,trickDamping,0.0),l18,grnd,m18; 119 | link(0.0,trickDamping,0.0),l19,grnd,m19; 120 | link(0.0,trickDamping,0.0),l20,grnd,m20; 121 | 122 | mass(m1Mass,0.0,0.0),m1; 123 | mass(m2Mass,0.0,0.0),m2; 124 | mass(m3Mass,0.0,0.0),m3; 125 | mass(m4Mass,0.0,0.0),m4; 126 | mass(m5Mass,0.0,0.0),m5; 127 | mass(m6Mass,0.0,0.0),m6; 128 | mass(m7Mass,0.0,0.0),m7; 129 | mass(m8Mass,0.0,0.0),m8; 130 | mass(m9Mass,0.0,0.0),m9; 131 | mass(m10Mass,0.0,0.0),m10; 132 | mass(m11Mass,0.0,0.0),m11; 133 | mass(m12Mass,0.0,0.0),m12; 134 | mass(m13Mass,0.0,0.0),m13; 135 | mass(m14Mass,0.0,0.0),m14; 136 | mass(m15Mass,0.0,0.0),m15; 137 | mass(m16Mass,0.0,0.0),m16; 138 | mass(m17Mass,0.0,0.0),m17; 139 | mass(m18Mass,0.0,0.0),m18; 140 | mass(m19Mass,0.0,0.0),m19; 141 | mass(m20Mass,0.0,0.0),m20; 142 | 143 | # To emulate the force of gravity on the m1, we use a spring with small spring constant k_g 144 | # to a far-away location x_g so that the "force" of gravity is roughly constant 145 | # F=mg=(kg)(xg) 146 | # So xg=10m is sufficiently far away 147 | # kg = mg/xg = (0.1865 kg)(9.8 m/s^2)/10m = 0.18277 N/m 148 | ground(-10.0),xg; 149 | faustcode:kg1 = m1Mass*9.8/10.0/10.0; 150 | link(kg1,0.0,0.0),gravitym1,m1,xg; 151 | faustcode:kg2 = m2Mass*9.8/10.0/10.0; 152 | link(kg2,0.0,0.0),gravitym2,m2,xg; 153 | faustcode:kg3 = m3Mass*9.8/10.0/10.0; 154 | link(kg3,0.0,0.0),gravitym3,m3,xg; 155 | 156 | faustcode:kg4 = m4Mass*9.8/10.0/10.0; 157 | faustcode:kg5 = m5Mass*9.8/10.0/10.0; 158 | faustcode:kg6 = m6Mass*9.8/10.0/10.0; 159 | faustcode:kg7 = m7Mass*9.8/10.0/10.0; 160 | faustcode:kg8 = m8Mass*9.8/10.0/10.0; 161 | faustcode:kg9 = m9Mass*9.8/10.0/10.0; 162 | faustcode:kg10 = m10Mass*9.8/10.0/10.0; 163 | faustcode:kg11 = m11Mass*9.8/10.0/10.0; 164 | faustcode:kg12 = m12Mass*9.8/10.0/10.0; 165 | faustcode:kg13 = m13Mass*9.8/10.0/10.0; 166 | faustcode:kg14 = m14Mass*9.8/10.0/10.0; 167 | faustcode:kg15 = m15Mass*9.8/10.0/10.0; 168 | faustcode:kg16 = m16Mass*9.8/10.0/10.0; 169 | faustcode:kg17 = m17Mass*9.8/10.0/10.0; 170 | faustcode:kg18 = m18Mass*9.8/10.0/10.0; 171 | faustcode:kg19 = m19Mass*9.8/10.0/10.0; 172 | faustcode:kg20 = m20Mass*9.8/10.0/10.0; 173 | 174 | link(kg4,0.0,0.0),gravitym4,m4,xg; 175 | link(kg5,0.0,0.0),gravitym5,m5,xg; 176 | link(kg6,0.0,0.0),gravitym6,m6,xg; 177 | link(kg7,0.0,0.0),gravitym7,m7,xg; 178 | link(kg8,0.0,0.0),gravitym8,m8,xg; 179 | link(kg9,0.0,0.0),gravitym9,m9,xg; 180 | link(kg10,0.0,0.0),gravitym10,m10,xg; 181 | link(kg11,0.0,0.0),gravitym11,m11,xg; 182 | link(kg12,0.0,0.0),gravitym12,m12,xg; 183 | link(kg13,0.0,0.0),gravitym13,m13,xg; 184 | link(kg14,0.0,0.0),gravitym14,m14,xg; 185 | link(kg15,0.0,0.0),gravitym15,m15,xg; 186 | link(kg16,0.0,0.0),gravitym16,m16,xg; 187 | link(kg17,0.0,0.0),gravitym17,m17,xg; 188 | link(kg18,0.0,0.0),gravitym18,m18,xg; 189 | link(kg19,0.0,0.0),gravitym19,m19,xg; 190 | link(kg20,0.0,0.0),gravitym20,m20,xg; 191 | 192 | 193 | 194 | # It might be a good idea to differentiate the audio output or pass it through some sort of audio resonator ... 195 | faustcode: outputDSP=highpass(3,fc); 196 | 197 | 198 | port( ),dev1; # pos 200,200 199 | port( ),dev2; # pos 300,300 200 | 201 | ground(0.0),grnd; # pos 40,40 202 | 203 | audioout,a0,((m1+m3+m5+m7+m9+m11+m13+m15+m17+m19):outputDSP)*vol*fc; # pos 43,160 204 | audioout,a1,((m2+m4+m6+m8+m10+m12+m14+m16+m18+m20):outputDSP)*vol*fc; # pos 187,160 -------------------------------------------------------------------------------- /oud.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # (c) Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # The above copyright notice including the copyright holders and this 10 | # permission notice shall be included in all copies, substantial 11 | # portions, or derivatives of the Software and Software portions. 12 | # 13 | # The end-user documentation included with the redistribution, if any, 14 | # must include the following acknowledgment: "This software was 15 | # developed at least in part using Synth-A-Modeler, which is a modular 16 | # and open-source environment for designing physical models (see 17 | # https://github.com/eberdahl/SaM)", in the same place and form as other 18 | # third-party acknowledgments. In addition, this acknowledgment must 19 | # appear in the software itself in the same form and location as other 20 | # such third-party acknowledgments. 21 | # 22 | # Alternatively, if software is generated using Synth-A-Modeler, then 23 | # the end-user documentation included with the generated software, if 24 | # any, must include the following statement: "This software was generated 25 | # using Synth-A-Modeler, which is a modular and open-source environment 26 | # for designing physical models (see https://github.com/eberdahl/SaM)", 27 | # in the same place and form as other third-party acknowledgments. In 28 | # addition, this acknowledgment must appear prominently in any software 29 | # generated by Synth-A-Modeler in the same form and location as other 30 | # such third-party acknowledgments, and in such a manner that users 31 | # will be aware that the software was generated by Synth-A-Modeler. 32 | # 33 | # This program is free software: you can redistribute it and/or modify 34 | # it under the terms of the GNU General Public License version 3 as 35 | # published by the Free Software Foundation except subject to the additional 36 | # attribution requirements described beneath the copyright notice above. 37 | # 38 | # This program is distributed in the hope that it will be useful, 39 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 40 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 41 | # GNU General Public License for more details. 42 | # 43 | # You should have received a copy of the modified GNU General Public 44 | # License along with this program. 45 | 46 | 47 | 48 | 49 | port(),dev0; # pos 627,709 50 | port(),dev1; 51 | 52 | 53 | pluck(k,R,maxdisp,0.0),p0,junct0,dev0; 54 | pluck(k,R,maxdisp,0.0),p1,junct0cpy,dev0; 55 | pluck(k,R,maxdisp,0.0),p2,junct0cpy1,dev0; 56 | pluck(k,R,maxdisp,0.0),p3,junct0cpy2,dev0; 57 | pluck(k,R,maxdisp,0.0),p4,junct0cpy3,dev0; 58 | pluck(k,R,maxdisp,0.0),p5,junct0cpy4,dev0; 59 | pluck(k,R,maxdisp,0.0),p6,junct0cpy5,dev0; 60 | pluck(k,R,maxdisp,0.0),p7,junct0cpy6,dev0; 61 | pluck(k,R,maxdisp,0.0),p8,junct0cpy7,dev0; 62 | pluck(k,R,maxdisp,0.0),p9,junct0cpy8,dev0; 63 | 64 | 65 | waveguide(2.5,simpleString(0.027,(1.0/(noteC-beatSpeed-beatVar))*relPos-simpleStringTermDelay(bridgeFc))),wg0,bridge,junct0; 66 | waveguide(2.5,simpleString(0.027,(1.0/(noteC-beatSpeed-beatVar))*(1.0-relPos)-simpleStringTermDelay(fretFc))),wg1,fret,junct0; 67 | waveguide(2.5,simpleString(0.027,(1.0/noteC)*relPos-simpleStringTermDelay(bridgeFc))),wg0cpy,bridgecpy,junct0cpy; 68 | waveguide(2.5,simpleString(0.027,(1.0/noteC)*(1.0-relPos)-simpleStringTermDelay(fretFc))),wg1cpy,fretcpy,junct0cpy; 69 | waveguide(2.5,simpleString(0.027,(1.0/(noteG-beatSpeed+beatVar))*relPos-simpleStringTermDelay(bridgeFc))),wg0cpy1,bridgecpy1,junct0cpy1; 70 | waveguide(2.5,simpleString(0.027,(1.0/(noteG-beatSpeed+beatVar))*(1.0-relPos)-simpleStringTermDelay(fretFc))),wg1cpy1,fretcpy1,junct0cpy1; 71 | waveguide(2.5,simpleString(0.027,(1.0/noteG)*relPos-simpleStringTermDelay(bridgeFc))),wg0cpy2,bridgecpy2,junct0cpy2; 72 | waveguide(2.5,simpleString(0.027,(1.0/noteG)*(1.0-relPos)-simpleStringTermDelay(fretFc))),wg1cpy2,fretcpy2,junct0cpy2; 73 | waveguide(2.5,simpleString(0.027,(1.0/(noteD-beatSpeed-beatVar*0.4))*relPos-simpleStringTermDelay(bridgeFc))),wg0cpy3,bridgecpy3,junct0cpy3; 74 | waveguide(2.5,simpleString(0.027,(1.0/(noteD-beatSpeed-beatVar*0.4))*(1.0-relPos)-simpleStringTermDelay(fretFc))),wg1cpy3,fretcpy3,junct0cpy3; 75 | waveguide(2.5,simpleString(0.027,(1.0/noteD)*relPos-simpleStringTermDelay(bridgeFc))),wg0cpy4,bridgecpy4,junct0cpy4; 76 | waveguide(2.5,simpleString(0.027,(1.0/noteD)*(1.0-relPos)-simpleStringTermDelay(fretFc))),wg1cpy4,fretcpy4,junct0cpy4; 77 | waveguide(2.5,simpleString(0.027,(1.0/(noteA-beatSpeed+beatVar*0.66))*relPos-simpleStringTermDelay(bridgeFc))),wg0cpy5,bridgecpy5,junct0cpy5; 78 | waveguide(2.5,simpleString(0.027,(1.0/(noteA-beatSpeed+beatVar*0.66))*(1.0-relPos)-simpleStringTermDelay(fretFc))),wg1cpy5,fretcpy5,junct0cpy5; 79 | waveguide(2.5,simpleString(0.027,(1.0/noteA)*relPos-simpleStringTermDelay(bridgeFc))),wg0cpy6,bridgecpy6,junct0cpy6; 80 | waveguide(2.5,simpleString(0.027,(1.0/noteA)*(1.0-relPos)-simpleStringTermDelay(fretFc))),wg1cpy6,fretcpy6,junct0cpy6; 81 | waveguide(2.5,simpleString(0.027,(1.0/(noteF-beatSpeed))*relPos-simpleStringTermDelay(bridgeFc))),wg0cpy7,bridgecpy7,junct0cpy7; 82 | waveguide(2.5,simpleString(0.027,(1.0/(noteF-beatSpeed))*(1.0-relPos)-simpleStringTermDelay(fretFc))),wg1cpy7,fretcpy7,junct0cpy7; 83 | waveguide(2.5,simpleString(0.027,(1.0/noteF)*relPos-simpleStringTermDelay(bridgeFc))),wg0cpy8,bridgecpy8,junct0cpy8; 84 | waveguide(2.5,simpleString(0.027,(1.0/noteF)*(1.0-relPos)-simpleStringTermDelay(fretFc))),wg1cpy8,fretcpy8,junct0cpy8; 85 | 86 | 87 | termination(simpleStringTerm(-1.0+pow(10.0,-bridgeAtten:float), bridgeFc)),bridge; # pos 160,146 88 | termination(simpleStringTerm(-1.0+pow(10.0,-fretAtten:float), fretFc)),fret; # pos 672,146 89 | termination(simpleStringTerm(-1.0+pow(10.0,-fretAtten:float), fretFc)),fretcpy; # pos 672,178 90 | termination(simpleStringTerm(-1.0+pow(10.0,-bridgeAtten:float), bridgeFc)),bridgecpy; # pos 160,178 91 | termination(simpleStringTerm(-1.0+pow(10.0,-fretAtten:float), fretFc)),fretcpy1; # pos 672,258 92 | termination(simpleStringTerm(-1.0+pow(10.0,-bridgeAtten:float), bridgeFc)),bridgecpy1; # pos 160,258 93 | termination(simpleStringTerm(-1.0+pow(10.0,-fretAtten:float), fretFc)),fretcpy2; # pos 664,290 94 | termination(simpleStringTerm(-1.0+pow(10.0,-bridgeAtten:float), bridgeFc)),bridgecpy2; # pos 152,290 95 | termination(simpleStringTerm(-1.0+pow(10.0,-fretAtten:float), fretFc)),fretcpy3; # pos 688,370 96 | termination(simpleStringTerm(-1.0+pow(10.0,-bridgeAtten:float), bridgeFc)),bridgecpy3; # pos 152,370 97 | termination(simpleStringTerm(-1.0+pow(10.0,-fretAtten:float), fretFc)),fretcpy4; # pos 688,394 98 | termination(simpleStringTerm(-1.0+pow(10.0,-bridgeAtten:float), bridgeFc)),bridgecpy4; # pos 152,394 99 | termination(simpleStringTerm(-1.0+pow(10.0,-fretAtten:float), fretFc)),fretcpy5; # pos 672,458 100 | termination(simpleStringTerm(-1.0+pow(10.0,-bridgeAtten:float), bridgeFc)),bridgecpy5; # pos 160,458 101 | termination(simpleStringTerm(-1.0+pow(10.0,-fretAtten:float), fretFc)),fretcpy6; # pos 680,482 102 | termination(simpleStringTerm(-1.0+pow(10.0,-bridgeAtten:float), bridgeFc)),bridgecpy6; # pos 160,482 103 | termination(simpleStringTerm(-1.0+pow(10.0,-fretAtten:float), fretFc)),fretcpy7; # pos 688,562 104 | termination(simpleStringTerm(-1.0+pow(10.0,-bridgeAtten:float), bridgeFc)),bridgecpy7; # pos 176,562 105 | termination(simpleStringTerm(-1.0+pow(10.0,-fretAtten:float), fretFc)),fretcpy8; # pos 696,586 106 | termination(simpleStringTerm(-1.0+pow(10.0,-bridgeAtten:float), bridgeFc)),bridgecpy8; # pos 176,586 107 | 108 | 109 | junction(0.03),junct0; # pos 400,136 110 | junction(0.033),junct0cpy; # pos 400,168 111 | junction(0.015),junct0cpy1; # pos 400,248 112 | junction(0.0153),junct0cpy2; # pos 400,280 113 | junction(0.0),junct0cpy3; # pos 400,360 114 | junction(0.003),junct0cpy4; # pos 400,384 115 | junction(-0.015),junct0cpy5; # pos 400,448 116 | junction(-0.0153),junct0cpy6; # pos 400,472 117 | junction(-0.03),junct0cpy7; # pos 400,552 118 | junction(-0.033),junct0cpy8; # pos 400,576 119 | 120 | 121 | faustcode: freqMIDI=hslider("Frequency [MIDI]", 27.0, 20.0, 84.0, 0.05); 122 | faustcode: beatSpeed=hslider("Beating speed", 1.0, 0.3, 10.0, 0.1); 123 | faustcode: beatVar=beatSpeed*hslider("Beating variability", 1.0, 0.0, 3.0, 0.01); 124 | faustcode: freq = 440.0*pow(2.0,(freqMIDI-69.0)/12.0); 125 | faustcode: k=hslider("Pluck stiffness [N/m]",100.0,0.0,1000.0,10.0); 126 | faustcode: R=hslider("Pluck damping [N/(m/s)]",0.1,0.0,2.5,0.01); 127 | faustcode: relPos=hslider("Pluck position along length",0.29,0.05,0.95,0.01); 128 | faustcode: maxdisp=hslider("Pluck half-width [m]",0.006,0.001,0.01,0.001); 129 | faustcode: bridgeAtten=hslider("Bridge attenuation",2.5,0.5,7.0,0.01); 130 | faustcode: bridgeFc=hslider("Bridge cutoff freq [Hz]",5000.0,1000.0,fs,10.0); 131 | faustcode: fretAtten=hslider("Fret attenuation",2.5,0.5,7.0,0.01); 132 | faustcode: fretFc=hslider("Fret cutoff freq [Hz]",5000.0,1000.0,fs,10.0); 133 | faustcode: moveStrings=hslider("Waveguides position adjustment",1.0,0.1,1.4,0.01); 134 | 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 135 | faustcode: outputDSP=highpass(4,20.0); 136 | faustcode: noteF=174.61; 137 | faustcode: noteA=220.0; 138 | faustcode: noteD=293.66; 139 | faustcode: noteG=392.0; 140 | faustcode: noteC=523.25; 141 | 142 | 143 | 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 144 | 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 145 | -------------------------------------------------------------------------------- /SAM-fx.lib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | // Low-pass filter smoothes out parameter changes to help suppress clicking sounds 5 | // when adjusting models; however, it is quite expensive if there are a lot of params. 6 | //paramSmooth = onePoleBLT(10.0); 7 | paramSmooth = _; // to bypass this functionality instead 8 | 9 | 10 | SAMlimiter = compressor_mono(10e10,-6,0.0008,0.1); 11 | // syntax: compressor_mono(ratio,thresh,att,rel) 12 | // compression ratio of 10e10 means it is a very hard limiter (it is hard to make a model explode faster than this, but it is certainly possible to do so) 13 | // thresh = -6dB means limiter kicks in above this threshold 14 | // attach time is 0.8ms 15 | // release time is 0.1s 16 | 17 | 18 | defaultOutputDSP = highpass(4,20.0):SAMlimiter; 19 | 20 | 21 | 22 | // I use my own definition of an FIR filter because I find that it compiles better for longer 23 | myfir((oneCoef, restCoef)) = _ <: (_,_) : (*(oneCoef), (mem:myfir((restCoef)))) : + : _; 24 | myfir((lastCoef)) = _:*(lastCoef):_; 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | declare name "freeverb"; 39 | declare version "1.0"; 40 | declare author "Grame"; 41 | declare license "BSD"; 42 | declare copyright "(c) GRAME 2006"; 43 | declare reference "https://ccrma.stanford.edu/~jos/pasp/Freeverb.html"; 44 | 45 | //====================================================== 46 | // 47 | // Freeverb 48 | // Faster version using fixed delays (20% gain) 49 | // 50 | //====================================================== 51 | 52 | // Constant Parameters 53 | //-------------------- 54 | 55 | fixedgain = 0.015; //value of the gain of fxctrl 56 | scalewet = 3.0; 57 | scaledry = 2.0; 58 | scaledamp = 0.4; 59 | scaleroom = 0.28; 60 | offsetroom = 0.7; 61 | initialroom = 0.5; 62 | initialdamp = 0.5; 63 | initialwet = 1.0/scalewet; 64 | initialdry = 0; 65 | initialwidth= 1.0; 66 | initialmode = 0.0; 67 | freezemode = 0.5; 68 | stereospread= 23; 69 | allpassfeed = 0.5; //feedback of the delays used in allpass filters 70 | 71 | 72 | // Filter Parameters 73 | //------------------ 74 | 75 | combtuningL1 = 1116; 76 | combtuningL2 = 1188; 77 | combtuningL3 = 1277; 78 | combtuningL4 = 1356; 79 | combtuningL5 = 1422; 80 | combtuningL6 = 1491; 81 | combtuningL7 = 1557; 82 | combtuningL8 = 1617; 83 | 84 | allpasstuningL1 = 556; 85 | allpasstuningL2 = 441; 86 | allpasstuningL3 = 341; 87 | allpasstuningL4 = 225; 88 | 89 | 90 | // Control Sliders 91 | //-------------------- 92 | // Damp : filters the high frequencies of the echoes (especially active for great values of RoomSize) 93 | // RoomSize : size of the reverberation room 94 | // Dry : original signal 95 | // Wet : reverberated signal 96 | 97 | //dampSlider = hslider("Damp",0.5, 0, 1, 0.025)*scaledamp; 98 | //roomsizeSlider = hslider("RoomSize", 0.3, 0, 1, 0.025)*scaleroom + offsetroom; 99 | //wetSlider = hslider("Wet", 0.3333, 0, 1, 0.025); 100 | reverbParams = hgroup("Reverb", hslider("Damp",0.5, 0, 1, 0.025)*scaledamp, hslider("RoomSize", 0.5, 0, 1, 0.025)*scaleroom + offsetroom, hslider("Wet", 0.3333, 0, 1, 0.025)); 101 | dampSlider = reverbParams:(_,!,!); 102 | roomsizeSlider = reverbParams:(!,_,!); 103 | wetSlider = reverbParams:(!,!,_); 104 | 105 | 106 | combfeed = roomsizeSlider; 107 | 108 | 109 | // Comb and Allpass filters 110 | //------------------------- 111 | 112 | allpass(dt,fb) = (_,_ <: (*(fb),_:+:@(dt)), -) ~ _ : (!,_); 113 | 114 | comb(dt, fb, damp) = (+:@(dt)) ~ (*(1-damp) : (+ ~ *(damp)) : *(fb)); 115 | 116 | 117 | // Reverb components 118 | //------------------ 119 | 120 | monoReverb(fb1, fb2, damp, spread) 121 | = _ <: comb(combtuningL1+spread, fb1, damp), 122 | comb(combtuningL2+spread, fb1, damp), 123 | comb(combtuningL3+spread, fb1, damp), 124 | comb(combtuningL4+spread, fb1, damp), 125 | comb(combtuningL5+spread, fb1, damp), 126 | comb(combtuningL6+spread, fb1, damp), 127 | comb(combtuningL7+spread, fb1, damp), 128 | comb(combtuningL8+spread, fb1, damp) 129 | +> 130 | allpass (allpasstuningL1+spread, fb2) 131 | : allpass (allpasstuningL2+spread, fb2) 132 | : allpass (allpasstuningL3+spread, fb2) 133 | : allpass (allpasstuningL4+spread, fb2) 134 | ; 135 | 136 | stereoReverb(fb1, fb2, damp, spread) 137 | = + <: monoReverb(fb1, fb2, damp, 0), monoReverb(fb1, fb2, damp, spread); 138 | 139 | 140 | // fxctrl : add an input gain and a wet-dry control to a stereo FX 141 | //---------------------------------------------------------------- 142 | 143 | fxctrl(g,w,Fx) = _,_ <: (*(g),*(g) : Fx : *(w),*(w)), *(1-w), *(1-w) +> _,_; 144 | fxctrlMono(g,w,Fx) = _ <: (*(g) : Fx : *(w)), *(1-w) +> _; 145 | SAMfreereverb = fxctrlMono(fixedgain, wetSlider, monoReverb(combfeed, allpassfeed, dampSlider, stereospread)); 146 | 147 | 148 | 149 | 150 | 151 | 152 | // Freeverb 153 | //--------- 154 | 155 | //freeverb = vgroup("Freeverb", fxctrl(fixedgain, wetSlider, stereoReverb(combfeed, allpassfeed, dampSlider, stereospread))); 156 | freeverb = vgroup("Freeverb", fxctrl(fixedgain, wetSlider, stereoReverb(combfeed, allpassfeed, dampSlider, stereospread))); 157 | 158 | //process = monoReverb; 159 | 160 | 161 | 162 | 163 | 164 | 165 | // Note: This body response is a shortened version of Nelson Lee's recording, which was also upsampled to 44.1kHz from 22.05kHz. 166 | // https://ccrma.stanford.edu/realsimple/acoustic_guitar/gtrbody.wav 167 | // 168 | // This model can be made more efficient later using IIR filtering techniques to compress the impulse response. 169 | bodyResp1 = myfir((0.010996,0.015940,-0.007910,-0.026386,-0.005383,0.026542,0.011975,-0.037400,-0.032969,0.070333,0.194372,0.232359,0.190335,0.160973,0.168535,0.133131,0.023154,-0.050777,0.021323,0.165130,0.196982,0.075790,-0.036540,-0.009439,0.071340,0.046519,-0.067577,-0.105893,-0.016416,0.053121,-0.016233,-0.121595,-0.084661,0.077401,0.165239,0.073721,-0.074462,-0.121952,-0.088800,-0.099127,-0.163536,-0.165065,-0.057241,0.042720,0.015107,-0.092938,-0.139567,-0.090072,-0.051656,-0.106076,-0.189538,-0.183578,-0.075222,0.030470,0.041511,-0.029060,-0.103412,-0.130613,-0.118976,-0.103357,-0.106104,-0.119855,-0.111194,-0.045970,0.069655,0.174194,0.196579,0.120249,-0.003635,-0.108026,-0.158821,-0.153813,-0.101526,-0.024638,0.028712,0.015922,-0.044615,-0.075900,-0.025782,0.061489,0.087655,0.016462,-0.078545,-0.100079,-0.040614,0.017570,0.009613,-0.037281,-0.052654,-0.019547,0.010648,-0.002509,-0.029994,-0.015162,0.045512,0.091638,0.073016,0.010135,-0.032960,-0.021580,0.017872,0.036082,0.011866,-0.035258,-0.068886,-0.063503,-0.022037,0.021296,0.023695,-0.025068,-0.082327,-0.089065,-0.033546,0.033619,0.055382,0.029691,0.001300,0.001364,0.015537,0.016883,0.007663,0.012525,0.039946,0.071880,0.090686,0.097855,0.098184,0.082556,0.044166,0.005301,0.005383,0.054411,0.109116,0.111762,0.049486,-0.030992,-0.070562,-0.052333,-0.006427,0.030744,0.052535,0.075890,0.107120,0.124845,0.100711,0.034178,-0.038783,-0.074902,-0.060179,-0.017304,0.020096,0.036906,0.041127,0.046062,0.053734,0.055428,0.044166,0.023347,0.005246,0.002142,0.018815,0.048579,0.075195,0.080651,0.058596,0.022275,-0.002481,0.000183,0.019657,0.027531,0.008826,-0.020161,-0.028217,-0.005228,0.026386,0.037519,0.023145,0.001016,-0.014841,-0.026588,-0.037291,-0.037281,-0.016160,0.015674,0.034269,0.031404,0.026606,0.040184,0.063283,0.066689,0.040367,0.011097,0.014054,0.051454,0.088470,0.088974,0.050621,0.002765,-0.023154,-0.018238,0.003259,0.020957,0.022889,0.010575,-0.006198,-0.017862,-0.022221,-0.024482,-0.030305,-0.037236,-0.035798,-0.021241,-0.003571,-0.000906,-0.019602,-0.042619,-0.044707,-0.018119,0.017963,0.037309,0.032054,0.014585,0.000082,-0.008267,-0.014621,-0.020975,-0.025068,-0.026084,-0.024345,-0.019739,-0.012168,-0.005713,-0.004111,-0.003772,0.004678,0.021442,0.032273,0.022880,-0.002280,-0.024042,-0.030818,-0.030268,-0.033921,-0.038884,-0.032859,-0.013678,0.004404,0.008231,0.000174,-0.007883,-0.011325,-0.014814,-0.020838,-0.023356,-0.016068,-0.002188,0.009174,0.011774,0.005585,-0.007508,-0.024262,-0.036732,-0.035121,-0.018036,0.002124,0.009586,0.000558,-0.013889,-0.021085,-0.018787,-0.013211,-0.009156,-0.006583,-0.005210,-0.008295,-0.018018,-0.030461,-0.037941,-0.036100,-0.027668,-0.018549,-0.013157,-0.012030,-0.013239,-0.013175,-0.008570,0.000586,0.009284,0.011216,0.005054,-0.003708,-0.008057,-0.007068,-0.006034,-0.010730,-0.019840,-0.026624,-0.025040,-0.016553,-0.008487,-0.007315,-0.012653,-0.018073,-0.018357,-0.013715,-0.009174,-0.007718,-0.008158,-0.007205,-0.004843,-0.004257,-0.008048,-0.014402,-0.018174,-0.015345,-0.006803,0.002426,0.006922,0.004825,-0.001190,-0.006748,-0.009119,-0.008313,-0.005942,-0.003259,-0.001538,-0.001538,-0.003708,-0.006207,-0.007215,-0.006015,-0.004212,-0.002802,-0.001090,0.002280,0.006656,0.009815,0.010089,0.008121,0.005667,0.003763,0.002829,0.002527,0.002005,0.000403,-0.001895,-0.001914,0.002738,0.010721,0.017139,0.018091,0.014667,0.010785,0.008103,0.004999,-0.000201,-0.005512,-0.007031,-0.003250,0.003479,0.009256,0.012168,0.012488,0.011032,0.008240,0.004221,0.000192,-0.002600,-0.003030,-0.001556,0.000531,0.002179,0.002976,0.003552,0.004166,0.004431,0.003809,0.002655,0.002353,0.003836,0.006427,0.008322,0.008277,0.006931,0.005860,0.005805,0.006015,0.005210,0.003241,0.001099,0.000046,0.000293,0.001639,0.003479,0.005329,0.006043,0.004779,0.001968,-0.000549,-0.001135,-0.000412,0.000165,-0.000229,-0.000211,0.001492,0.004212,0.005777,0.005155,0.003378,0.002417,0.002628,0.003214,0.003296,0.003232,0.003296,0.003397,0.002930,0.002261,0.002078,0.002692,0.003186,0.002673,0.001108,-0.000439,-0.001108,-0.000851,-0.000201,0.000577,0.001364,0.001996,0.002023,0.001135,-0.000412,-0.001859,-0.002783,-0.002866,-0.002243,-0.000961,0.000439,0.001474,0.001520,0.000952,0.000183,-0.000156,-0.000449,-0.000577,-0.000925,-0.000943,-0.000714,-0.000549,-0.000714,-0.001227,-0.001749,-0.001611,-0.001062,-0.000146,0.000330,0.000275,-0.000284,-0.000925,-0.001282,-0.001511,-0.001566,-0.001703,-0.001520,-0.001108,-0.000504,-0.000037,0.000046,-0.000137,-0.000467,-0.000678,-0.000696,-0.000439,-0.000110,0.000092,0.000110,-0.000073,-0.000146,-0.000137,-0.000055,-0.000018,-0.000064,-0.000018)); 170 | 171 | 172 | 173 | bodyResp2 = tf2np(1.0, 1.5667, 0.3133, -0.5509, -0.3925) : tf2np(1.0, -1.9537, 0.9542, -1.6357, 0.8697) : tf2np(1.0, -1.6683, 0.8852, -1.7674, 0.8735) : tf2np(1.0, -1.8585, 0.9653, -1.8498, 0.9516) : tf2np(1.0, -1.9299, 0.9621, -1.9354, 0.9590) : tf2np(1.0, -1.9800, 0.9888, -1.9867, 0.9923); -------------------------------------------------------------------------------- /pdhelp/haptic_drum_demo-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 132 59 502 639 10; 2 | #X obj 42 509 r \$0-in; 3 | #X obj 42 539 haptic_drum_demo~; 4 | #X obj 42 569 s \$0-out; 5 | #X obj 10 30 hsl 128 15 0 0.5 0 0 \$0-haptic-drum-demo/Link-damping 6 | \$0-haptic-drum-demo/Link-damping Link-damping -2 -6 0 10 -262144 -1 7 | -1 0 1; 8 | #X obj 160 30 nbx 5 14 0 0.5 0 0 \$0-haptic-drum-demo/Link-damping 9 | \$0-haptic-drum-demo/Link-damping empty 0 -6 0 10 -262144 -1 -1 0 256 10 | ; 11 | #X obj 10 60 hsl 128 15 0 50 0 0 \$0-haptic-drum-demo/Link-stiffness 12 | \$0-haptic-drum-demo/Link-stiffness Link-stiffness -2 -6 0 10 -262144 13 | -1 -1 0 1; 14 | #X obj 160 60 nbx 5 14 0 50 0 0 \$0-haptic-drum-demo/Link-stiffness 15 | \$0-haptic-drum-demo/Link-stiffness empty 0 -6 0 10 -262144 -1 -1 0 16 | 256; 17 | #X obj 10 90 hsl 128 15 0.001 0.1 0 0 \$0-haptic-drum-demo/Bottom-left-Pulse-length 18 | \$0-haptic-drum-demo/Bottom-left-Pulse-length Bottom-left-Pulse-length 19 | -2 -6 0 10 -262144 -1 -1 1411 1; 20 | #X obj 160 90 nbx 5 14 0.001 0.1 0 0 \$0-haptic-drum-demo/Bottom-left-Pulse-length 21 | \$0-haptic-drum-demo/Bottom-left-Pulse-length empty 0 -6 0 10 -262144 22 | -1 -1 0.012 256; 23 | #X obj 10 120 hsl 128 15 0 5 0 0 \$0-haptic-drum-demo/Bottom-left-Pulse-strength 24 | \$0-haptic-drum-demo/Bottom-left-Pulse-strength Bottom-left-Pulse-strength 25 | -2 -6 0 10 -262144 -1 -1 1270 1; 26 | #X obj 160 120 nbx 5 14 0 5 0 0 \$0-haptic-drum-demo/Bottom-left-Pulse-strength 27 | \$0-haptic-drum-demo/Bottom-left-Pulse-strength empty 0 -6 0 10 -262144 28 | -1 -1 0.5 256; 29 | #X obj 10 150 hsl 128 15 0.001 0.1 0 0 \$0-haptic-drum-demo/Bottom-right-Pulse-length 30 | \$0-haptic-drum-demo/Bottom-right-Pulse-length Bottom-right-Pulse-length 31 | -2 -6 0 10 -262144 -1 -1 1411 1; 32 | #X obj 160 150 nbx 5 14 0.001 0.1 0 0 \$0-haptic-drum-demo/Bottom-right-Pulse-length 33 | \$0-haptic-drum-demo/Bottom-right-Pulse-length empty 0 -6 0 10 -262144 34 | -1 -1 0.012 256; 35 | #X obj 10 180 hsl 128 15 0 5 0 0 \$0-haptic-drum-demo/Bottom-right-Pulse-strength 36 | \$0-haptic-drum-demo/Bottom-right-Pulse-strength Bottom-right-Pulse-strength 37 | -2 -6 0 10 -262144 -1 -1 1270 1; 38 | #X obj 160 180 nbx 5 14 0 5 0 0 \$0-haptic-drum-demo/Bottom-right-Pulse-strength 39 | \$0-haptic-drum-demo/Bottom-right-Pulse-strength empty 0 -6 0 10 -262144 40 | -1 -1 0.5 256; 41 | #X obj 10 210 hsl 128 15 0.001 0.1 0 0 \$0-haptic-drum-demo/Top-left-Pulse-length 42 | \$0-haptic-drum-demo/Top-left-Pulse-length Top-left-Pulse-length -2 43 | -6 0 10 -262144 -1 -1 1411 1; 44 | #X obj 160 210 nbx 5 14 0.001 0.1 0 0 \$0-haptic-drum-demo/Top-left-Pulse-length 45 | \$0-haptic-drum-demo/Top-left-Pulse-length empty 0 -6 0 10 -262144 46 | -1 -1 0.012 256; 47 | #X obj 10 240 hsl 128 15 0 5 0 0 \$0-haptic-drum-demo/Top-left-Pulse-strength 48 | \$0-haptic-drum-demo/Top-left-Pulse-strength Top-left-Pulse-strength 49 | -2 -6 0 10 -262144 -1 -1 1270 1; 50 | #X obj 160 240 nbx 5 14 0 5 0 0 \$0-haptic-drum-demo/Top-left-Pulse-strength 51 | \$0-haptic-drum-demo/Top-left-Pulse-strength empty 0 -6 0 10 -262144 52 | -1 -1 0.5 256; 53 | #X obj 10 270 hsl 128 15 0.001 0.1 0 0 \$0-haptic-drum-demo/Top-right-Pulse-length 54 | \$0-haptic-drum-demo/Top-right-Pulse-length Top-right-Pulse-length 55 | -2 -6 0 10 -262144 -1 -1 1411 1; 56 | #X obj 160 270 nbx 5 14 0.001 0.1 0 0 \$0-haptic-drum-demo/Top-right-Pulse-length 57 | \$0-haptic-drum-demo/Top-right-Pulse-length empty 0 -6 0 10 -262144 58 | -1 -1 0.012 256; 59 | #X obj 10 300 hsl 128 15 0 5 0 0 \$0-haptic-drum-demo/Top-right-Pulse-strength 60 | \$0-haptic-drum-demo/Top-right-Pulse-strength Top-right-Pulse-strength 61 | -2 -6 0 10 -262144 -1 -1 1270 1; 62 | #X obj 160 300 nbx 5 14 0 5 0 0 \$0-haptic-drum-demo/Top-right-Pulse-strength 63 | \$0-haptic-drum-demo/Top-right-Pulse-strength empty 0 -6 0 10 -262144 64 | -1 -1 0.5 256; 65 | #X obj 197 3 bng 15 250 50 1 \$0-init \$0-ignore empty 0 -6 0 10 -262144 66 | -1 -1; 67 | #X obj 217 3 tgl 15 1 \$0-active \$0-active empty 0 -6 0 10 -262144 68 | -1 -1 1 1; 69 | #X obj 563 -4 r \$0-init; 70 | #X obj 979 -4 s \$0-in; 71 | #X obj 1187 -4 s \$0-read; 72 | #X obj 1282 10 r \$0-write; 73 | #X msg 563 16 1; 74 | #X obj 563 36 s \$0-active; 75 | #X obj 979 16 r \$0-active; 76 | #X msg 979 36 active \$1; 77 | #X obj 1282 30 route active; 78 | #X obj 1282 50 s \$0-active; 79 | #X msg 563 56 0; 80 | #X obj 563 76 s \$0-haptic-drum-demo/Link-damping; 81 | #X obj 979 56 r \$0-haptic-drum-demo/Link-damping; 82 | #X msg 979 76 /haptic-drum-demo/Link-damping \$1; 83 | #X obj 1282 70 route /haptic-drum-demo/Link-damping; 84 | #X obj 1282 90 s \$0-haptic-drum-demo/Link-damping; 85 | #X msg 563 96 0; 86 | #X obj 563 116 s \$0-haptic-drum-demo/Link-stiffness; 87 | #X obj 979 96 r \$0-haptic-drum-demo/Link-stiffness; 88 | #X msg 979 116 /haptic-drum-demo/Link-stiffness \$1; 89 | #X obj 1282 110 route /haptic-drum-demo/Link-stiffness; 90 | #X obj 1282 130 s \$0-haptic-drum-demo/Link-stiffness; 91 | #X msg 563 136 0.012; 92 | #X obj 563 156 s \$0-haptic-drum-demo/Bottom-left-Pulse-length; 93 | #X obj 979 136 r \$0-haptic-drum-demo/Bottom-left-Pulse-length; 94 | #X msg 979 156 /haptic-drum-demo/Bottom-left-Pulse-length \$1; 95 | #X obj 1282 150 route /haptic-drum-demo/Bottom-left-Pulse-length; 96 | #X obj 1282 170 s \$0-haptic-drum-demo/Bottom-left-Pulse-length; 97 | #X msg 563 176 0.5; 98 | #X obj 563 196 s \$0-haptic-drum-demo/Bottom-left-Pulse-strength; 99 | #X obj 979 176 r \$0-haptic-drum-demo/Bottom-left-Pulse-strength; 100 | #X msg 979 196 /haptic-drum-demo/Bottom-left-Pulse-strength \$1; 101 | #X obj 1282 190 route /haptic-drum-demo/Bottom-left-Pulse-strength 102 | ; 103 | #X obj 1282 210 s \$0-haptic-drum-demo/Bottom-left-Pulse-strength; 104 | #X msg 563 216 0.012; 105 | #X obj 563 236 s \$0-haptic-drum-demo/Bottom-right-Pulse-length; 106 | #X obj 979 216 r \$0-haptic-drum-demo/Bottom-right-Pulse-length; 107 | #X msg 979 236 /haptic-drum-demo/Bottom-right-Pulse-length \$1; 108 | #X obj 1282 230 route /haptic-drum-demo/Bottom-right-Pulse-length; 109 | #X obj 1282 250 s \$0-haptic-drum-demo/Bottom-right-Pulse-length; 110 | #X msg 563 256 0.5; 111 | #X obj 563 276 s \$0-haptic-drum-demo/Bottom-right-Pulse-strength; 112 | #X obj 979 256 r \$0-haptic-drum-demo/Bottom-right-Pulse-strength; 113 | #X msg 979 276 /haptic-drum-demo/Bottom-right-Pulse-strength \$1; 114 | #X obj 1282 270 route /haptic-drum-demo/Bottom-right-Pulse-strength 115 | ; 116 | #X obj 1282 290 s \$0-haptic-drum-demo/Bottom-right-Pulse-strength 117 | ; 118 | #X msg 563 296 0.012; 119 | #X obj 563 316 s \$0-haptic-drum-demo/Top-left-Pulse-length; 120 | #X obj 979 296 r \$0-haptic-drum-demo/Top-left-Pulse-length; 121 | #X msg 979 316 /haptic-drum-demo/Top-left-Pulse-length \$1; 122 | #X obj 1282 310 route /haptic-drum-demo/Top-left-Pulse-length; 123 | #X obj 1282 330 s \$0-haptic-drum-demo/Top-left-Pulse-length; 124 | #X msg 563 336 0.5; 125 | #X obj 563 356 s \$0-haptic-drum-demo/Top-left-Pulse-strength; 126 | #X obj 979 336 r \$0-haptic-drum-demo/Top-left-Pulse-strength; 127 | #X msg 979 356 /haptic-drum-demo/Top-left-Pulse-strength \$1; 128 | #X obj 1282 350 route /haptic-drum-demo/Top-left-Pulse-strength; 129 | #X obj 1282 370 s \$0-haptic-drum-demo/Top-left-Pulse-strength; 130 | #X msg 563 376 0.012; 131 | #X obj 563 396 s \$0-haptic-drum-demo/Top-right-Pulse-length; 132 | #X obj 979 376 r \$0-haptic-drum-demo/Top-right-Pulse-length; 133 | #X msg 979 396 /haptic-drum-demo/Top-right-Pulse-length \$1; 134 | #X obj 1282 390 route /haptic-drum-demo/Top-right-Pulse-length; 135 | #X obj 1282 410 s \$0-haptic-drum-demo/Top-right-Pulse-length; 136 | #X msg 563 416 0.5; 137 | #X obj 563 436 s \$0-haptic-drum-demo/Top-right-Pulse-strength; 138 | #X obj 979 416 r \$0-haptic-drum-demo/Top-right-Pulse-strength; 139 | #X msg 979 436 /haptic-drum-demo/Top-right-Pulse-strength \$1; 140 | #X obj 1282 430 route /haptic-drum-demo/Top-right-Pulse-strength; 141 | #X obj 1282 450 s \$0-haptic-drum-demo/Top-right-Pulse-strength; 142 | #X obj 158 349 hsl 128 15 -50 50 0 0 empty empty empty -2 -8 0 10 -262144 143 | -1 -1 9400 1; 144 | #X floatatom 311 395 8 0 0 0 - - -; 145 | #N canvas 0 24 158 175 make-smooth-audio-signal~ 0; 146 | #X obj 19 13 inlet; 147 | #X obj 19 86 line~; 148 | #X msg 19 64 \$1 20; 149 | #X obj 79 66 outlet; 150 | #X obj 19 135 outlet~; 151 | #X obj 19 110 lp2~ 10 0.707 200; 152 | #X obj 19 37 * 0.0006; 153 | #X connect 0 0 6 0; 154 | #X connect 1 0 5 0; 155 | #X connect 2 0 1 0; 156 | #X connect 5 0 4 0; 157 | #X connect 6 0 2 0; 158 | #X connect 6 0 3 0; 159 | #X restore 146 373 pd make-smooth-audio-signal~; 160 | #X text 99 430 dev1; 161 | #X text 102 439 pos; 162 | #X text 342 384 Finger position; 163 | #X text 344 396 m; 164 | #X text 144 334 Position of finger interacting with resonator; 165 | #X obj 212 469 hsl 128 15 -50 50 0 0 empty empty empty -2 -8 0 10 -262144 166 | -1 -1 10900 1; 167 | #X floatatom 365 515 8 0 0 0 - - -; 168 | #N canvas 0 24 158 175 make-smooth-audio-signal~ 0; 169 | #X obj 19 13 inlet; 170 | #X obj 19 86 line~; 171 | #X msg 19 64 \$1 20; 172 | #X obj 79 66 outlet; 173 | #X obj 19 135 outlet~; 174 | #X obj 19 110 lp2~ 10 0.707 200; 175 | #X obj 19 37 * 0.0006; 176 | #X connect 0 0 6 0; 177 | #X connect 1 0 5 0; 178 | #X connect 2 0 1 0; 179 | #X connect 5 0 4 0; 180 | #X connect 6 0 2 0; 181 | #X connect 6 0 3 0; 182 | #X restore 200 493 pd make-smooth-audio-signal~; 183 | #X text 176 533 pos; 184 | #X text 396 504 Finger position; 185 | #X text 398 516 m; 186 | #X text 198 454 Position of finger interacting with resonator; 187 | #X text 173 524 dev2; 188 | #X obj 141 603 dac~; 189 | #X connect 0 0 1 0; 190 | #X connect 1 0 2 0; 191 | #X connect 1 3 111 0; 192 | #X connect 1 4 111 1; 193 | #X connect 25 0 35 0; 194 | #X connect 25 0 41 0; 195 | #X connect 25 0 47 0; 196 | #X connect 25 0 53 0; 197 | #X connect 25 0 59 0; 198 | #X connect 25 0 65 0; 199 | #X connect 25 0 71 0; 200 | #X connect 25 0 77 0; 201 | #X connect 25 0 83 0; 202 | #X connect 25 0 89 0; 203 | #X connect 28 0 33 0; 204 | #X connect 29 0 30 0; 205 | #X connect 31 0 32 0; 206 | #X connect 32 0 26 0; 207 | #X connect 33 0 34 0; 208 | #X connect 33 1 39 0; 209 | #X connect 35 0 36 0; 210 | #X connect 37 0 38 0; 211 | #X connect 38 0 26 0; 212 | #X connect 39 0 40 0; 213 | #X connect 39 1 45 0; 214 | #X connect 41 0 42 0; 215 | #X connect 43 0 44 0; 216 | #X connect 44 0 26 0; 217 | #X connect 45 0 46 0; 218 | #X connect 45 1 51 0; 219 | #X connect 47 0 48 0; 220 | #X connect 49 0 50 0; 221 | #X connect 50 0 26 0; 222 | #X connect 51 0 52 0; 223 | #X connect 51 1 57 0; 224 | #X connect 53 0 54 0; 225 | #X connect 55 0 56 0; 226 | #X connect 56 0 26 0; 227 | #X connect 57 0 58 0; 228 | #X connect 57 1 63 0; 229 | #X connect 59 0 60 0; 230 | #X connect 61 0 62 0; 231 | #X connect 62 0 26 0; 232 | #X connect 63 0 64 0; 233 | #X connect 63 1 69 0; 234 | #X connect 65 0 66 0; 235 | #X connect 67 0 68 0; 236 | #X connect 68 0 26 0; 237 | #X connect 69 0 70 0; 238 | #X connect 69 1 75 0; 239 | #X connect 71 0 72 0; 240 | #X connect 73 0 74 0; 241 | #X connect 74 0 26 0; 242 | #X connect 75 0 76 0; 243 | #X connect 75 1 81 0; 244 | #X connect 77 0 78 0; 245 | #X connect 79 0 80 0; 246 | #X connect 80 0 26 0; 247 | #X connect 81 0 82 0; 248 | #X connect 81 1 87 0; 249 | #X connect 83 0 84 0; 250 | #X connect 85 0 86 0; 251 | #X connect 86 0 26 0; 252 | #X connect 87 0 88 0; 253 | #X connect 87 1 93 0; 254 | #X connect 89 0 90 0; 255 | #X connect 91 0 92 0; 256 | #X connect 92 0 26 0; 257 | #X connect 93 0 94 0; 258 | #X connect 95 0 97 0; 259 | #X connect 97 0 1 1; 260 | #X connect 97 1 96 0; 261 | #X connect 103 0 105 0; 262 | #X connect 105 0 1 2; 263 | #X connect 105 1 104 0; 264 | #X coords 0 -1 1 1 235 320 1 0 0; 265 | -------------------------------------------------------------------------------- /simple_snare_example_presets.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # (c) Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # The above copyright notice including the copyright holders and this 10 | # permission notice shall be included in all copies, substantial 11 | # portions, or derivatives of the Software and Software portions. 12 | # 13 | # The end-user documentation included with the redistribution, if any, 14 | # must include the following acknowledgment: "This software was 15 | # developed at least in part using Synth-A-Modeler, which is a modular 16 | # and open-source environment for designing physical models (see 17 | # https://github.com/eberdahl/SaM)", in the same place and form as other 18 | # third-party acknowledgments. In addition, this acknowledgment must 19 | # appear in the software itself in the same form and location as other 20 | # such third-party acknowledgments. 21 | # 22 | # Alternatively, if software is generated using Synth-A-Modeler, then 23 | # the end-user documentation included with the generated software, if 24 | # any, must include the following statement: "This software was generated 25 | # using Synth-A-Modeler, which is a modular and open-source environment 26 | # for designing physical models (see https://github.com/eberdahl/SaM)", 27 | # in the same place and form as other third-party acknowledgments. In 28 | # addition, this acknowledgment must appear prominently in any software 29 | # generated by Synth-A-Modeler in the same form and location as other 30 | # such third-party acknowledgments, and in such a manner that users 31 | # will be aware that the software was generated by Synth-A-Modeler. 32 | # 33 | # This program is free software: you can redistribute it and/or modify 34 | # it under the terms of the GNU General Public License version 3 as 35 | # published by the Free Software Foundation except subject to the additional 36 | # attribution requirements described beneath the copyright notice above. 37 | # 38 | # This program is distributed in the hope that it will be useful, 39 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 40 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 41 | # GNU General Public License for more details. 42 | # 43 | # You should have received a copy of the modified GNU General Public 44 | # License along with this program. 45 | 46 | 47 | 48 | 49 | 50 | faustcode:volAgain=hslider("Ze Volume",-12.0,-40.0,40.0,1.0) : db2linear : onePoleBLT(2.0); // LP filter with cutoff frequency at 2Hz helps eliminate zipper noise 51 | faustcode:massScaler=hslider("Scale the masses",1.0,0.25,8.0,0.01); 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | # Example of how to make presets 60 | # ------------------------------ 61 | # The following is based on Kjetil S. Matheussen's approach to implementing presents as 62 | # found on the Faust mailing list and in the documentation on rdtable (including in music.lib). 63 | # The definitions of presetInitIndex and mytake have been moved into physicalmodeling.lib. 64 | # 65 | # You need to have the following definitions per numerical entry (nentry) box that you want to have 66 | # for your model. In this case, there is just one nentry box, and it is named "Preset number." 67 | faustcode:numOfPresets = 24; 68 | faustcode:presetNum = int(nentry("Preset number",0,0,23,1)); 69 | faustcode:setupMyPresets(theParams)=rdtable(numOfPresets, mytake(presetInitIndex,numOfPresets,theParams),presetNum); 70 | 71 | # Of course, when you start developing some presets, you should start with a smaller number such as 2 or 3 instead of 72 | # going whole hog like I did and defining 24 of them :) 73 | faustcode:interactionDamping = setupMyPresets((0.188189,0.188189,0.2,0.243307,0.243307,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.145669,0.2,0.2,0.302362,0.2,0.2,0.2,0.2)); 74 | faustcode:interactionStiffness = setupMyPresets((80.6299,80.6299,80.6299,400,400,80.6299,80.6299,105.197,80.6299,80.6299,80.6299,80.6299,80.6299,80.6299,80.6299,80.6299,80.6299,80.6299,80.6299,80.6299,80.6299,80.6299,80.6299,80.6299)); 75 | faustcode:drumstickDamping = setupMyPresets((0.0590551,0.120472,0.0566929,0,0,0,0,0,0,0.0425197,0.0425197,0.0425197,0.0425197,0,0,0,0,0,0,0,0,0,0,0)); 76 | faustcode:drumstickMass = setupMyPresets((0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001)); 77 | faustcode:drumstickStiffness = setupMyPresets((275.046,275.046,275.046,32.448,32.448,330.322,330.322,330.322,330.322,400,363.15,400,400,127.645,127.645,127.645,160.472,127.645,127.645,400,127.645,127.645,127.645,127.645)); 78 | faustcode:edgeDamping = setupMyPresets((0.0732551,0.0921339,0.010326,0.0158323,0.0158323,0.00324646,0.00245984,0.00245984,0.00245984,0.0001,0.0001,0.00245984,0.00245984,0.001,0.000886614,0.000886614,0.000886614,0.00167323,0.00167323,0.00481969,0.00481969,0.00481969,0.00481969,0.00481969)); 79 | faustcode:edgeStiffness = setupMyPresets((122.018,184.38,184.38,262.333,262.333,122.018,67.4512,44.0654,44.0654,184.38,184.38,184.38,184.38,652.097,652.097,1000,1000,722.254,644.302,722.254,722.254,722.254,722.254,722.254)); 80 | faustcode:massMembrane = massScaler*setupMyPresets((0.00609624,0.00609624,0.00609624,0.00299398,0.00217611,0.0006,0.00031,0.00016288,0.00016288,0.000182383,0.000119469,0.000182383,0.000119469,0.0001,0.0001,0.0001,5e-05,5e-05,5e-05,7.5e-05,5e-05,5e-05,5e-05,5e-05)); 81 | faustcode:membraneDamping = setupMyPresets((0.075615,0.0968535,0.0142591,0.00403307,0.00403307,0.0111126,0.00324646,0.00245984,0.00324646,0.0001,0.0001,0.00324646,0.00324646,0.001,0.00167323,0.00167323,0.00167323,0.00324646,0.00324646,0.00324646,0.00639291,0.00639291,0.00639291,0.00639291)); 82 | faustcode:membraneStiffness = setupMyPresets((80.1575,267.244,267.244,160.994,160.994,823.593,823.593,387.057,823.593,165.906,165.906,165.906,165.906,675.483,1000,1000,1000,867.48,867.48,867.48,867.48,867.48,867.48,867.48)); 83 | faustcode:panVar = setupMyPresets((1,0,1,0.149606,0.653543,1,0.740157,0.307087,0,0,0.874016,0,0.874016,1,0.755906,0.535433,0,0,0.259843,0.724409,1,1,0.322835,0)); 84 | faustcode:randomTweak = setupMyPresets((0.283465,0.283465,0.283465,0.141732,0.346457,0.700787,0.732283,0.795276,0.732283,0,0,0,0,0.322835,0.322835,0.220472,0.149606,0.511811,0.511811,0.511811,0.511811,0.511811,0.511811,0.511811)); 85 | faustcode:snareDamping = setupMyPresets((0.0695984,0.0695984,0.0695984,0.0463685,0.0619591,0.0635181,0.0494866,0.0494866,0.0494866,0.0243858,0.00801575,0.0672598,0.0953228,0.0494866,0.0494866,0.0494866,0.0929843,0.0728724,0.0728724,0.0728724,0.0728724,0.0728724,0.0728724,0.0728724)); 86 | faustcode:touchStiffSnrm20xn0y = setupMyPresets((5629.88,5629.88,5629.88,1944.84,1944.84,7933.03,7933.03,7933.03,7933.03,1944.84,1944.84,1944.84,1944.84,7933.03,7933.03,7933.03,15149.6,3326.73,3326.73,3326.73,3326.73,3326.73,3326.73,3326.73)); 87 | faustcode:touchStiffSnrmn0x20y = setupMyPresets((6704.69,6704.69,6704.69,4862.17,4862.17,4862.17,4862.17,4862.17,4862.17,1330.67,1330.67,1330.67,1330.67,4862.17,4862.17,4862.17,14535.4,4862.17,4862.17,4862.17,4862.17,4862.17,4862.17,4862.17)); 88 | faustcode:touchStiffSnrmn0xn20y = setupMyPresets((5476.34,5476.34,5476.34,3787.36,3787.36,6704.69,6704.69,6704.69,6704.69,2866.1,2866.1,2866.1,2866.1,6704.69,6704.69,6704.69,18066.9,3940.91,3940.91,3940.91,3940.91,3940.91,3940.91,3940.91)); 89 | faustcode:snareVolume = setupMyPresets((0,0,0.708661,0.669291,0.629921,0.15748,0.15748,0.15748,0.15748,0,0,0.866142,0.866142,0.15748,0.15748,0.275591,0.275591,1.33858,0.433071,0.354331,0.0787402,0.0787402,0.0787402,0.0787402)); 90 | faustcode:volume1 = setupMyPresets((3,3,3,1.27559,1.27559,0.669213,0.125906,0.0786614,0.125906,0,0.0708661,0,0,0.125906,0.125906,0.125906,1.54323,0.141732,0,0.645591,0.125906,0.125906,0.125906,0.125906)); 91 | faustcode:volume2 = setupMyPresets((0,0,0,1.41732,1.41732,2.00787,2.00787,1.53543,2.00787,0.874016,1.32283,0,1.32283,2.00787,2.00787,2.00787,0.330709,1.25197,2.00787,1.06299,2.00787,2.00787,2.00787,2.00787)); 92 | faustcode:volume = setupMyPresets((3,2.17323,3,3,3,0.267638,0.267638,0.267638,0.267638,0.267638,0.149528,0.267638,0.149528,1,1,1,0.574724,0.480236,0.810945,0.314882,0.810945,0.810945,0.810945,0.810945)); 93 | faustcode:gravParam = setupMyPresets((300,300,300,255.661,222.047,255.661,255.661,255.661,255.661,0.5,0.6,0.15,0.23,255.661,255.661,255.661,300,300,300,300,300,300,300,300)); 94 | faustcode:massSnrm20xn0yMass = massScaler*setupMyPresets((0.000382119,0.000382119,0.000382119,0.000178055,0.000178055,0.000169552,0.000169552,0.000169552,0.000169552,0.000378993,0.000378993,7.26469e-05,7.26469e-05,0.000169552,0.000169552,0.000169552,0.000169552,0.000169552,0.000169552,0.000169552,0.000169552,0.000169552,0.000169552,0.000169552)); 95 | faustcode:massSnrmn0x20yMass = massScaler*setupMyPresets((0.000325852,0.000325852,0.000325852,9.45288e-05,9.45288e-05,4.76391e-05,4.76391e-05,4.76391e-05,4.76391e-05,0.000275836,0.0003196,1.95052e-05,5.7017e-05,0.000119537,4.76391e-05,4.76391e-05,4.76391e-05,8.51509e-05,6.3269e-05,4.76391e-05,4.76391e-05,4.76391e-05,4.76391e-05,4.76391e-05)); 96 | faustcode:massSnrmn0xn20yMass = massScaler*setupMyPresets((0.000357111,0.000357111,0.000357111,0.000307096,0.000307096,9.14028e-05,9.14028e-05,9.14028e-05,9.14028e-05,0.000347734,0.00035086,0.000110159,0.000110159,0.000219568,9.14028e-05,9.14028e-05,9.14028e-05,9.14028e-05,9.14028e-05,9.14028e-05,9.14028e-05,9.14028e-05,9.14028e-05,9.14028e-05)); 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | ground(0.0),mn40xn40y; 112 | ground(0.0),mn40xn20y; 113 | ground(0.0),mn40xn0y; 114 | ground(0.0),mn40x20y; 115 | ground(0.0),mn40x40y; 116 | ground(0.0),mn20xn40y; 117 | ground(0.0),mn20xn20y; 118 | #mass(massMembrane*(1.0 + randomTweak*(0.836068))),mn20xn0y; 119 | mass(0.01,0.0,0.0),mn20xn0y; 120 | ground(0.0),mn20x20y; 121 | ground(0.0),mn20x40y; 122 | ground(0.0),mn0xn40y; 123 | mass(massMembrane*(1.0 + randomTweak*(-0.799939)),0.0,0.0),mn0xn20y; 124 | mass(massSnrmn0xn20yMass*(1.0 + randomTweak*(0.574577)),0.0,0.0),massSnrmn0xn20y; 125 | link(gravParam,0.00,0.0), linkSnrmn0xn20y,snareGround,massSnrmn0xn20y; 126 | touch(touchStiffSnrmn0xn20y,snareDamping,0.0), touchSnrmn0xn20y,mn0xn20y,massSnrmn0xn20y; 127 | mass(massMembrane*(1.0 + randomTweak*(-0.542241)),0.0,0.0),mn0xn0y; 128 | mass(massMembrane*(1.0 + randomTweak*(0.567359)),0.0,0.0),mn0x20y; 129 | mass(massSnrmn0x20yMass*(1.0 + randomTweak*(-0.119600)),0.0,0.0),massSnrmn0x20y; 130 | link(gravParam,0.00,0.0), linkSnrmn0x20y,snareGround,massSnrmn0x20y; 131 | touch(touchStiffSnrmn0x20y,snareDamping,0.0), touchSnrmn0x20y,mn0x20y,massSnrmn0x20y; 132 | ground(0.0),mn0x40y; 133 | ground(0.0),m20xn40y; 134 | ground(0.0),m20xn20y; 135 | mass(massMembrane*(1.0 + randomTweak*(-0.918061)),0.0,0.0),m20xn0y; 136 | mass(massSnrm20xn0yMass*(1.0 + randomTweak*(-0.061272)),0.0,0.0),massSnrm20xn0y; 137 | link(gravParam,0.00,0.0), linkSnrm20xn0y,snareGround,massSnrm20xn0y; 138 | touch(touchStiffSnrm20xn0y,snareDamping,0.0), touchSnrm20xn0y,m20xn0y,massSnrm20xn0y; 139 | ground(0.0),m20x20y; 140 | ground(0.0),m20x40y; 141 | ground(0.0),m40xn40y; 142 | ground(0.0),m40xn20y; 143 | ground(0.0),m40xn0y; 144 | ground(0.0),m40x20y; 145 | ground(0.0),m40x40y; 146 | 147 | link(50.0,0.001,0.0),ldev2,dev2,g; 148 | link(interactionStiffness,interactionDamping,0.0),lll,dev1,drumstick; 149 | 150 | mass(drumstickMass,0.0,0.0),drumstick; 151 | touch(drumstickStiffness,drumstickDamping,0.0),tt,drumstick, mn0xn0y; 152 | 153 | ground(0.0),g; 154 | ground(0.0),snareGround; 155 | port( ),dev1; 156 | port( ),dev2; 157 | 158 | audioout,aL,(mn20xn0y*volume1 + mn0xn0y*0.25*volume2 + snareVolume*mn0xn20y+ snareVolume*mn0x20y+ snareVolume*m20xn0y):highpass(1,2000.0):highpass(1,1000.0)*(2400000.0)*volume*panVar*volAgain; 159 | audioout,aR,(mn20xn0y*volume1 + mn0xn0y*0.25*volume2 + snareVolume*mn0xn20y+ snareVolume*mn0x20y+ snareVolume*m20xn0y):highpass(1,2000.0):highpass(1,1000.0)*(2400000.0)*volume*(1.0-panVar)*volAgain; 160 | link(edgeStiffness,edgeDamping,0.0),l1,mn40xn0y,mn20xn0y; 161 | link(edgeStiffness,edgeDamping,0.0),l2,mn20xn20y,mn20xn0y; 162 | link(edgeStiffness,edgeDamping,0.0),l3,mn20xn20y,mn0xn20y; 163 | link(edgeStiffness,edgeDamping,0.0),l4,mn20xn0y,mn20x20y; 164 | link(membraneStiffness,membraneDamping,0.0),l5,mn20xn0y,mn0xn0y; 165 | link(edgeStiffness,edgeDamping,0.0),l6,mn20x20y,mn0x20y; 166 | link(edgeStiffness,edgeDamping,0.0),l7,mn0xn40y,mn0xn20y; 167 | link(membraneStiffness,membraneDamping,0.0),l8,mn0xn20y,mn0xn0y; 168 | link(edgeStiffness,edgeDamping,0.0),l9,mn0xn20y,m20xn20y; 169 | link(membraneStiffness,membraneDamping,0.0),l10,mn0xn0y,mn0x20y; 170 | link(membraneStiffness,membraneDamping,0.0),l11,mn0xn0y,m20xn0y; 171 | link(edgeStiffness,edgeDamping,0.0),l12,mn0x20y,mn0x40y; 172 | link(edgeStiffness,edgeDamping,0.0),l13,mn0x20y,m20x20y; 173 | link(edgeStiffness,edgeDamping,0.0),l14,m20xn20y,m20xn0y; 174 | link(edgeStiffness,edgeDamping,0.0),l15,m20xn0y,m20x20y; 175 | link(edgeStiffness,edgeDamping,0.0),l16,m20xn0y,m40xn0y; 176 | 177 | 178 | 179 | 180 | 181 | -------------------------------------------------------------------------------- /haptic_drum_simulation.mdl: -------------------------------------------------------------------------------- 1 | # MDL file for Synth-A-Modeler 2 | # 3 | # (c) Edgar Berdahl, 2012 4 | # Audio Communication Group 5 | # Technical University of Berlin 6 | # 7 | # ------------------------------------------------------------------- 8 | # 9 | # The above copyright notice including the copyright holders and this 10 | # permission notice shall be included in all copies, substantial 11 | # portions, or derivatives of the Software and Software portions. 12 | # 13 | # The end-user documentation included with the redistribution, if any, 14 | # must include the following acknowledgment: "This software was 15 | # developed at least in part using Synth-A-Modeler, which is a modular 16 | # and open-source environment for designing physical models (see 17 | # https://github.com/eberdahl/SaM)", in the same place and form as other 18 | # third-party acknowledgments. In addition, this acknowledgment must 19 | # appear in the software itself in the same form and location as other 20 | # such third-party acknowledgments. 21 | # 22 | # Alternatively, if software is generated using Synth-A-Modeler, then 23 | # the end-user documentation included with the generated software, if 24 | # any, must include the following statement: "This software was generated 25 | # using Synth-A-Modeler, which is a modular and open-source environment 26 | # for designing physical models (see https://github.com/eberdahl/SaM)", 27 | # in the same place and form as other third-party acknowledgments. In 28 | # addition, this acknowledgment must appear prominently in any software 29 | # generated by Synth-A-Modeler in the same form and location as other 30 | # such third-party acknowledgments, and in such a manner that users 31 | # will be aware that the software was generated by Synth-A-Modeler. 32 | # 33 | # This program is free software: you can redistribute it and/or modify 34 | # it under the terms of the GNU General Public License version 3 as 35 | # published by the Free Software Foundation except subject to the additional 36 | # attribution requirements described beneath the copyright notice above. 37 | # 38 | # This program is distributed in the hope that it will be useful, 39 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 40 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 41 | # GNU General Public License for more details. 42 | # 43 | # You should have received a copy of the modified GNU General Public 44 | # License along with this program. 45 | 46 | 47 | 48 | faustcode:volAgain=hslider("Ze Volume",-22.0,-40.0,40.0,1.0) : db2linear : onePoleBLT(2.0); // LP filter with cutoff frequency at 2Hz helps eliminate zipper noise 49 | faustcode:massScaler=hslider("Scale the masses",0.6,0.25,8.0,0.01); 50 | 51 | 52 | faustcode:pulseMultiplier=hslider("Pulse strength", 4.0, 0.0, 5.0, 0.01); 53 | faustcode:pulseLength=hslider("Pulse length [sec]", 0.006, 0.001, 0.1, 0.001); 54 | 55 | faustcode:stiffness=hslider("Link stiffness [N/m]", 0.0, 0.0, 250.0, 0.1); 56 | faustcode:damping=hslider("Link damping [N/(m/s)]", 0.0, 0.0, 0.5, 0.01); 57 | 58 | 59 | pulseTouch(stiffness,damping,0.0,pulseMultiplier,pulseLength*2.0,pulseLength),l1pos,dev1,thegrnd; 60 | ground(0.0),thegrnd; 61 | 62 | 63 | 64 | # Example of how to make presets 65 | # ------------------------------ 66 | # The following is based on Kjetil S. Matheussen's approach to implementing presents as 67 | # found on the Faust mailing list and in the documentation on rdtable (including in music.lib). 68 | # The definitions of presetInitIndex and mytake have been moved into physicalmodeling.lib. 69 | # 70 | # You need to have the following definitions per numerical entry (nentry) box that you want to have 71 | # for your model. In this case, there is just one nentry box, and it is named "Preset number." 72 | faustcode:numOfPresets = 24; 73 | faustcode:presetNum = int(nentry("Preset number",10,0,23,1)); 74 | faustcode:setupMyPresets(theParams)=rdtable(numOfPresets, mytake(presetInitIndex,numOfPresets,theParams),presetNum); 75 | 76 | # Of course, when you start developing some presets, you should start with a smaller number such as 2 or 3 instead of 77 | # going whole hog like I did and defining 24 of them :) 78 | faustcode:interactionDamping = setupMyPresets((0.188189,0.188189,0.2,0.243307,0.243307,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.145669,0.2,0.2,0.302362,0.2,0.2,0.2,0.2)); 79 | faustcode:interactionStiffness = setupMyPresets((80.6299,80.6299,80.6299,400,400,80.6299,80.6299,105.197,80.6299,80.6299,80.6299,80.6299,80.6299,80.6299,80.6299,80.6299,80.6299,80.6299,80.6299,80.6299,80.6299,80.6299,80.6299,80.6299)); 80 | faustcode:drumstickDamping = setupMyPresets((0.0590551,0.120472,0.0566929,0,0,0,0,0,0,0.0425197,0.0425197,0.0425197,0.0425197,0,0,0,0,0,0,0,0,0,0,0)); 81 | faustcode:drumstickMass = setupMyPresets((0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001)); 82 | faustcode:drumstickStiffness = setupMyPresets((275.046,275.046,275.046,32.448,32.448,330.322,330.322,330.322,330.322,400,363.15,400,400,127.645,127.645,127.645,160.472,127.645,127.645,400,127.645,127.645,127.645,127.645)); 83 | faustcode:edgeDamping = setupMyPresets((0.0732551,0.0921339,0.010326,0.0158323,0.0158323,0.00324646,0.00245984,0.00245984,0.00245984,0.0001,0.0001,0.00245984,0.00245984,0.001,0.000886614,0.000886614,0.000886614,0.00167323,0.00167323,0.00481969,0.00481969,0.00481969,0.00481969,0.00481969)); 84 | faustcode:edgeStiffness = setupMyPresets((122.018,184.38,184.38,262.333,262.333,122.018,67.4512,44.0654,44.0654,184.38,184.38,184.38,184.38,652.097,652.097,1000,1000,722.254,644.302,722.254,722.254,722.254,722.254,722.254)); 85 | faustcode:massMembrane = massScaler*setupMyPresets((0.00609624,0.00609624,0.00609624,0.00299398,0.00217611,0.0006,0.00031,0.00016288,0.00016288,0.000182383,0.000119469,0.000182383,0.000119469,0.0001,0.0001,0.0001,5e-05,5e-05,5e-05,7.5e-05,5e-05,5e-05,5e-05,5e-05)); 86 | faustcode:membraneDamping = setupMyPresets((0.075615,0.0968535,0.0142591,0.00403307,0.00403307,0.0111126,0.00324646,0.00245984,0.00324646,0.0001,0.0001,0.00324646,0.00324646,0.001,0.00167323,0.00167323,0.00167323,0.00324646,0.00324646,0.00324646,0.00639291,0.00639291,0.00639291,0.00639291)); 87 | faustcode:membraneStiffness = setupMyPresets((80.1575,267.244,267.244,160.994,160.994,823.593,823.593,387.057,823.593,165.906,165.906,165.906,165.906,675.483,1000,1000,1000,867.48,867.48,867.48,867.48,867.48,867.48,867.48)); 88 | faustcode:panVar = setupMyPresets((1,0,1,0.149606,0.653543,1,0.740157,0.307087,0,0,0.874016,0,0.874016,1,0.755906,0.535433,0,0,0.259843,0.724409,1,1,0.322835,0)); 89 | faustcode:randomTweak = setupMyPresets((0.283465,0.283465,0.283465,0.141732,0.346457,0.700787,0.732283,0.795276,0.732283,0,0,0,0,0.322835,0.322835,0.220472,0.149606,0.511811,0.511811,0.511811,0.511811,0.511811,0.511811,0.511811)); 90 | faustcode:snareDamping = setupMyPresets((0.0695984,0.0695984,0.0695984,0.0463685,0.0619591,0.0635181,0.0494866,0.0494866,0.0494866,0.0243858,0.00801575,0.0672598,0.0953228,0.0494866,0.0494866,0.0494866,0.0929843,0.0728724,0.0728724,0.0728724,0.0728724,0.0728724,0.0728724,0.0728724)); 91 | faustcode:touchStiffSnrm20xn0y = setupMyPresets((5629.88,5629.88,5629.88,1944.84,1944.84,7933.03,7933.03,7933.03,7933.03,1944.84,1944.84,1944.84,1944.84,7933.03,7933.03,7933.03,15149.6,3326.73,3326.73,3326.73,3326.73,3326.73,3326.73,3326.73)); 92 | faustcode:touchStiffSnrmn0x20y = setupMyPresets((6704.69,6704.69,6704.69,4862.17,4862.17,4862.17,4862.17,4862.17,4862.17,1330.67,1330.67,1330.67,1330.67,4862.17,4862.17,4862.17,14535.4,4862.17,4862.17,4862.17,4862.17,4862.17,4862.17,4862.17)); 93 | faustcode:touchStiffSnrmn0xn20y = setupMyPresets((5476.34,5476.34,5476.34,3787.36,3787.36,6704.69,6704.69,6704.69,6704.69,2866.1,2866.1,2866.1,2866.1,6704.69,6704.69,6704.69,18066.9,3940.91,3940.91,3940.91,3940.91,3940.91,3940.91,3940.91)); 94 | faustcode:snareVolume = setupMyPresets((0,0,0.708661,0.669291,0.629921,0.15748,0.15748,0.15748,0.15748,0,0,0.866142,0.866142,0.15748,0.15748,0.275591,0.275591,1.33858,0.433071,0.354331,0.0787402,0.0787402,0.0787402,0.0787402)); 95 | faustcode:volume1 = setupMyPresets((3,3,3,1.27559,1.27559,0.669213,0.125906,0.0786614,0.125906,0,0.0708661,0,0,0.125906,0.125906,0.125906,1.54323,0.141732,0,0.645591,0.125906,0.125906,0.125906,0.125906)); 96 | faustcode:volume2 = setupMyPresets((0,0,0,1.41732,1.41732,2.00787,2.00787,1.53543,2.00787,0.874016,1.32283,0,1.32283,2.00787,2.00787,2.00787,0.330709,1.25197,2.00787,1.06299,2.00787,2.00787,2.00787,2.00787)); 97 | faustcode:volume = setupMyPresets((3,2.17323,3,3,3,0.267638,0.267638,0.267638,0.267638,0.267638,0.149528,0.267638,0.149528,1,1,1,0.574724,0.480236,0.810945,0.314882,0.810945,0.810945,0.810945,0.810945)); 98 | faustcode:gravParam = setupMyPresets((300,300,300,255.661,222.047,255.661,255.661,255.661,255.661,0.5,0.6,0.15,0.23,255.661,255.661,255.661,300,300,300,300,300,300,300,300)); 99 | faustcode:massSnrm20xn0yMass = massScaler*setupMyPresets((0.000382119,0.000382119,0.000382119,0.000178055,0.000178055,0.000169552,0.000169552,0.000169552,0.000169552,0.000378993,0.000378993,7.26469e-05,7.26469e-05,0.000169552,0.000169552,0.000169552,0.000169552,0.000169552,0.000169552,0.000169552,0.000169552,0.000169552,0.000169552,0.000169552)); 100 | faustcode:massSnrmn0x20yMass = massScaler*setupMyPresets((0.000325852,0.000325852,0.000325852,9.45288e-05,9.45288e-05,4.76391e-05,4.76391e-05,4.76391e-05,4.76391e-05,0.000275836,0.0003196,1.95052e-05,5.7017e-05,0.000119537,4.76391e-05,4.76391e-05,4.76391e-05,8.51509e-05,6.3269e-05,4.76391e-05,4.76391e-05,4.76391e-05,4.76391e-05,4.76391e-05)); 101 | faustcode:massSnrmn0xn20yMass = massScaler*setupMyPresets((0.000357111,0.000357111,0.000357111,0.000307096,0.000307096,9.14028e-05,9.14028e-05,9.14028e-05,9.14028e-05,0.000347734,0.00035086,0.000110159,0.000110159,0.000219568,9.14028e-05,9.14028e-05,9.14028e-05,9.14028e-05,9.14028e-05,9.14028e-05,9.14028e-05,9.14028e-05,9.14028e-05,9.14028e-05)); 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | ground(0.0),mn40xn40y; 117 | ground(0.0),mn40xn20y; 118 | ground(0.0),mn40xn0y; 119 | ground(0.0),mn40x20y; 120 | ground(0.0),mn40x40y; 121 | ground(0.0),mn20xn40y; 122 | ground(0.0),mn20xn20y; 123 | #mass(massMembrane*(1.0 + randomTweak*(0.836068))),mn20xn0y; 124 | mass(0.01,0.0,0.0),mn20xn0y; 125 | ground(0.0),mn20x20y; 126 | ground(0.0),mn20x40y; 127 | ground(0.0),mn0xn40y; 128 | mass(massMembrane*(1.0 + randomTweak*(-0.799939)),0.0,0.0),mn0xn20y; 129 | mass(massSnrmn0xn20yMass*(1.0 + randomTweak*(0.574577)),0.0,0.0),massSnrmn0xn20y; 130 | link(gravParam,0.00,0.0), linkSnrmn0xn20y,snareGround,massSnrmn0xn20y; 131 | touch(touchStiffSnrmn0xn20y,snareDamping,0.0), touchSnrmn0xn20y,mn0xn20y,massSnrmn0xn20y; 132 | mass(massMembrane*(1.0 + randomTweak*(-0.542241)),0.0,0.0),mn0xn0y; 133 | mass(massMembrane*(1.0 + randomTweak*(0.567359)),0.0,0.0),mn0x20y; 134 | mass(massSnrmn0x20yMass*(1.0 + randomTweak*(-0.119600)),0.0,0.0),massSnrmn0x20y; 135 | link(gravParam,0.00,0.0), linkSnrmn0x20y,snareGround,massSnrmn0x20y; 136 | touch(touchStiffSnrmn0x20y,snareDamping,0.0), touchSnrmn0x20y,mn0x20y,massSnrmn0x20y; 137 | ground(0.0),mn0x40y; 138 | ground(0.0),m20xn40y; 139 | ground(0.0),m20xn20y; 140 | mass(massMembrane*(1.0 + randomTweak*(-0.918061)),0.0,0.0),m20xn0y; 141 | mass(massSnrm20xn0yMass*(1.0 + randomTweak*(-0.061272)),0.0,0.0),massSnrm20xn0y; 142 | link(gravParam,0.00,0.0), linkSnrm20xn0y,snareGround,massSnrm20xn0y; 143 | touch(touchStiffSnrm20xn0y,snareDamping,0.0), touchSnrm20xn0y,m20xn0y,massSnrm20xn0y; 144 | ground(0.0),m20x20y; 145 | ground(0.0),m20x40y; 146 | ground(0.0),m40xn40y; 147 | ground(0.0),m40xn20y; 148 | ground(0.0),m40xn0y; 149 | ground(0.0),m40x20y; 150 | ground(0.0),m40x40y; 151 | 152 | link(50.0,0.001,0.0),ldev2,dev2,g; 153 | link(interactionStiffness,interactionDamping,0.0),lll,dev1,drumstick; 154 | 155 | mass(drumstickMass,0.0,0.0),drumstick; 156 | touch(drumstickStiffness,drumstickDamping,0.0),tt,drumstick, mn0xn0y; 157 | 158 | ground(0.0),g; 159 | ground(0.0),snareGround; 160 | port( ),dev1; 161 | port( ),dev2; 162 | 163 | audioout,aL,(mn20xn0y*volume1 + mn0xn0y*0.25*volume2 + snareVolume*mn0xn20y+ snareVolume*mn0x20y+ snareVolume*m20xn0y):highpass(1,2000.0):highpass(1,1000.0)*(2400000.0)*volume*panVar*volAgain; 164 | audioout,aR,(mn20xn0y*volume1 + mn0xn0y*0.25*volume2 + snareVolume*mn0xn20y+ snareVolume*mn0x20y+ snareVolume*m20xn0y):highpass(1,2000.0):highpass(1,1000.0)*(2400000.0)*volume*(1.0-panVar)*volAgain; 165 | link(edgeStiffness,edgeDamping,0.0),l1,mn40xn0y,mn20xn0y; 166 | link(edgeStiffness,edgeDamping,0.0),l2,mn20xn20y,mn20xn0y; 167 | link(edgeStiffness,edgeDamping,0.0),l3,mn20xn20y,mn0xn20y; 168 | link(edgeStiffness,edgeDamping,0.0),l4,mn20xn0y,mn20x20y; 169 | link(membraneStiffness,membraneDamping,0.0),l5,mn20xn0y,mn0xn0y; 170 | link(edgeStiffness,edgeDamping,0.0),l6,mn20x20y,mn0x20y; 171 | link(edgeStiffness,edgeDamping,0.0),l7,mn0xn40y,mn0xn20y; 172 | link(membraneStiffness,membraneDamping,0.0),l8,mn0xn20y,mn0xn0y; 173 | link(edgeStiffness,edgeDamping,0.0),l9,mn0xn20y,m20xn20y; 174 | link(membraneStiffness,membraneDamping,0.0),l10,mn0xn0y,mn0x20y; 175 | link(membraneStiffness,membraneDamping,0.0),l11,mn0xn0y,m20xn0y; 176 | link(edgeStiffness,edgeDamping,0.0),l12,mn0x20y,mn0x40y; 177 | link(edgeStiffness,edgeDamping,0.0),l13,mn0x20y,m20x20y; 178 | link(edgeStiffness,edgeDamping,0.0),l14,m20xn20y,m20xn0y; 179 | link(edgeStiffness,edgeDamping,0.0),l15,m20xn0y,m20x20y; 180 | link(edgeStiffness,edgeDamping,0.0),l16,m20xn0y,m40xn0y; 181 | 182 | 183 | 184 | 185 | 186 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Directory containing Faust .lib and .cpp architecture files: 2 | ck1 := /opt/local/lib/faust/music.lib 3 | ck2 := /usr/local/lib/faust/music.lib 4 | ck3 := $(FAUST_LIB_PATH)/faust/music.lib 5 | LIB := $(if $(wildcard $(ck1)),/opt/local/lib,"") 6 | LIB := $(if $(wildcard $(ck2)),/usr/local/lib,$(LIB)) 7 | LIB := $(if $(wildcard $(ck3)),$(FAUST_LIB_PATH),$(LIB)) 8 | 9 | ifeq ($(OSC),1) 10 | OSCCTRL := -DOSCCTRL -I$(LIB)/faust/osclib 11 | QTDEFS := "DEFINES += OSCCTRL" 12 | OSCLIB := -L$(LIB)/faust/osclib -lOSCFaust -loscpack 13 | endif 14 | 15 | MYICCFLAGS := '-O3 -xHost -ftz -fno-alias -fp-model fast=2 $(OSCCTRL)' 16 | 17 | ifeq ($(system), Darwin) 18 | #MYGCCFLAGS := '-O3 -m32 -march=native -msse -msse2 -msse3 -ffast-math -Wno-extra-tokens -Wno-return-type -Wno-unused-variable $(OSCCTRL)' 19 | MYGCCFLAGS := '-O3 -m32 -march=native -msse -msse2 -msse3 -ffast-math $(OSCCTRL)' 20 | else 21 | #MYGCCFLAGS := '-O3 -msse -msse2 -msse3 -ffast-math -Wno-extra-tokens -Wno-return-type -Wno-unused-variable $(OSCCTRL)' 22 | MYGCCFLAGS := '-O3 -fpermissive -msse -msse2 -msse3 -ffast-math $(OSCCTRL)' 23 | endif 24 | 25 | VSIZE := 256 26 | 27 | SC_SOURCE_DIR = ../../supercollider 28 | 29 | all : jackgtk 30 | 31 | test: ijackgtk ijackvec ijackomp gjackgtk gjackvec gjackomp 32 | 33 | ijackgtk : 34 | install -d ijackgtkdir 35 | $(MAKE) DEST='ijackgtkdir/' ARCH='jack-gtk.cpp' LIB='-I$(LIB)/faust/ `pkg-config --cflags --libs jack gtk+-2.0` -I/usr/local/include' CXX='icc' CXXFLAGS=$(MYICCFLAGS) -f Makefile.compile 36 | 37 | ijackvec : 38 | install -d ijackvecdir 39 | $(MAKE) DEST='ijackvecdir/' ARCH='jack-gtk.cpp' VEC='-vec -lv 1 -vs $(VSIZE)' LIB='-I$(LIB)/faust/ `pkg-config --cflags --libs jack gtk+-2.0` -I/usr/local/include' CXX='icc' CXXFLAGS=$(MYICCFLAGS) -f Makefile.compile 40 | 41 | ijackomp : 42 | install -d ijackompdir 43 | $(MAKE) DEST='ijackompdir/' ARCH='jack-gtk.cpp' VEC='-vs $(VSIZE) -omp' LIB='-I$(LIB)/faust/ `pkg-config --cflags --libs jack gtk+-2.0` -I/usr/local/include' CXX='icc' CXXFLAGS='-openmp '$(MYICCFLAGS) -f Makefile.compile 44 | 45 | ijacksch : 46 | install -d ijackschdir 47 | $(MAKE) DEST='ijackschdir/' ARCH='jack-gtk.cpp' VEC='-sch -vs $(VSIZE)' LIB='-I$(LIB)/faust/ `pkg-config --cflags --libs jack gtk+-2.0` -I/usr/local/include' CXX='icc' CXXFLAGS=$(MYICCFLAGS) -f Makefile.compile 48 | 49 | gjackgtk : 50 | install -d gjackgtkdir 51 | $(MAKE) DEST='gjackgtkdir/' ARCH='jack-gtk.cpp' LIB='-I$(LIB)/faust/ `pkg-config --cflags --libs jack gtk+-2.0` -I/usr/local/include' CXX='g++' CXXFLAGS=$(MYGCCFLAGS) -f Makefile.compile 52 | 53 | gjackvec : 54 | install -d gjackvecdir 55 | $(MAKE) DEST='gjackvecdir/' ARCH='jack-gtk.cpp' VEC='-vec -lv 1 -vs $(VSIZE)' LIB='-I$(LIB)/faust/ `pkg-config --cflags --libs jack gtk+-2.0` -I/usr/local/include' CXX='g++' CXXFLAGS=$(MYGCCFLAGS) -f Makefile.compile 56 | 57 | gjackomp : 58 | install -d gjackompdir 59 | $(MAKE) DEST='gjackompdir/' ARCH='jack-gtk.cpp' VEC='-vec -vs $(VSIZE) -omp' LIB='-I$(LIB)/faust/ `pkg-config --cflags --libs jack gtk+-2.0` -I/usr/local/include' CXX='g++' CXXFLAGS='-fopenmp '$(MYGCCFLAGS) -f Makefile.compile 60 | 61 | svg: 62 | $(MAKE) -f Makefile.svgcompile 63 | 64 | puredata : 65 | install -d puredatadir 66 | $(MAKE) DEST='puredatadir/' ARCH='puredata.cpp' LIB='-I$(LIB)/faust/' CXXFLAGS=$(MYGCCFLAGS) -f Makefile.pdcompile 67 | 68 | alsagtk : 69 | install -d alsagtkdir 70 | $(MAKE) DEST='alsagtkdir/' ARCH='alsa-gtk.cpp' LIB='-I$(LIB)/faust/ -lpthread -lasound `pkg-config --cflags --libs gtk+-2.0` $(OSCLIB)' CXXFLAGS=$(OSCCTRL) -f Makefile.compile 71 | 72 | ialsagtk : 73 | install -d ialsagtkdir 74 | $(MAKE) DEST='ialsagtkdir/' ARCH='alsa-gtk.cpp' LIB='-I$(LIB)/faust/ -lpthread -lasound `pkg-config --cflags --libs gtk+-2.0`' CXX='icc' CXXFLAGS=$(MYICCFLAGS) -f Makefile.compile 75 | 76 | ialsavec : 77 | install -d ialsavecdir 78 | $(MAKE) DEST='ialsavecdir/' ARCH='alsa-gtk.cpp' VEC='-vec -vs $(VSIZE)' LIB='-I$(LIB)/faust/ -lpthread -lasound `pkg-config --cflags --libs gtk+-2.0`' CXX='icc' CXXFLAGS=$(MYICCFLAGS) -f Makefile.compile 79 | 80 | ialsaomp : 81 | install -d ialsaompdir 82 | $(MAKE) DEST='ialsaompdir/' ARCH='alsa-gtk.cpp' VEC='-omp -vs $(VSIZE)' LIB='-I$(LIB)/faust/ -lpthread -lasound `pkg-config --cflags --libs gtk+-2.0`' CXX='icc' CXXFLAGS='-openmp '$(MYICCFLAGS) -f Makefile.compile 83 | 84 | ialsasch : 85 | install -d ialsaschdir 86 | $(MAKE) DEST='ialsaschdir/' ARCH='alsa-gtk.cpp' VEC='-sch -vs $(VSIZE)' LIB='-I$(LIB)/faust/ -lpthread -lasound `pkg-config --cflags --libs gtk+-2.0`' CXX='icc' CXXFLAGS=$(MYICCFLAGS) -f Makefile.compile 87 | 88 | jackgtk : 89 | install -d jackgtkdir 90 | $(MAKE) DEST='jackgtkdir/' ARCH='jack-gtk.cpp' LIB='-I$(LIB)/faust/ `pkg-config --cflags --libs jack gtk+-2.0` $(OSCLIB)' CXXFLAGS=$(MYGCCFLAGS) -f Makefile.compile 91 | 92 | msjackgtk : 93 | install -d msjackgtkdir 94 | $(MAKE) DEST='msjackgtkdir/' ARCH='ms-jack-gtk.cpp' LIB='-I$(LIB)/faust/ -lMidiShare `pkg-config --cflags --libs jack gtk+-2.0`' -f Makefile.compile 95 | 96 | jackqt : 97 | install -d jackqtdir 98 | $(MAKE) DEST='jackqtdir/' ARCH='jack-qt.cpp' LIB='-ljack $(OSCLIB)' DEFS=$(QTDEFS) CXXFLAGS=$(MYGCCFLAGS) -f Makefile.qtcompile 99 | 100 | jackqtsch : 101 | install -d jackqtschdir 102 | $(MAKE) DEST='jackqtschdir/' ARCH='jack-qt.cpp' VEC='-sch -vs $(VSIZE)' LIB='-ljack' CXXFLAGS=$(MYGCCFLAGS) -f Makefile.qtcompile 103 | 104 | netjackqt : 105 | install -d netjackqtdir 106 | $(MAKE) DEST='netjackqtdir/' ARCH='netjack-qt.cpp' LIB='-ljacknet $(OSCLIB)' DEFS=$(QTDEFS) CXXFLAGS=$(MYGCCFLAGS) -f Makefile.qtcompile 107 | 108 | jackwt : 109 | install -d jackwtdir 110 | $(MAKE) DEST='jackwtdir/' ARCH='jack-wt.cpp' LIB='-I$(LIB)/faust/ -ljack -lwt -lwthttp -lboost_signals-mt $(OSCLIB)' DEFS=$(QTDEFS) -f Makefile.compile 111 | 112 | paqt : 113 | install -d paqtdir 114 | $(MAKE) DEST='paqtdir/' ARCH='pa-qt.cpp' LIB='-lportaudio $(OSCLIB)' DEFS=$(QTDEFS) -f Makefile.qtcompile 115 | 116 | caqt : 117 | install -d caqtdir 118 | $(MAKE) DEST='caqtdir/' ARCH='ca-qt.cpp' LIB='-framework CoreAudio -framework AudioUnit -framework CoreServices $(OSCLIB)' CXXFLAGS=$(MYGCCFLAGS) DEFS=$(QTDEFS) -f Makefile.qtcompile 119 | 120 | oscioqt : OSCLIB = -L$(LIB)/faust/osclib -lOSCFaust -loscpack 121 | oscioqt : 122 | install -d oscioqtdir 123 | $(MAKE) DEST='oscioqtdir/' ARCH='oscio-qt.cpp' LIB='-ljack $(OSCLIB)' DEFS=$(QTDEFS) -f Makefile.qtcompile 124 | 125 | osciogtk : OSCLIB = -L$(LIB)/faust/osclib -lOSCFaust -loscpack 126 | osciogtk : 127 | install -d osciogtkdir 128 | $(MAKE) DEST='osciogtkdir/' ARCH='oscio-gtk.cpp' LIB='-I$(LIB)/faust/ `pkg-config --cflags --libs jack gtk+-2.0` $(OSCLIB)' CXXFLAGS=-I$(LIB)/faust/osclib -f Makefile.compile 129 | 130 | alsaqt : 131 | install -d alsaqtdir 132 | $(MAKE) DEST='alsaqtdir/' ARCH='alsa-qt.cpp' LIB='-lpthread -lasound $(OSCLIB)' DEFS=$(QTDEFS) -f Makefile.qtcompile 133 | 134 | ladspa : 135 | install -d ladspadir 136 | $(MAKE) DEST='ladspadir/' ARCH='ladspa.cpp' LIB='-I$(LIB)/faust/' EXT='.so' CXXFLAGS=$(MYGCCFLAGS) -f Makefile.ladspacompile 137 | 138 | ladspasch : 139 | install -d ladspaschdir 140 | $(MAKE) DEST='ladspaschdir/' ARCH='ladspa.cpp' VEC='-sch -vs $(VSIZE)' LIB='-I$(LIB)/faust/' EXT='.so' CXXFLAGS=$(MYGCCFLAGS) -f Makefile.ladspacompile 141 | 142 | dssi : 143 | install -d dssidir 144 | $(MAKE) DEST='dssidir/' ARCH='dssi.cpp' LIB='-I$(LIB)/faust/' EXT='.so' CXXFLAGS=$(MYGCCFLAGS) -f Makefile.dssicompile 145 | 146 | csound : 147 | install -d csounddir 148 | $(MAKE) DEST='csounddir/' -f Makefile.csound 149 | 150 | csounddouble : 151 | install -d csounddoubledir 152 | $(MAKE) DEST='csounddoubledir/' VEC='-double' -f Makefile.csound 153 | 154 | jackwx : 155 | install -d jackwxdir 156 | $(MAKE) DEST='jackwxdir/' ARCH='jack-wx.cpp' LIB='`pkg-config jack --cflags --libs` `wx-config --cflags --libs`' -f Makefile.compile 157 | 158 | ossgtk : 159 | install -d ossgtkdir 160 | $(MAKE) DEST='ossgtkdir/' ARCH='oss-gtk.cpp' LIB='-lpthread `pkg-config gtk+-2.0 --cflags --libs`' -f Makefile.compile 161 | 162 | osswx : 163 | install -d osswxdir 164 | $(MAKE) DEST='osswxdir/' ARCH='oss-wx.cpp' LIB='-lpthread `wx-config --cflags --libs`' -f Makefile.compile 165 | 166 | pagtk : 167 | install -d pagtkdir 168 | $(MAKE) DEST='pagtkdir/' ARCH='pa-gtk.cpp' LIB='-I$(LIB)/faust/ -lpthread -lportaudio `pkg-config gtk+-2.0 --cflags --libs` $(OSCLIB)' CXXFLAGS=$(OSCCTRL) -f Makefile.compile 169 | 170 | pawx : 171 | install -d pawxdir 172 | $(MAKE) DEST='pawxdir/' ARCH='pa-wx.cpp' LIB='-lpthread -lportaudio `wx-config --cflags --libs`' -f Makefile.compile 173 | 174 | module : 175 | install -d moduledir 176 | $(MAKE) DEST='moduledir/' ARCH='module.cpp' LIB='-I$(LIB)/faust/ -fPIC -shared' EXT='.so' -f Makefile.compile 177 | 178 | bundle : 179 | install -d bundledir 180 | $(MAKE) DEST='bundledir/' ARCH='module.cpp' LIB='-I$(LIB)/faust/ -fPIC -bundle' EXT='.so' -f Makefile.compile 181 | 182 | maxmsp msp : 183 | install -d mspdir 184 | $(MAKE) DEST='mspdir/' ARCH='max-msp.cpp' LIB='' -f Makefile.mspcompile 185 | 186 | w32vstdir : 187 | mkdir w32vstdir 188 | 189 | w32vst : w32vstdir 190 | $(MAKE) DEST='w32vstdir/' ARCH='vst2p4.cpp' LIB='' -f Makefile.w32vstcompile 191 | 192 | vst : 193 | install -d vstdir 194 | $(MAKE) DEST='vstdir/' ARCH='vst.cpp' LIB='' -f Makefile.vstcompile 195 | 196 | iphone : 197 | install -d iphonedir 198 | $(MAKE) DEST='iphonedir/' ARCH='iphone-cocoa.cpp' LIB='' -f Makefile.iphonecompile 199 | 200 | iphonenet : 201 | install -d iphonenetdir 202 | $(MAKE) DEST='iphonenetdir/' ARCH='iphone-cocoa-net.cpp' LIB='' -f Makefile.iphonenetcompile 203 | 204 | bench : 205 | install -d benchdir 206 | $(MAKE) DEST='benchdir/' ARCH='bench.cpp' LIB='-I$(LIB)/faust/' -f Makefile.compile 207 | 208 | ibench : 209 | install -d ibenchdir 210 | $(MAKE) DEST='ibenchdir/' ARCH='bench.cpp' LIB='-I$(LIB)/faust/' CXX='icc' CXXFLAGS='-O3 -xHost -ftz -fno-alias -fp-model fast=2' -f Makefile.compile 211 | 212 | ivecbench : 213 | install -d ivecbenchdir 214 | $(MAKE) DEST='ivecbenchdir/' ARCH='bench.cpp' VEC='-vec -vs $(VSIZE)' LIB='-I$(LIB)/faust/' CXX='icc' CXXFLAGS='-O3 -xHost -ftz -fno-alias -fp-model fast=2' -f Makefile.compile 215 | 216 | ivecjack : 217 | install -d ivecjackdir 218 | $(MAKE) DEST='ivecjackdir/' ARCH='jack-gtk.cpp' VEC='-vec -vs $(VSIZE)' LIB='-I$(LIB)/faust/ `pkg-config --cflags --libs jack gtk+-2.0`' CXX='icc' CXXFLAGS='-O3 -xHost -ftz -fno-alias -fp-model fast=2' -f Makefile.compile 219 | 220 | iparbench : 221 | install -d iparbenchdir 222 | $(MAKE) DEST='iparbenchdir/' ARCH='bench.cpp' VEC='-vec -vs $(VSIZE) -omp' LIB='-I$(LIB)/faust/' CXX='icc' CXXFLAGS='-O3 -openmp -xHost -ftz -fno-alias -fp-model fast=2' -f Makefile.compile 223 | 224 | gparbench : 225 | install -d gparbenchdir 226 | $(MAKE) DEST='gparbenchdir/' ARCH='bench.cpp' VEC='-vec -vs $(VSIZE) -omp' LIB='-I$(LIB)/faust/' CXX='g++' CXXFLAGS='-O3 -march=native -mfpmath=sse -msse -msse2 -msse3 -ffast-math' -f Makefile.compile 227 | 228 | sndfile : 229 | install -d sndfiledir 230 | $(MAKE) DEST='sndfiledir/' ARCH='sndfile.cpp' LIB='-I$(LIB)/faust/ -lsndfile' -f Makefile.compile 231 | CXXFLAGS=$(OSCCTRL) 232 | plot : 233 | install -d plotdir 234 | $(MAKE) DEST='plotdir/' ARCH='plot.cpp' LIB='-I$(LIB)/faust/' -f Makefile.compile 235 | 236 | matlabplot : 237 | install -d matlabplotdir 238 | $(MAKE) DEST='matlabplotdir/' ARCH='matlabplot.cpp' LIB='-I$(LIB)/faust/' -f Makefile.compile 239 | 240 | q : 241 | install -d qdir 242 | $(MAKE) DEST='qdir/' ARCH='q.cpp' LIB='-I$(LIB)/faust/' -f Makefile.qcompile 243 | 244 | # SCCFLAGS := $(MYGCCFLAGS:'=) `pkg-config --cflags libscsynth`' 245 | # SCCFLAGS := $(MYGCCFLAGS:=) `pkg-config --cflags libscsynth` 246 | # SCCFLAGS := $(MYGCCFLAGS:=) -lscsynth 247 | 248 | supercollider sc: 249 | install -d supercolliderdir 250 | $(MAKE) DEST='supercolliderdir/' -f Makefile.sccompile 251 | 252 | # supercollider : 253 | # ls *.dsp | ../tools/scbuilder/scbuilder \ 254 | # FAUST2SC=../tools/faust2sc-1.0.0/faust2sc \ 255 | # FAUST2SC_PREFIX="Faust_" \ 256 | # SC_SOURCE_DIR=$(SC_SOURCE_DIR) \ 257 | # BUILD_DIR=supercolliderdir \ 258 | # $(SCONS_OPTIONS) 259 | 260 | jackconsole : 261 | install -d jackconsoledir 262 | $(MAKE) DEST='jackconsoledir/' ARCH='jack-console.cpp' VEC='-vec -vs $(VSIZE)' LIB='-I$(LIB)/faust/ `pkg-config --cflags --libs jack ` $(OSCLIB)' CXXFLAGS=$(OSCCTRL) -f Makefile.compile 263 | 264 | mathdoc : 265 | $(MAKE) -f Makefile.mathdoc 266 | 267 | help: 268 | @echo "make alsagtk [OSC=1] : compile examples as ALSA applications with a GTK Graphical User Interface" 269 | @echo "make alsaqt [OSC=1] : compile examples as ALSA applications with a QT4 Graphical User Interface" 270 | @echo "make sndfile : compile examples as sound file processors with a Command line User Interface" 271 | @echo "make jackconsole [OSC=1] : compile examples as JACK applications with a Command line User Interface" 272 | @echo "make jackgtk [OSC=1] : compile examples as JACK applications with a GTK Graphical User Interface" 273 | @echo "make jackqt [OSC=1] : compile examples as JACK applications with a QT4 Graphical User Interface" 274 | @echo "make jackwx : compile examples as JACK applications with a wxWindows Graphical User Interface" 275 | @echo "make ossgtk : compile examples as OSS applications with a GTK Graphical User Interface" 276 | @echo "make osswx : compile examples as OSS applications with a wxWindows Graphical User Interface" 277 | @echo "make pagtk [OSC=1] : compile examples as PortAudio applications with a GTK Graphical User Interface" 278 | @echo "make paqt [OSC=1] : compile examples as PortAudio applications with a QT4 Graphical User Interface" 279 | @echo "make pawx : compile examples as PortAudio applications with a wxWindows Graphical User Interface" 280 | @echo "make caqt [OSC=1] : compile examples as CoreAudio applications with a QT4 Graphical User Interface" 281 | @echo "make oscioqt : compile examples as OSC driven applications with a QT4 Graphical User Interface" 282 | @echo "--------------------------------------------" 283 | @echo "make ladspa : compile examples as LADSPA plugins" 284 | @echo "make dssi : compile examples as DSSI plugins" 285 | @echo "make csound : compile examples as CSOUND opcodes" 286 | @echo "make csounddouble : compile examples as double precision CSOUND opcodes" 287 | @echo "make maxmsp : compile examples as Max/MSP externals" 288 | @echo "make vst : compile examples as native VST plugins" 289 | @echo "make w32vst : crosscompile examples as windows VST plugins" 290 | @echo "make iphone : compile examples for Apple iPhone/iPod" 291 | @echo "make supercollider : compile examples as Supercollider plugins" 292 | @echo "make puredata : compile examples as Puredata externals" 293 | @echo "make q : compile examples as Q plugins" 294 | @echo "--------------------------------------------" 295 | @echo "make svg : generate the examples block-diagrams in SVG format " 296 | @echo "make mathdoc : generate the examples math documentation in TEX and PDF formats " 297 | @echo "make bench : compile examples as command line benchmarks " 298 | @echo "make plot : compile examples as command line programs that print samples for plotting with, e.g., gnuplot" 299 | @echo "make matlabplot : compile examples as command line programs that print samples in matlab input format" 300 | @echo "--------------------------------------------" 301 | @echo "make clean : remove all object files" 302 | 303 | clean : 304 | rm -rf *dir 305 | rm -rf *-svg 306 | rm *.dsp & 307 | rm *.mdx & 308 | # EJB commented this out: $(MAKE) -f Makefile.mathdoc clean 309 | -------------------------------------------------------------------------------- /jack-qt.old.FAUST0.9.46andFAUST0.9.58.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | 3 | IMPORTANT NOTE : this file contains two clearly delimited sections : 4 | the ARCHITECTURE section (in two parts) and the USER section. Each section 5 | is governed by its own copyright and license. Please check individually 6 | each section for license and copyright information. 7 | *************************************************************************/ 8 | 9 | /*******************BEGIN ARCHITECTURE SECTION (part 1/2)****************/ 10 | 11 | /************************************************************************ 12 | FAUST Architecture File 13 | Copyright (C) 2003-2011 GRAME, Centre National de Creation Musicale 14 | --------------------------------------------------------------------- 15 | This Architecture section is free software; you can redistribute it 16 | and/or modify it under the terms of the GNU General Public License 17 | as published by the Free Software Foundation; either version 3 of 18 | the License, or (at your option) any later version. 19 | 20 | This program is distributed in the hope that it will be useful, 21 | but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | GNU General Public License for more details. 24 | 25 | You should have received a copy of the GNU General Public License 26 | along with this program; If not, see . 27 | 28 | EXCEPTION : As a special exception, you may create a larger work 29 | that contains this FAUST architecture section and distribute 30 | that work under terms of your choice, so long as this FAUST 31 | architecture section is not modified. 32 | 33 | 34 | ************************************************************************ 35 | ************************************************************************/ 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | // *********** IMPORTANT USER PARAMETERS FOR THE HAPTIC DEVICE ************ 46 | // 47 | // The following definition is the path to the serial interface. 48 | // 49 | // In Linux, the first FTDI-based Arduino typically shows up as /dev/ttyUSB0 50 | // 51 | // In OS X, each FTDI-based Arduino typically shows up at a different path such as /dev/tty.usbserial-11IP1997, 52 | // so it has to be set manually in each case. 53 | #define PATH_TO_SERIAL "/dev/cu.usbmodem1d11" 54 | //#define PATH_TO_SERIAL "/dev/cu.usbserial-11CP0810" 55 | //#define PATH_TO_SERIAL "/dev/cu.usbmodem1d11" 56 | //#define PATH_TO_SERIAL "/dev/ttyACM0" 57 | //#define PATH_TO_SERIAL "/dev/tty.usbmodem1d11" 58 | //#define PATH_TO_SERIAL "/dev/tty.usbserial-11IP1440" 59 | //#define PATH_TO_SERIAL "/dev/tty.usbserial-11IP1690" 60 | 61 | 62 | 63 | // This is the name of the file that should contain the path to the device. 64 | #define PATH_FOR_DEVICE_FILE "PathToDevice.txt" 65 | char path_for_device_file[256]; 66 | char pathPrefix[128]; 67 | char devicePath[256]; 68 | 69 | 70 | 71 | // Cut-off frequency in Hz of lowpass filter position estimator 72 | //#define CUTOFF_FREQ 100.0 // The response is faster for this one ... 73 | #define CUTOFF_FREQ 30.0 74 | 75 | 76 | 77 | 78 | 79 | #include 80 | #include 81 | #include 82 | 83 | #include "gui/FUI.h" 84 | #include "misc.h" 85 | #include "gui/faustqt.h" 86 | #include "audio/jack-dsp.h" 87 | 88 | #ifdef OSCCTRL 89 | #include "gui/OSCUI.h" 90 | #endif 91 | 92 | /**************************BEGIN USER SECTION **************************/ 93 | #include /* Standard input/output definitions */ 94 | #include /* String function definitions */ 95 | #include /* UNIX standard function definitions */ 96 | #include /* File control definitions */ 97 | #include /* Error number definitions */ 98 | #include /* POSIX terminal control definitions */ 99 | 100 | #define NUMBER_OF_HAPTIC_DOF 2 101 | #define MAX_HAPTIC_VECTOR_LEN 256 // Program will segfault/crash if started via Jack with a vector size longer than this -- although for haptics this vector size should be short like 32 anyway ... 102 | #define MAX_CHANNELS 24 // This is the maximum number of audio channels plus haptic channels that we can have. 103 | 104 | // WARNING: Who knows, someday they could update Jack so that instead of MAX_CHANNELS 105 | // we need to use mydsp::getNumOutputs()+NUMBER_OF_HAPTIC_DOF and 106 | // mydsp::getNumInputs()+NUMBER_OF_HAPTIC_DOF (for instance, if they assume 107 | // a certain interleaved format); however, for the moment it 108 | // seems to be working fine with some extra channels in there. 109 | 110 | #if defined(_WIN32) || defined(_WIN64) 111 | #include "Windows.h" // for Sleep() 112 | #endif 113 | #if defined(TARGET_OS_MAC) || defined(__linux__) 114 | #include // for usleep() 115 | #endif 116 | 117 | /****************************************************************************** 118 | ******************************************************************************* 119 | 120 | VECTOR INTRINSICS 121 | 122 | ******************************************************************************* 123 | *******************************************************************************/ 124 | 125 | <> 126 | 127 | 128 | <> 129 | 130 | /***************************END USER SECTION ***************************/ 131 | 132 | /*******************BEGIN ARCHITECTURE SECTION (part 2/2)***************/ 133 | 134 | 135 | 136 | 137 | 138 | // This lowpass filter has one zero at the Nyquist frequency and one pole at cutoffFreq. 139 | // 140 | // Mathematically, it is described as the bilinear transform of the one-pole 141 | // filter H(s) = aS / (s + aS). 142 | class onePoleLowPass { 143 | double fsGuess; 144 | double cutoffFreq; 145 | double aS; 146 | double b; 147 | double aIntg; 148 | double prevInputSig, prevFilteredOutput; 149 | 150 | public: 151 | // When instantiating this filter, must specify cutoff frequency in Hz of 152 | // position estimator lowpass filter 153 | onePoleLowPass(double cutoffFreq) { 154 | fsGuess = 44100.0; 155 | aS = 2.0*3.14159*cutoffFreq; 156 | b = aS/(2.0*fsGuess+aS); 157 | aIntg = (aS-2.0*fsGuess)/(aS+2.0*fsGuess); 158 | 159 | prevInputSig = 0.0; 160 | prevFilteredOutput = 0.0; 161 | } 162 | 163 | // Receive new input sample, process it, and provide the corresponding new output sample 164 | inline double tick(double inputSig){ 165 | prevFilteredOutput = b*(inputSig + prevInputSig) - aIntg*prevFilteredOutput; 166 | prevInputSig = inputSig; // save prior input 167 | 168 | return (prevFilteredOutput); 169 | } 170 | 171 | inline double getMostRecentOutput(void){ 172 | return (prevFilteredOutput); 173 | } 174 | }; 175 | 176 | 177 | 178 | 179 | 180 | 181 | // This position estimator consists simply of a lowpass filter to help suppress 182 | // noise in the position measurement. 183 | // 184 | // The filter has one zero at the Nyquist frequency and one pole at cutoffFreq. 185 | // 186 | // Mathematically, it is described as the bilinear transform of the one-pole 187 | // filter H(s) = aS / (s + aS). 188 | // was 5 189 | #define FILTERORDER 5 190 | class positionEstimator { 191 | onePoleLowPass *lowPassSection[FILTERORDER]; 192 | 193 | public: 194 | // When instantiating this filter, must specify cutoff frequency in Hz of 195 | // position estimator lowpass filter 196 | positionEstimator(double cutoffFreq) { 197 | for(int i=0; i=0; i--) 212 | inputSig = lowPassSection[i]->tick(inputSig); 213 | 214 | return (inputSig); 215 | } 216 | 217 | inline double getMostRecentOutput(void){ 218 | return lowPassSection[0]->getMostRecentOutput(); 219 | } 220 | }; 221 | 222 | 223 | 224 | 225 | 226 | 227 | class hapticdsp : public mydsp { 228 | private: 229 | FAUSTFLOAT** positionVector; 230 | FAUSTFLOAT** forceVector; 231 | FAUSTFLOAT** netInput; 232 | FAUSTFLOAT** netOutput; 233 | int fd; /* File descriptor for the serial port */ 234 | long iterationNum; 235 | long sentinelNum; 236 | unsigned char buf; 237 | int nChar; 238 | long nReads; 239 | float positionA, positionB; 240 | char capSenseA, capSenseB; 241 | int sentinelCount; 242 | int debug; 243 | positionEstimator *posA; 244 | positionEstimator *posB; 245 | 246 | 247 | public: 248 | 249 | int open_port(void) 250 | { 251 | FILE *path_file_fd; 252 | int cnt=10; 253 | path_for_device_file[0]='\0'; 254 | pathPrefix[0] = '\0'; 255 | while (cnt>0) { 256 | strcpy(path_for_device_file,pathPrefix); 257 | strcat(path_for_device_file,PATH_FOR_DEVICE_FILE); 258 | printf("Looking for %s to indicate path to the device.\n", path_for_device_file); 259 | path_file_fd = fopen(path_for_device_file, "r"); // read only 260 | if (path_file_fd == NULL) { 261 | printf("Couldn't open file %s", path_for_device_file); 262 | } else { 263 | break; 264 | } 265 | path_for_device_file[0]='\0'; 266 | strcat(pathPrefix,"../"); 267 | cnt--; 268 | } 269 | // If it doesn't find the file, then it will wind up segfaulting on the next line 270 | // which is one way to stop the program from running!! 271 | fscanf(path_file_fd, "%s", devicePath); 272 | close(path_file_fd); 273 | 274 | 275 | 276 | 277 | printf("Opening the device %s...\n", devicePath); 278 | fd = open(devicePath, O_RDWR | O_NOCTTY | O_NDELAY); // non-blocking reads 279 | if (fd == -1) 280 | { 281 | /* 282 | * Could not open the port. 283 | */ 284 | perror("open_port: Unable to open serial port - "); 285 | return(1); 286 | } 287 | else { 288 | fcntl(fd, F_SETFL, 0); 289 | printf("Opened serial port successfully!\n"); 290 | return(0); 291 | } 292 | } 293 | 294 | void setBaudRate(int fd){ 295 | struct termios options; 296 | 297 | /* Get the current options for the port... */ 298 | tcgetattr(fd, &options); 299 | 300 | /* Set the baud rates to 57600... */ 301 | /* This seems to be ignored if Arduino does not have FTDI chip. */ 302 | cfsetispeed(&options, B57600); 303 | cfsetospeed(&options, B57600); 304 | 305 | /* Enable the receiver and set local mode... */ 306 | options.c_cflag |= (CLOCAL | CREAD); 307 | 308 | /* Set the new options for the port... */ 309 | if (tcsetattr(fd, TCSANOW, &options) < -1) { 310 | perror("init_serialport: Couldn't set term attributes"); 311 | } 312 | 313 | fcntl(fd, F_SETFL, FNDELAY); // Just make sure that reads are non-blocking 314 | } 315 | 316 | inline int writeForces(int fd, float forceA, float forceB, int debug){ 317 | int returnVal = 0; 318 | signed char ch; 319 | char sentinel = 127; 320 | 321 | // First write the sentinel character of 127 322 | returnVal = write(fd, &sentinel, 1); 323 | if (returnVal<1) { perror("Couldn't write sentinel"); } 324 | 325 | // Max. motor force is 1.3N at 10V 326 | // So max. motor force is 1.56N at 12V. 327 | // This needs to get mapped to the range [-127 to 126] and clip it 328 | forceA = forceA / 1.56 * 127.0; 329 | forceB = forceB / 1.56 * 127.0; 330 | if (forceA > 126.0) { forceA = 126.0; } else if (forceA < -127.0) { forceA = -127.0; } 331 | if (forceB > 126.0) { forceB = 126.0; } else if (forceB < -127.0) { forceB = -127.0; } 332 | 333 | // Write the forces out to the serial 334 | ch = (signed char)forceA; 335 | returnVal = write(fd, &ch, 1); 336 | if (returnVal < 1) { printf("Couldn't write char returnVal=%d!\n", returnVal); } 337 | if (debug) { printf("Writing force chars: %d ", (int)ch); } 338 | 339 | ch = (signed char)forceB; 340 | returnVal = write(fd, &ch, 1); 341 | if (returnVal < 1) { printf("Couldn't write char returnVal=%d!\n", returnVal); } 342 | if (debug) { printf("and %d with returnval %d\n\n", (int)ch, returnVal); } 343 | 344 | return(returnVal); 345 | } 346 | 347 | 348 | 349 | hapticdsp(void) : mydsp() { 350 | open_port(); 351 | setBaudRate(fd); 352 | iterationNum = 0; 353 | sentinelNum = 0; 354 | sentinelCount = 100; // Make sure we wait to parse the input data until we receive the sentinel 355 | nReads = 0; 356 | positionA = 0.0; 357 | positionB = 0.0; 358 | capSenseA = 0; 359 | capSenseB = 0; 360 | debug = 1; // currently debugging is on 361 | 362 | posA = new positionEstimator(CUTOFF_FREQ); // For cutoff frequency of position estimator 363 | posB = new positionEstimator(CUTOFF_FREQ); // For cutoff frequency of position estimator 364 | 365 | positionVector = new FAUSTFLOAT*[NUMBER_OF_HAPTIC_DOF]; 366 | forceVector = new FAUSTFLOAT*[NUMBER_OF_HAPTIC_DOF]; 367 | 368 | for(int i=0; i 0) { 440 | nReads++; 441 | 442 | if (buf == 255) { // Received Sentinel character 443 | sentinelCount = 0; 444 | sentinelNum++; 445 | } else { 446 | sentinelCount++; 447 | 448 | if (sentinelCount == 1){ 449 | positionA = ((float)(buf) - 127.0) / 128.0 * 0.05; 450 | } 451 | 452 | if (sentinelCount == 2){ 453 | positionB = ((float)(buf) - 127.0) / 128.0 * 0.05; 454 | } 455 | } 456 | 457 | if (debug && (!(iterationNum%999))) 458 | printf("Sentinel count=%d, this char=%d\n", sentinelCount, buf); 459 | } 460 | 461 | // Copy the most-recently sensed positions into the appropriate input vectors. 462 | // (Later this could be generalized for NUMBER_OF_HAPTIC_DOF.) 463 | for(int j=0; jtick(positionA); 465 | netInput[1][j] = posB->tick(positionB); 466 | } 467 | 468 | // If debug is on, occasionally print out the sensed positions 469 | if (debug && (!(iterationNum%999))) 470 | printf("LOCAL PositionA = %f and positionB = %f and nChar=%d\n", positionA, positionB, nChar); 471 | 472 | 473 | 474 | 475 | // Finally call the computation that is programmed via Faust DSP 476 | mydsp::compute(vectorLength, netInput, netOutput); 477 | 478 | 479 | 480 | 481 | // Write output forces to motors depending on physical model. 482 | // (Later this could be generalized for NUMBER_OF_HAPTIC_DOF.) 483 | // 484 | // Here we use the end of the audio vector because it corresponds to the "most recent" time. 485 | writeForces(fd, netOutput[0][vectorLength-1], netOutput[1][vectorLength-1], (debug && (!(iterationNum%999)))); 486 | } 487 | }; 488 | 489 | 490 | hapticdsp DSP; 491 | 492 | list GUI::fGuiList; 493 | 494 | //------------------------------------------------------------------------- 495 | // MAIN 496 | //------------------------------------------------------------------------- 497 | int main(int argc, char *argv[]) 498 | { 499 | char appname[256]; 500 | char rcfilename[256]; 501 | char* home = getenv("HOME"); 502 | 503 | snprintf(appname, 255, "%s", basename(argv[0])); 504 | snprintf(rcfilename, 255, "%s/.%src", home, appname); 505 | 506 | GUI* interface = new QTGUI(argc, argv); 507 | FUI* finterface = new FUI(); 508 | DSP.buildUserInterface(interface); 509 | DSP.buildUserInterface(finterface); 510 | 511 | #ifdef OSCCTRL 512 | GUI* oscinterface = new OSCUI(appname, argc, argv); 513 | DSP.buildUserInterface(oscinterface); 514 | #endif 515 | 516 | jackaudio audio; 517 | audio.init(appname, &DSP); 518 | finterface->recallState(rcfilename); 519 | audio.start(); 520 | 521 | #ifdef OSCCTRL 522 | oscinterface->run(); 523 | #endif 524 | interface->run(); 525 | 526 | audio.stop(); 527 | finterface->saveState(rcfilename); 528 | return 0; 529 | } 530 | 531 | 532 | /********************END ARCHITECTURE SECTION (part 2/2)****************/ 533 | 534 | --------------------------------------------------------------------------------