CSound stellt alle Zutaten bereit, aus denen wir uns schöne Waveshapings kochen können:
table
bzw. tablei
kann man
Werte direkt aus einer Tabelle lesen, der Index kann dabei ein
Audiosignal sein.
Als Ausgangspunkt für eigene Waveshaping Experimente sei hier ein generelles Waveshaping instrument vorgestellt:
sr = 44100 kr = 4410 ksmps = 10 nchnls = 2 ;================================================================; ; ; ; General Purpose Waveshaping Instrument ; ; ; ; ; Coded by Russell Pinkston - Univ. of Texas ; instr 9 ihertz = cpspch(p4) iamp = p5 iwave = p6 kgate linseg 0,.01,1,p3-.11,1,.1,0 ;overall amp envelope kctrl linseg 0,p3/2,.999,p3/2,0 aindex oscili kctrl/2,ihertz,1 asignal tablei .5+aindex,iwave,1 knormal tablei kctrl,iwave+1,1 ;amplitude normalization function outs asignal*knormal*iamp*kgate, asignal*knormal*iamp*kgate endin ;=============================================================== ; ========= Score for General Purpose Waveshaping Instrument ; ; ; This demonstrates the use of high partials, sometimes without ; a fundamental, to get quasi-inharmonic spectra from waveshaping. ;=============================================================== ; Sine table f1 0 1025 10 1 ; transfer function1: h0 h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 f04 0 1025 13 1 1 -1 1 -.8 0 .6 0 0 0 .4 0 0 0 0 .1 -.2 -.3 .5 ; normalizing function with midpoint bipolar offset: f05 0 513 4 4 1 i9 0 4 5.00 10000 4 i9 4 . 6.00 . . i9 8 . 7.00 . s f0 1 s ; transfer function2: h0 h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 f04 0 1025 13 1 1 0 0 0 -.1 0 .3 0 -.5 0 .7 0 -.9 0 1 0 -1 0 ; normalizing function with midpoint bipolar offset: f05 0 513 4 4 1 i9 0 4 5.00 10000 4 i9 4 . 6.00 . . i9 8 . 7.00 . s ;f0 1 s ; transfer function3: h0 h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 f04 0 1025 13 1 1 0 0 0 0 0 0 0 -1 0 1 0 0 -.1 0 .1 0 -.2 ; h17 h18 h19 h20 h21 h22 h23 .3 0 -.7 0 .2 0 -.1 ; normalizing function with midpoint bipolar offset: f05 0 513 4 4 1 i9 0 4 5.00 10000 4 i9 4 . 5.06 . i9 8 . 6.00 . e