Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Low Frequency Oscillator
Jacob Joaquin
October 1, 2010
jacobjoaquin@gmail.com
csoundblog.com
<CsoundSynthesizer>
<CsInstruments>
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1
0dbfs = 1.0
instr 1
iamp = p4 ; Amplitude
ifreq = p5 ; Frequency
ilfo_freq = p6 ; Frequency of LFO
ifn = p7 ; Function number of stable storing LFO Shape:
; 1 = triangle
; 2 = sawtooth
; 3 = square
ilfo_amount = p8 ; Amount of frequency deviation
kosc oscil ilfo_amount, ilfo_freq, ifn ; Low Frequency Oscillator
a1 vco2 iamp, ifreq * (kosc + 1), 10, 0 ; Square wave
out a1
endin
</CsInstruments>
<CsScore>
; F-tables
f 1 0 8192 7 -1 4096 1 4096 -1 ; Triangle
f 2 0 8192 7 -1 8192 1 ; Sawtooth
f 3 0 8192 7 1 4096 1 0 -1 4096 -1 ; Square
; Triangle LFO
i 1 0 2 0.5 440 1 1 0.01
i 1 + . . . 2 . .
i 1 + . . . 4 . .
i 1 + . . . 8 . .
i 1 + . . . 16 . .
i 1 + . . . 32 . .
s
i 1 0 2 0.5 440 1 1 0.5
i 1 + . . . 2 . .
i 1 + . . . 4 . .
i 1 + . . . 8 . .
i 1 + . . . 16 . .
i 1 + . . . 32 . .
s
; Sawtooth LFO
i 1 0 2 0.5 440 1 2 0.01
i 1 + . . . 2 . .
i 1 + . . . 4 . .
i 1 + . . . 8 . .
i 1 + . . . 16 . .
i 1 + . . . 32 . .
s
i 1 0 2 0.5 440 1 2 0.5
i 1 + . . . 2 . .
i 1 + . . . 4 . .
i 1 + . . . 8 . .
i 1 + . . . 16 . .
i 1 + . . . 32 . .
s
; Square LFO
i 1 0 2 0.5 440 1 3 0.01
i 1 + . . . 2 . .
i 1 + . . . 4 . .
i 1 + . . . 8 . .
i 1 + . . . 16 . .
i 1 + . . . 32 . .
s
i 1 0 2 0.5 440 1 3 0.5
i 1 + . . . 2 . .
i 1 + . . . 4 . .
i 1 + . . . 8 . .
i 1 + . . . 16 . .
i 1 + . . . 32 . .
s
</CsScore>
</CsoundSynthesizer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment