## 4. Actively Augmenting Mobile Devices
### Active Augmentation Framework
#### 5.2.3 Example: Marimba Physical Model Using FPML and mesh2 faust  
This section briefly demonstrates how a simple marimba physical model can be made using mesh2 faust and FPML (An extended version of this example with more technical details is also available in the corresponding on-line tutorial: [[https://ccrma.stanford.edu/~rmichon/faustTutorials/#making-custom-elements-using-mesh2](https://ccrma.stanford.edu/~rmichon/faustTutorials/#making-custom-elements-using-mesh2) faust]([https://ccrma.stanford.edu/~rmichon/faustTutorials/#making-custom-elements-using-mesh2](https://ccrma.stanford.edu/~rmichon/faustTutorials/#making-custom-elements-using-mesh2) faust)). The idea is to use a 3D CAD model of a marimba bar, generate the corresponding modal model, and then connect it to a tube model implemented in FPML. A simple marimba bar 3D model can be made by extruding a marimba bar cross section using the Inkscape to OpenSCAD tool part of mesh2 faust[56]. The resulting CAD model is then turned into a volumetric mesh by importing it to MeshLab and by uniformly re-sampling it to have approximately 4500 vertices. The mesh produced during this step (marimbaBar.obj) in the following code listing) can then be processed by mesh2 faust using the following command (A complete listing of mesh2 faust's options can be found in its on-line documentation: [[https://github.com/grame-cncm/faust/blob/master-dev/tools/physicalModeling/mesh2](https://github.com/grame-cncm/faust/blob/master-dev/tools/physicalModeling/mesh2) faust/README.md]([https://github.com/grame-cncm/faust/blob/master-dev/tools/physicalModeling/mesh2](https://github.com/grame-cncm/faust/blob/master-dev/tools/physicalModeling/mesh2) faust/README.md). ):  
mesh2 faust --infile marimbaBar.obj --nsynthmodes 50 --nfemmodes 200  --maxmode 15000 --expos 2831 3208 3624 3975 4403 --freqcontrol  --material 1.3E9 0.33 720 --name marimbaBarModel  
The material parameters are those of rosewood which is traditionally used to make marimba bars. The number of modes is limited to 50 and various excitation positions were selected to be uniformly spaced across the horizontal axis of the bar. frequency control mode is activated to be able to transpose the modes of the generated model in function of the fundamental frequency making the model more generic. A simple marimba resonator was assembled using FPML and is presented in Code Listing 6. It is made out of an open tube where two simple lowpass filters placed at its extremities are used to model the wave reflections. The model is excited on one side of the tube and sound is picked-up on the other side. marimbaResTube(tubeLength,excitation) = endChain(tubeChain) with{  lengthTuning = 0.04; tunedLength = tubeLength-lengthTuning;  absorption = 0.99; lowpassPole = 0.95;  endTubeReflexion = si.smooth(lowpassPole)*absorption;  tubeChain = chain(  in(excitation) : terminations(endTubeReflexion,  openTube(maxLength,tunedLength),  endTubeReflexion) : out  ); };
```

Listing 6: Simple marimba resonator tube implemented with FPML. Code Listing 7 demonstrates how the marimba bar model generated with mesh2 faust (marimbaBarModel) can be simply connected to the marimba resonator. A unidirectional connection can be used in this case since waves are only transmitted from the bar to the resonator. marimbaModel(freq,exPos) =  marimbaBarModel(freq,exPos,maxT60,T60 Decay,T60 Slope) :  marimbaResTube(resTubeLength) with{  resTubeLength = freq : f2l;  maxT60 = 0.1; T60 Decay = 1; T60 Slope = 5; }; ```

Listing 7: Simple marimba physical model. This model is now part of the Faust Physical Modeling Library. It could be easily used with faust2 smartkeyb to implement a marimba app (see Section 2) as well as with any of the Faust targets (e.g., Web App, Plug-In, etc.).