diode_ladder

diode_ladder — Zero-delay feedback implementation of 4 pole diode ladder filter.

Description

Zero-delay feedback implementation of a 4 pole (24 dB/oct) diode low-pass filter. This filter design was originally used in the EMS VCS3 and was the resonant filter in the Roland TB-303.

Syntax

asig diode_ladder ain, xcf, xk [, inlp, isaturation, istor]

Initialization

istor --initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.

Performance

asig -- low-pass output signal.

ain -- input signal.

xcf -- filter cutoff frequency (i-, k-, or a-rate).

xk -- filter feedback value k (i-, k-, or a-rate) that controls resonance. Range 0.0-17.0. Self-oscillation occurs at 17.0.

knlp (optional, default=0) -- Non-linear processing method. 0 = no processing, 1 = higher-quality NLP, 2 = lower-quality NLP (faster). Method 1 uses (1.0 / tanh(ksaturation)) * tanh(ksaturation * input). Method 2 uses tanh(ksaturation * input). Enabling NLP may increase the overall output of filter above unity and should be compensated for outside of the filter.

ksaturation (optional, default=1) -- saturation amount to use for non-linear processing. Values > 1 increase the steepness of the NLP curve.

Examples

Here is an example of the diode_ladder opcode. It uses the file diode_ladder.csd.

Example 234. Example of the diode_ladder opcode.

<CsoundSynthesizer>
<CsOptions>
-o dac
</CsOptions>
<CsInstruments>
sr=44100
ksmps=16
nchnls=2
0dbfs=1


gi_sine ftgen 0, 0, 65537, 10, 1

gkcut init 6000


instr modulation 
  gkcut = lfo(4000, 0.1) + 6000 
endin

instr bass	 

  iamp = ampdbfs(-12) 
  ipch = cps2pch(p4, 12)

  asig = vco2(0.5, ipch, 0)

  acut = expon:a(i(gkcut), p3, 200) 
  aout = diode_ladder(asig, acut, 8, 1, 4)

  aout *= expseg:a(1.0, p3 - 0.05, 1.0, 0.05, 0.001) 

  aout = limit(aout, -1.0, 1.0)

  outc(aout, aout)

endin


gipat[] init 8
gipat[0] = 6.00
gipat[1] = 7.00
gipat[2] = 6.00
gipat[3] = 7.00
gipat[4] = 5.07
gipat[5] = 6.07
gipat[6] = 5.08
gipat[7] = 6.08


instr player
  indx = p4

  ;; play instrument
  if(gipat[indx] > 0) then
    schedule("bass", 0, 0.2, gipat[indx])
  endif

  ;; temporal recursion
  schedule("player", 0.2, 0.1, (indx + 1) % lenarray(gipat))

endin

schedule("modulation", 0, -1)
schedule("player", 0, 0.1, 0)
event_i("e", 0, 0.1 * 128)

</CsInstruments>

<CsScore>  
</CsScore>

</CsoundSynthesizer>


References

This filter is based on the work of Will Pirkle that employs Vadim Zavalishin's work with bilinear tranforms to create topology-preserving transform (TPT) implementations of analog filters.

  1. Pirkle, Will. Designing Software Synthesizer Plug-ins in C++: For RackAFX, VST3, and Audio Units. CRC Press, 2014.

  2. Pirkle, Will. AN-6: Virtual Analog (VA) DiodeLadder Filter. 2013.

  3. Zavalishin, Vadim. "The Art of VA filter design." Native Instruments, 2012.

Credits

Author: Steven Yi
April 2017

New in Csound 6.09.0