Real-Time Audio Processing

Setting up Csound to receive external audio and process it in real time could hardly be easier. Assuming you’ve chosen the correct audio inputs in the Run tab of CsoundQt’s Configuration box and that you’ve hooked up the left and right stereo input signals to your computer’s audio hardware, you can receive the incoming signals like this:


  aL, aR inch 1, 2

Ideally, you’ll be using a low-latency audio driver, such as ASIO, but that’s really all there is to it. The inch will grab the signals from channels 1 and 2 of your audio interface, after which you can process them in whatever manner you desire.

Below is a simple example—a stereo delay with filtering. Before trying out this example, please note: It uses a bandpass filter in a delay loop. This makes it extremely sensitive to small changes in parameter values. Runaway feedback can occur if the parameters stray even slightly too far in one direction or another, so please be careful when entering and editing this code. Ear damage is forever.


  giSine ftgen 0, 0, 8192, 10, 1
  alwayson “DelayProcessor”, 0.5, 0.9

  instr DelayProcessor
  itime = p4 * 2
  itimeR = itime * 1.5
  iLfdbk = p5 * 0.025
  iRfdbk = iLfdbk; * 0.8

  aL, aR inch 1, 2
  klfo oscil 0.002, 0.4, giSine
  kfiltLFO oscil 400, 0.13, giSine

  adelL delayr itime
  aLtap deltapi (itime * 0.5) + klfo
  aLfilt resonr aLtap, 700 + kfiltLFO, 300
  delayw aL + aLfilt * iLfdbk

  adelR delayr itimeR
  aRtap deltapi (itimeR * 0.5) - klfo
  aRfilt resonr aRtap, 700 - kfiltLFO, 300
  delayw aR + aRfilt * iRfdbk

  aoutL = aL * 0.7 + adelL * 0.7
  aoutR = aR * 0.7 + adelR * 0.7
  outs aoutL, aoutR
  endin

  </CsInstruments>
  <CsScore>

  e 3600

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.68.28