Hi again Cluster5,
Here is a working example which exhibit the basic principles.
I hope this helps and don’t hesitate to get back to us if it doesn’t.
Cheers,
Robert
Create a “test.lisp” file with the following content:
;;;-*-Mode: Lisp; Package: MODALYS -*-
;;; - - - - - - - - - - - - - - - - - - - - - -
;;; 3D object example - - - - - - - - - - - - -
;;; a simple aluminium rectangular plate - - -
;;; made of 4x5 10cm squares, 2mm thick - - - -
;;; It is then hit by a hammer - - - - - - - -
;;; - - - - - - - - - - - - - - - - - - - - - -
(new)
(setq plate (make-mesh 'read-from-file (make-pathname-in-directory-of-source-file "plate.mesh")))
;; static 3D object view:
;(view 'mesh plate)
(setq alu-plate (make-object 'finite-element (mesh plate)
(modes 40)
;(block hold)
(young 7.4e10)
(density 2790)
(poisson 0.35)
(freq-loss 0.1)
(const-loss 0.1)))
(compute-modes alu-plate)
;; cinematic mode view example:
;(view 'mode alu-plate 20 30 30)
;; input (hammer) and output (ear):
(setq alu-plate-in ( make-access alu-plate (const 5) 'normal ))
(setq alu-plate-out ( make-access alu-plate (const 16) 'normal ))
(setq my-hammer (make-object 'bi-two-mass))
;;;
;;; make strike connection
;;;
(setq hammer-ctrl (make-controller 'dynamic 1 0 (list 0.1)))
(setq my-hammer-plk (make-access my-hammer (const 1) 'trans0))
(make-connection 'strike alu-plate-in 0 my-hammer-plk .1 (const 0.01))
;;;
;;; make position connection to push hammer
;;;
(setq my-hammer-mov (make-access my-hammer (const 0) 'trans0))
(make-connection 'position my-hammer-mov hammer-ctrl)
;;;
;;; make listening point on string
;;;
(make-point-output alu-plate-out)
;;;
;;; run the synthesis and play the sound
;;;
(setq list-dur (list 2 1 2 1 1 2 1 2))
(setq speed-coef .2)
(do ((i 0 (+ i 1))) ((= i (length list-dur)))
(set-breakpoint hammer-ctrl (list 0.01 -0.001))
(run 0.01)
(set-breakpoint hammer-ctrl (list 0.1 0.1))
(run (- (* (nth i list-dur) speed-coef) 0.01))
)
(run 10)
(play)
Also, create a file named “plate.mesh” in the same directory:
MeshVersionFormatted 1
Dimension 3
Vertices
60
0 0 0 0
0 0 0.002 0
0 0.1 0 0
0 0.1 0.002 0
0 0.2 0 0
0 0.2 0.002 0
0 0.3 0 0
0 0.3 0.002 0
0 0.4 0 0
0 0.4 0.002 0
0.1 0 0 0
0.1 0 0.002 0
0.1 0.1 0 0
0.1 0.1 0.002 0
0.1 0.2 0 0
0.1 0.2 0.002 0
0.1 0.3 0 0
0.1 0.3 0.002 0
0.1 0.4 0 0
0.1 0.4 0.002 0
0.2 0 0 0
0.2 0 0.002 0
0.2 0.1 0 0
0.2 0.1 0.002 0
0.2 0.2 0 0
0.2 0.2 0.002 0
0.2 0.3 0 0
0.2 0.3 0.002 0
0.2 0.4 0 0
0.2 0.4 0.002 0
0.3 0 0 0
0.3 0 0.002 0
0.3 0.1 0 0
0.3 0.1 0.002 0
0.3 0.2 0 0
0.3 0.2 0.002 0
0.3 0.3 0 0
0.3 0.3 0.002 0
0.3 0.4 0 0
0.3 0.4 0.002 0
0.4 0 0 0
0.4 0 0.002 0
0.4 0.1 0 0
0.4 0.1 0.002 0
0.4 0.2 0 0
0.4 0.2 0.002 0
0.4 0.3 0 0
0.4 0.3 0.002 0
0.4 0.4 0 0
0.4 0.4 0.002 0
0.5 0 0 0
0.5 0 0.002 0
0.5 0.1 0 0
0.5 0.1 0.002 0
0.5 0.2 0 0
0.5 0.2 0.002 0
0.5 0.3 0 0
0.5 0.3 0.002 0
0.5 0.4 0 0
0.5 0.4 0.002 0
Hexahedra
20
2 4 14 12 1 3 13 11 0
4 6 16 14 3 5 15 13 0
6 8 18 16 5 7 17 15 0
8 10 20 18 7 9 19 17 0
12 14 24 22 11 13 23 21 0
14 16 26 24 13 15 25 23 0
16 18 28 26 15 17 27 25 0
18 20 30 28 17 19 29 27 0
22 24 34 32 21 23 33 31 0
24 26 36 34 23 25 35 33 0
26 28 38 36 25 27 37 35 0
28 30 40 38 27 29 39 37 0
32 34 44 42 31 33 43 41 0
34 36 46 44 33 35 45 43 0
36 38 48 46 35 37 47 45 0
38 40 50 48 37 39 49 47 0
42 44 54 52 41 43 53 51 0
44 46 56 54 43 45 55 53 0
46 48 58 56 45 47 57 55 0
48 50 60 58 47 49 59 57 0
End