Csound Csound-dev Csound-tekno Search About

Oscillator Synch Orc/Sco

Date1998-11-14 07:08
FromHans Mikelson
SubjectOscillator Synch Orc/Sco
Hi,

Here is a version of oscillator sync that does not seem too bad.  The top of
the waves line up pretty well.  Softer syncs do not work the greatest.
Please let me know if you have any problems or comments regarding this.

Bye,
Hans Mikelson

;ORCHESTRA
sr = 44100 ; sr must equal kr for this orchestra
kr = 44100
ksmps = 1
nchnls = 2

;---------------------------------------------------------------
; VCO with Sync
;---------------------------------------------------------------
           instr   11

idur       =       p3           ; Duration
iamp       =       p4           ; Amplitude
ifqc       =       cpspch(p5)   ; Frequency
ifqc2      =       ifqc*p6      ; Frequency of pseudo synched oscillator wrt
base frequency
ifco       =       p7*ifqc/500  ; Filter cut-off frequency based, higher
pitches get a higher cut off

krez       init    p8           ; krez is not changing
kfco       expseg  100+.01*ifco, .2*idur, ifco+100, .5*idur, ifco*.1+100,
.3*idur, .001*ifco+100 ; Filter envelope
kamp       linseg  0, .01*idur, iamp, .2*idur, .8*iamp, .49*idur, .5*iamp,
.2*idur, 0            ; Amp envelope

asaw2      init    0

apulse1    buzz    1, ifqc, sr/2/ifqc, 1          ; Band-limited impulse
train
apulse2    buzz    1, ifqc2, sr/2/ifqc2, 1        ; Band-limited impulse
train

asaw       integ   apulse1                        ; Integrate the pulse for
a square wave

aamp1      oscili  1, ifqc,  3                    ; Turn on the gate in sync
with the impulses
aamp2      oscili  1, ifqc2, 3

asaw2      =      (apulse1 + apulse2*aamp2*(1-aamp1))*(1.2-asaw2) +
(1-ifqc/sr)*asaw2 ; Basically don't add two impulses

;aout       rezzy   asaw2-.5, kfco, krez

           outs    (asaw2-.5)*iamp, (asaw2-.5)*iamp

           endin

; SCORE
f1 0 16384 10 1                          ; Sine
f3 0 1024  -7 1 12 1 0 0 1000 0 0 1 12 1 ; Pulse: Wider pulses make softer
syncs.

; Synth with sync
;   Sta  Dur  Amp   Pitch  SyncFqc  Fco   Rez
i11 0    1    20000 6.00   .9      5000  20
i11 +    .    .     7.00   .        .     .
i11 .    .    .     8.00   .        .     .
i11 .    .    .     9.00   .        .     .