The order output (delayr) and then input (delayw) is important. Also we may have any number of taps (along the delay line) using deltapi.
# ex1C02_1.py
# RMS Feedback System (delayr, deltapi, delayw)
from moduleCsound import *
tags(1)
header(ksmps=32)
# global sine table with 1024 points
add("giSine ftgen 0, 0, 2^10, 10, 1 ;table with a sine wave")
# envelope restricts asnd (input) to 0.4 second
# thus each delay is also 0.4 second duration
# we show input to delay system at end (with delayw)
add("""
instr 1
; envelope - rise to 0.2 (0.1 sec), hold at 0.2 (0.2 sec), fall to 0 (0.1 sec)
kamp linseg 0, .1, 0.2, .2, 0.2, .1, 0
asnd poscil kamp, 440, giSine ;initial input
a0 delayr 1 ;delay line of 1 second
a1 deltapi 0.5
delayw asnd
; sum of delayed signal at 0.5 sec as well as 1 sec
a2 = a0 + a1
outs asnd, a2
endin
""")
tags(2)
# instrument 1 played for 2 s
# input (0 - 0.4 s)
# delay at 0.5 sec (0.5 s-0.9 s)
# delay at 1 sec (1 s - 1.4 s)
add("""
i 1 0 2
""")
tags(3)
writeRun(__file__)
Output:
No comments:
Post a Comment