Skip to content

Instantly share code, notes, and snippets.

@jacobjoaquin
Created August 14, 2011 19:25
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/1145213 to your computer and use it in GitHub Desktop.
Save jacobjoaquin/1145213 to your computer and use it in GitHub Desktop.
Faux Modem Audio
Jacob Joaquin
Aug 14, 2011
jacobjoaquin@gmail.com
CodeHop.com
<CsoundSynthesizer>
<CsInstruments>
sr = 44100
kr = 441
ksmps = 100
nchnls = 1
0dbfs = 1.0
instr 1
iamp = p4 ; Amplitude
ibps = p5 ; Bits per second
ifreq = p6 ; Frequency of carrier
imod = p7 ; Modulation amount
; Generate sine table, only for first instrument instance
itable ftgenonce 0, 0, 8192, 10, 1
; Modulation source. Generate random values at ibps Hz.
amod randh 1.0, ibps
; Convert signal to discreet values of 0.0 and 1.0
amod limit ceil(amod), 0.0, 1.0
; Scale modulation signal
amod = amod * imod
; Generate and frequency modulate a sine wave
a1 oscil iamp, ifreq + amod, itable
; Output
out a1
endin
</CsInstruments>
<CsScore>
i 1 0 16 0.707 300 1070 200
; Additional settings
;i 1 0 16 0.707 300 2025 200
;i 1 0 16 0.707 8 220 110
;i 1 0 16 0.707 32 440 110
;i 1 0 16 0.707 32 440 440
;i 1 0 16 0.707 1200 200 2000
;i 1 0 16 0.707 1200 100 900
;i 1 0 16 0.707 10000 1000 1000
</CsScore>
</CsoundSynthesizer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment