Tuesday, July 11, 2017

ex1C02_3. RMS Feedback System (reson)

# ex1C02_3.py
# RMS Feedback System (reson)

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")

# input (2 frequencies)
# f1 = 100 Hz
# f2 = 600 Hz
# f3 = 1100 Hz
# f1 + f2 + f3 (aout) on left channel
# use reson to keep only 2nd signal (f2) in afilt on right channel

add("""
instr 1
a1          poscil    .2, 100, giSine          ; f1
a2          poscil    .2, 600, giSine          ; f2
a3          poscil    .2, 1100, giSine         ; f3
aout        = a1 + a2 + a3
; bandpass at 600 Hz with bandwidth of 20 Hz in attenuate mode
afilt       reson     aout, 600, 20, 1
            outs      aout, afilt
endin
""")

tags(2)

add("""
i 1 0 1
""")

tags(3)

writeRun(__file__)

Output: (zoomed in)


No comments:

Post a Comment

ex3A05. Audio Vector