-odac sr = 44100 ksmps = 1 nchnls = 2 0dbfs = 1 instr MassSpring ;initial values a0 init 0 a1 init 0.05 ic = 0.01 ;spring constant ;calculation of the next value a2 = a1+(a1-a0) - ic*a1 outs a0, a0 ;actualize values for the next step a0 = a1 a1 = a2 endin i "MassSpring" 0 10 ;example by joachim heintz, after martin neukom