an open-source digital signal processing and sound synthesis language
about · links · contact
MMESH2D -- 2-dimensional 'mesh' physical model
in RTcmix/insts/stk

quick syntax:
MMESH2D(outsk, dur, AMP, nxpoints, nypoints, xpos, ypos, decay, strike[, PAN])

CAPITALIZED parameters are pfield-enabled for table or dynamic control (see the maketable or makeconnection scorefile commands). Parameters after the [bracket] are optional and default to 0 unless otherwise noted.

   p0 = output start time (seconds)
   p1 = duration (seconds)
   p2 = amplitude (absolute, for 16-bit soundfiles: 0-32768)
   p3 = # of X points (2-12)
   p4 = # of Y points (2-12)
   p5 = xpos (0.0-1.0)
   p6 = ypos (0.0-1.0)
   p7 = decay value (0.0-1.0)
   p8 = strike energy (0.0-1.0)
   p9 = pan (0-1 stereo; 0.5 is middle) [optional; default is 0.5]

   p2 (amplitude) and p9 (pan) can receive dynamic updates from a table or
   real-time control source

   Author:  Brad Garton, based on code from the Synthesis ToolKit

MMESH2D is the "Mesh2D" physical model in Perry Cook and Gary Scavone's STK, the Synthesis ToolKit.

Usage Notes

MMESH2D creates some interestingly bizarre sounds. It's sort of like tapping on a flexible metal sheet. What fun!

Here's what was written in the original source code:

    This class implements a rectilinear, two-dimensional digital waveguide mesh structure. For details, see Van Duyne and Smith, "Physical Modeling with the 2-D Digital Waveguide Mesh", Proceedings of the 1993 International Computer Music Conference.
The 'mesh' is defined by p3 ("nxpoints") and p4 ("nypoints"). The modeled mesh is then 'struck' at the position specified by p5 ("xpos") and p6 ("ypos").

Sometimes the amplitude is very small and has to be boosted.

MMESH2D can produce other mono or stereo output.

Sample Scores

very basic:
   rtsetparams(44100, 2)

   MMESH2D(0, 4.5, 3*30000, 12, 11, 0.8, 0.9, 1.0, 1.0, 0.5)

   amp = 30000
   ampenv = maketable("line", 1000, 0,0, 4,1, 5,0)
   pan = makeLFO("tri", 0.5, 0.0, 1.0)
   MMESH2D(5, 4.5, amp*ampenv*100, 10, 11, 0.7, 0.1, 1.0, 1.0, pan)

slightly more advanced:
   rtsetparams(44100, 2)


   st = 0
   for (i = 0; i < 150; i = i+1)
      nx = irand(2, 12)
      ny = irand(2, 12)
      MMESH2D(st, 0.5, 17000, nx, ny, random(), random(), random(), random(), random())
      st = st + 0.1

See Also