; Demonstrations of the phase distortion opcodes ; pdhalf and pdhalfy ; new in Csound 5.08 ; by Anthony Kozar ; http://www.anthonykozar.net/ sr = 44100 kr = 4410 ksmps = 10 nchnls = 1 ; test instrument for pdhalf opcode -- ; when used with a cosine table, this instrument ; produces sounds that remind me of a Casio ; CZ-series synthesizer instr 4 idur = p3 iamp = p4 ifreq = p5 itable = p6 aenv linseg 0, .001, 1.0, idur - .051, 1.0, .05, 0 aosc phasor ifreq kamount linseg -1.0, 0.1, -0.9, 1.0, 0.0 apd pdhalf aosc, kamount aout tablei apd, itable, 1 out aenv*aout*iamp endin ; test instrument for pdhalfy opcode instr 5 idur = p3 iamp = p4 ifreq = p5 iamtinit = p6 itable = p7 aenv linseg 0, .05, 1.0, idur - .1, 1.0, .05, 0 aosc phasor ifreq kamount line -iamtinit, idur, 0.0 apd pdhalfy aosc, kamount aout tablei apd, itable, 1 out aenv*aout*iamp endin ; This instr "incorrectly" feeds a bipolar phasor ; into pdhalf which is set for unipolar mode, but ; it achieves interesting results with a sine wave ; table that are similar to those gotten from a ; cosine table with unipolar phasor. instr 6 idur = p3 iamp = p4 ifreq = p5 kenv linseg 0, .001, 1.0, idur - .051, 1.0, .05, 0 aosc phasor ifreq kamount linseg 1.0, 0.1, 0.9, 1.0, 0.0 apd pdhalf 2*aosc - 1.0, kamount aout tablei 0.5*(apd+1.0), 1, 1 out kenv*aout*iamp endin ; This instr "incorrectly" feeds a bipolar phasor ; into pdhalfy which is set for unipolar mode, but ; it achieves interesting results with a sine wave ; table that are similar to those gotten from a ; cosine table with unipolar phasor. instr 7 idur = p3 iamp = p4 ifreq = p5 iamtinit = p6 kenv linseg 0, .05, 1.0, idur - .1, 1.0, .05, 0 aosc phasor ifreq kamount line iamtinit, idur, 0.0 apd pdhalfy 2*aosc - 1.0, kamount aout tablei 0.5*(apd+1.0), 1, 1 out kenv*aout*iamp endin f1 0 16385 10 1 f3 0 16385 9 1 1 270 ; inverted cosine ; descending "just blues" scale ; first with pdhalf and cosine table ; ("classic" CZ-101 sound) t 0 100 i4 0 .333 10000 512 3 i. + . . 448 i. + . . 384 i. + . . 360 i. + . . 341.33 i. + . . 298.67 i. + 2 . 256 s ; with pdhalf and sine table t 0 100 i4 0 .333 10000 512 1 i. + . . 448 i. + . . 384 i. + . . 360 i. + . . 341.33 i. + . . 298.67 i. + 2 . 256 s ; with incorrect bipolar phasor, pdhalf, and sine table t 0 100 i6 0 .333 10000 512 i. + . . 448 i. + . . 384 i. + . . 360 i. + . . 341.33 i. + . . 298.67 i. + 2 . 256 s ; with pdhalfy and cosine table t 0 100 i5 0 .333 10000 512 1.0 3 i. + . . 448 < i. + . . 384 < i. + . . 360 < i. + . . 341.33 < i. + . . 298.67 < i. + 2 . 256 0.5 s ; with pdhalfy and sine table t 0 100 i5 0 .333 10000 512 1.0 1 i. + . . 448 < i. + . . 384 < i. + . . 360 < i. + . . 341.33 < i. + . . 298.67 < i. + 2 . 256 0.5 s ; with incorrect bipolar phasor, pdhalfy, and sine table t 0 100 i7 0 .333 10000 512 1.0 i. + . . 448 < i. + . . 384 < i. + . . 360 < i. + . . 341.33 < i. + . . 298.67 < i. + 2 . 256 0.5 e