Csound Csound-dev Csound-tekno Search About

BOUNCE Csound: Non-member submission from [Josep M Comajuncosas ] (fwd)

Date1998-03-12 10:39
Fromjames@maths.ex.ac.uk
SubjectBOUNCE Csound: Non-member submission from [Josep M Comajuncosas ] (fwd)
>Some weeks ago I saw an orchestra from Hans Mikelson implementing wave
>terrain synthesis and I thing this approach could be also valid, based
>on wavetable synthesis and extending it to 3D surfaces by generating
>multiple slices of the surface and storing them in different tables,
>then indexing the stuff with interpolation in the orc code. I=B4ll put
>more examples in Boulanger=B4s book (well... in the CD...). The method is
>less flexible but faster. Look at the tables as they=B4re being generated
>!
>
>; ORC
>
>sr =3D 44100
>kr =3D 44100
>ksmps =3D 1
>
>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>instr 1; Surface generator
>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>p3 =3D .01
>gisize =3D 256;number and size of the tables
>gifn0 =3D 301
>krow init 0
>
>; fill isize tables of size isize to create the surface
>
>iafno ftgen 3, 0, gisize+1 , 9, 1, 1, 270
>loop:
>irow =3D i(krow)
>imult tablei irow, 3
>iftnum =3D gifn0+i(krow)
>iafno ftgen iftnum, 0, gisize+1 , 11, 30, 1, imult*1.15
>
>krow =3D krow + 1
>if krow >=3D gisize + 2 goto end
>reinit loop
>
>end:
>endin
>
>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>instr 2; Orbit & waveform generator
>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>inote =3D cpspch(p4)
>iamp  =3D 10000
>ixcenter =3D p5
>iycenter =3D p6
>
>; set a spiral of kradius and center (p5,p6) to index the surface
>
>kamp linen 1, p3/3, p3, p3/3
>kradius oscil .3, .2, 2
>
>kx oscili kradius, inote*.999, 1; sine
>ky oscili kradius, inote*1.001, 2, 1/4; cosine
>
>ky =3D ky+(1-2*kradius)/2+ (iycenter-.5)
>
>; map the orbit through the surface
>; table indexes
>
>kfndown  =3D int(ky*gisize) + gifn0
>kfnup    =3D int(1+ky*gisize) + gifn0
>kndx     =3D kx; normalized 0 to 1
>
>igoto end
>
>;table read
>
>azdown tableikt kndx,kfndown, 1, ixcenter, 1
>azup   tableikt kndx,kfnup,   1, ixcenter, 1
>
>
>;linear interpolation
>
>ay upsamp frac(ky*gisize)
>
>az =3D (1-ay)*azdown + ay*azup
>
>;final output & endin
>out iamp*az*kamp
>
>end:
>endin
>
>;SCO
>
>f1 0 8193 10 1; a sine wave from -1 to 1 for table index
>f2 0 8193 19 1 1 0 1; a sine wave from 0 to 1 for table number
>i1 0 1
>s
>
>; As you cannot index tables outside the (normalized) range 0 to 1
>; and the max. radius of the orbit is .3 (see the orc)
>; DON=B4T set p6 (the y coordinate) bigger than .7 or smaller than .3 !
>; With the x there=B4s not this problem as
>; the tableikt opcode is set to wrap mode
>; (which is consistent with the periodic nature of GEN11)
>i2 0 2 5.07 .5 .5
>i2 2 4 6.01 .5 .5
>f0 2
>s
>i2 0   25 6.00 .5  .5
>i2 1.5 25 5.00 .45 .48
>i2 2.4 25 6.00 .63 .6
>i2 3.3 25 5.00 .21 .59
>i2 4.8 25 6.00 .12 .64
>i2 5   25 6.00 .94 .4
>
>e
>
>
>
>
>