Skip to content

Instantly share code, notes, and snippets.

@jacobjoaquin
Created September 20, 2010 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacobjoaquin/588555 to your computer and use it in GitHub Desktop.
Save jacobjoaquin/588555 to your computer and use it in GitHub Desktop.
2600 Synthesis
Jacob Joaquin & Jean-Luc Sinclair
September 20, 2010
jacobjoaquin@gmail.com
csoundblog.com
<CsoundSynthesizer>
<CsInstruments>
sr = 30000
kr = 30000
ksmps = 1
nchnls = 1
0dbfs = 1
garvbsig init 0 ; Global "a" variable initialized to 0
; Bit Shift Register Synth
instr 1
idiv = int(p4) ; Integer division of clock. Range 1 - 32.
itab = p5 ; Selects the waveform
; Limit clock division to a range between 1 and 32
idiv limit idiv, 1, 32
; Convert clock division to frequency
ifreq = sr / 16 / idiv
print ifreq
; Oscillator
a1 oscil 0.1, ifreq, itab
; Output audio
out a1
endin
;Bit Shift Register Synth with Envelope
instr 2
idur = p3 ; Duration
ienv1 = p4 ; Starting envelope value. Range 1 - 32
ienv2 = p5 ; Ending envelope value. Range 1 - 32
itab = p6 ; Selects the waveform
; Limit envelope end points to a range between 1 and 32
ienv1 limit ienv1, 1, 32
ienv2 limit ienv2, 1, 32
; Envelope to control the clock divider
kline line ienv1, idur, ienv2
; The original atari 2600 clock uses integers to divide the clock.
; Thus, the envelope is quantized from a continuous signal to a
; signal composed of whole numbers.
kline = int(kline)
; Convert clock division to frequency
kfreq = sr / 16 / kline
; Oscillator
a1 oscil 0.1, kfreq, itab
; Output audio
out a1
; 5% of the dry signal is sent to the reverb
garvbsig = garvbsig + a1 * 0.05
endin
; Simple Csound Reverb
instr 99
irvbtime = p4 ; Reverb time
asig reverb garvbsig, irvbtime ; Put global sig into reverb
out asig ; Output reverb
garvbsig = 0 ; Clear global signl (prevents feedback)
endin
</CsInstruments>
<CsScore>
; The register. This table stores a compound pulse wave.
f 1 0 16 -2 0 0 1 1 0 1 0 0 0 1 1 1 0 1 1 1
; Try entering your won tables for different sounding results.
f 2 0 16 -2 1 0 0 1 1 1 1 0 1 0 0 1 1 1 1 0
f 3 0 16 -2 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0
f 4 0 16 -2 0 0 0 0 1 0 0 1 0 1 0 1 0 1 1 0
; Verb
i 99 0 12 1
; Notes
i 2 1 0.05 1 30 1
i 1 2 1 31 1
i 1 + . 30 2
i 1 + . 29 1
i 1 + . 28 2
i 1 + . 27 1
i 1 + . 26 2
i 1 + . 25 1
i 1 + . 24 2
i 2 10 0.5 1 32 3
s
; Verb
i 99 0 14 1
; Notes
i 1 0.0 1 16 1
i 1 0.5 1 16 .
i 1 1.0 1 16 .
i 1 1.25 1 8 .
i 1 2.0 1 16 .
i 1 2.5 1 4 .
i 1 3.0 1 16 .
i 1 3.25 1 8 .
i 2 4.0 0.5 1 32 1
i 2 4.5 0.8 32 31 .
i 2 4.5 0.8 16 15 .
i 2 4.75 0.45 10 11 .
i 2 4.75 0.45 12 13 .
i 2 5.5 0.8 32 31 .
i 2 5.5 0.8 16 15 .
i 2 5.75 0.45 10 11 .
i 2 5.75 0.45 12 13 .
i 2 6.5 0.8 32 31 .
i 2 6.5 0.8 16 15 .
i 2 6.75 0.45 10 11 .
i 2 6.75 0.45 12 13 .
i 2 7.5 0.8 31 30 .
i 2 7.5 0.8 15 14 .
i 2 8.0 0.5 1 32 .
i 2 8.5 1 16 8 .
i 1 9.5 1 8 1
i 1 9.5 1 16 2
i 2 10.5 1 16 4 2
i 1 11.5 1 8 3
i 1 11.5 1 4 3
e
</CsScore>
</CsoundSynthesizer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment