aboutsummaryrefslogtreecommitdiff
path: root/BUG8
diff options
context:
space:
mode:
authorRichard <q@1bpm.net>2022-01-22 22:27:01 +0000
committerRichard <q@1bpm.net>2022-01-22 22:27:01 +0000
commit44d3d5ece0a53d5316a2ccc9898b79992d81fef7 (patch)
treeb456d3007f3e8c5a122f0dc286192e8eaf90a1b1 /BUG8
parent5afc582483c0658f3c8bac9cd854a7905e8d88c7 (diff)
downloadcsd-unfixedbugs1-44d3d5ece0a53d5316a2ccc9898b79992d81fef7.tar.gz
csd-unfixedbugs1-44d3d5ece0a53d5316a2ccc9898b79992d81fef7.tar.bz2
csd-unfixedbugs1-44d3d5ece0a53d5316a2ccc9898b79992d81fef7.zip
update
Diffstat (limited to 'BUG8')
-rw-r--r--BUG8/BUG8.csd313
-rw-r--r--BUG8/wavetables.udo16
2 files changed, 329 insertions, 0 deletions
diff --git a/BUG8/BUG8.csd b/BUG8/BUG8.csd
new file mode 100644
index 0000000..5f27a86
--- /dev/null
+++ b/BUG8/BUG8.csd
@@ -0,0 +1,313 @@
+<CsoundSynthesizer>
+<CsOptions>
+-odac
+</CsOptions>
+<CsInstruments>
+sr = 44100
+kr = 441
+nchnls = 2
+0dbfs = 1
+seed 0
+
+#include "wavetables.udo"
+
+giampfn init -1
+gifreqfn init -1
+gifftsize = 1024
+
+
+opcode SCReverb, aa, aakkjpo
+
+ setksmps 1
+
+ ainL, ainR, kFeedBack, kLPFreq, iSRate, iPitchMod, iSkip xin
+ iSRate = (iSRate <= 0 ? 1 : (sr / iSRate))
+ if (iSkip != 0) igoto SkipInit
+
+ afilt1 init 0
+ afilt2 init 0
+ afilt3 init 0
+ afilt4 init 0
+ afilt5 init 0
+ afilt6 init 0
+ afilt7 init 0
+ afilt8 init 0
+
+ ; Delay times chosen to be prime numbers.
+ ; Works with sr=44100 ONLY. If you wish to
+ ; use a different delay time, find some new
+ ; prime numbers that will give roughly the
+ ; same delay times for the new sampling rate.
+ ; Or adjust to taste.
+
+ idel1 = 2473.000 / (iSRate * 44100)
+ idel2 = 2767.000 / (iSRate * 44100)
+ idel3 = 3217.000 / (iSRate * 44100)
+ idel4 = 3557.000 / (iSRate * 44100)
+ idel5 = 3907.000 / (iSRate * 44100)
+ idel6 = 4127.000 / (iSRate * 44100)
+ idel7 = 2143.000 / (iSRate * 44100)
+ idel8 = 1933.000 / (iSRate * 44100)
+
+ ; kFeedBack:
+ ; gain of reverb. Adjust empirically
+ ; for desired reverb time. .6 gives
+ ; a good small \\\"live\\\" room sound, .8
+ ; a small hall, .9 a large hall,
+ ; .99 an enormous stone cavern.
+
+ ; iPitchMod:
+ ; amount of random pitch modulation
+ ; for the delay lines. 1 is the \\\"normal\\\"
+ ; amount, but this may be too high for
+ ; held pitches such as piano tones.
+ ; Adjust to taste.
+
+ ; kLPFreq:
+ ; Cutoff frequency of lowpass filters
+ ; in feedback loops of delay lines,
+ ; in Hz. Lower cutoff frequencies results
+ ; in a sound with more high-frequency
+ ; damping.
+
+ ; k1-k8 are used to add random pitch modulation to the
+ ; delay lines. Helps eliminate metallic overtones
+ ; in the reverb sound.
+
+ iPitchMod = iPitchMod / iSRate
+
+ k1 randi 0.0010 * iPitchMod, 3.100 * iSRate, 0.06
+ k2 randi 0.0011 * iPitchMod, 3.500 * iSRate, 0.90
+ k3 randi 0.0017 * iPitchMod, 1.110 * iSRate, 0.70
+ k4 randi 0.0006 * iPitchMod, 3.973 * iSRate, 0.30
+ k5 randi 0.0010 * iPitchMod, 2.341 * iSRate, 0.63
+ k6 randi 0.0011 * iPitchMod, 1.897 * iSRate, 0.70
+ k7 randi 0.0017 * iPitchMod, 0.891 * iSRate, 0.90
+ k8 randi 0.0006 * iPitchMod, 3.221 * iSRate, 0.44
+
+ ; apj is used to calculate \\\"resultant junction pressure\\\" for
+ ; the scattering junction of 8 lossless waveguides
+ ; of equal characteristic impedance. If you wish to
+ ; add more delay lines, simply add them to the following
+ ; equation, and replace the .25 by 2/N, where N is the
+ ; number of delay lines.
+
+ apj = .25 * (afilt1+afilt2+afilt3+afilt4+afilt5+afilt6+afilt7+afilt8)
+
+ adum1 delayr 1
+ adel1 deltap3 idel1 + k1
+ delayw ainL + apj - afilt1
+
+ adum2 delayr 1
+ adel2 deltap3 idel2 + k2
+ delayw ainR + apj - afilt2
+
+ adum3 delayr 1
+ adel3 deltap3 idel3 + k3
+ delayw ainL + apj - afilt3
+
+ adum4 delayr 1
+ adel4 deltap3 idel4 + k4
+ delayw ainR + apj - afilt4
+
+ adum5 delayr 1
+ adel5 deltap3 idel5 + k5
+ delayw ainL + apj - afilt5
+
+ adum6 delayr 1
+ adel6 deltap3 idel6 + k6
+ delayw ainR + apj - afilt6
+
+ adum7 delayr 1
+ adel7 deltap3 idel7 + k7
+ delayw ainL + apj - afilt7
+
+ adum8 delayr 1
+ adel8 deltap3 idel8 + k8
+ delayw ainR + apj - afilt8
+
+ ; 1st order lowpass filters in feedback
+ ; loops of delay lines.
+
+ kLPFreq = kLPFreq * iSRate
+
+ afilt1 tone adel1 * kFeedBack, kLPFreq
+ afilt2 tone adel2 * kFeedBack, kLPFreq
+ afilt3 tone adel3 * kFeedBack, kLPFreq
+ afilt4 tone adel4 * kFeedBack, kLPFreq
+ afilt5 tone adel5 * kFeedBack, kLPFreq
+ afilt6 tone adel6 * kFeedBack, kLPFreq
+ afilt7 tone adel7 * kFeedBack, kLPFreq
+ afilt8 tone adel8 * kFeedBack, kLPFreq
+
+ ; The outputs of the delay lines are summed
+ ; and sent to the stereo outputs. This could
+ ; easily be modified for a 4 or 8-channel
+ ; sound system.
+
+ aoutL = 0.35 * (afilt1 + afilt3 + afilt5 + afilt7)
+ aoutR = 0.35 * (afilt2 + afilt4 + afilt6 + afilt8)
+
+ SkipInit:
+ xout aoutL, aoutR
+ endop
+
+
+instr liner
+ index = p4
+ isinit = p5
+ iampscale = (((gifftsize / 2) - index) / (gifftsize / 2)) * 0.1
+ isamp = (isinit == 1) ? random(0, iampscale) : tab_i(index, giampfn)
+ isfreq = (isinit == 1) ? 440 : tab_i(index, gifreqfn)
+ tabw oscil:k(1, random(0.01, 1), -1, random(0, 1)) * linseg(isamp, p3, random(0, iampscale)), index, giampfn
+ tabw linseg(isfreq, p3, random(50, 1900)), index, gifreqfn
+
+endin
+
+instr rndoise
+ ipanrange1 = p4
+ ipanrange2 = p5
+ ifreqmax = random(100, 1000)
+ if (random(0, 1) > 0.3) then
+ a1 oscil line(random(0.5, 1), p3, random(0.5, 1)), random(100, ifreqmax)
+ else
+ a1 noise line(random(0.5, 1), p3, random(0.5, 1)), random(-1, 1)
+ endif
+
+ if (random(0, 1) > 0.6) then
+ a1 *= oscil(line(random(0.5, 1), p3, random(0.5, 1)), random(100, ifreqmax))
+ endif
+
+ if (random(0, 1) > 0.9) then
+ a1 *= noise(line(random(0.5, 1), p3, random(0.5, 1)), random(-1, 1))
+ endif
+
+ if (random(0, 1) > 0.6) then
+ a1 *= oscil(random:k(0.5, 1), random(100, ifreqmax))
+ endif
+
+ if (random(0, 1) > 0.9) then
+ a1 *= noise(random:k(0.5, 1), random(-1, 1))
+ endif
+
+ if (random(0, 1) > 0.6) then
+ a1 taninv a1 * line(random(1, 10), p3, random(1, 10))
+ endif
+
+ if (random(0, 1) > 0.6) then
+ a1 butterhp a1, line(random(20, 2000), p3, random(20, 2000))
+ endif
+
+ if (random(0, 1) > 0.6) then
+ a1 butterlp a1, line(random(500, 16000), p3, random(500, 16000))
+ endif
+
+ if (random(0, 1) > 0.5) then
+ a1 *= oscil(1, random(1, 50))
+ else
+ a1 *= line(random(0, 1), p3, random(0, 1))
+ endif
+
+ if (random(0, 1) > 0.6) then
+ a1 waveset a1, random(1, 20)
+ endif
+
+ a1 *= 0.5
+ aL, aR pan2 a1, ipanrange1, ipanrange2
+ outs aL, aR
+endin
+
+
+instr trigrndoise
+ itime = 0
+ imax = random(5, 20)
+ while (itime < p3) do
+ ilen = (p3 / imax) * random(0.6, 1.2)
+ event_i "i", "rndoise", itime, ilen, random(0, 1), random(0, 1)
+ itime += ilen * random(0.8, 1.1)
+ od
+endin
+
+
+instr clicker
+ aL noise 0.4, 0.4
+ aR noise 0.4, 0.4
+ kamp linseg 1, p3, 0
+ outs aL*kamp, aR*kamp
+endin
+
+
+instr clickmaker
+ idur random 0.001, 0.01
+ kmetro metro random(1, 6)
+ if (kmetro == 1) then
+ event "i", "clicker", 0, idur
+ endif
+endin
+
+instr 1
+ ktime timeinsts
+ isize = gifftsize / 2
+ giampfn ftgen 0, 0, isize, 7, 0
+ gifreqfn ftgen 0, 0, isize, 7, 0
+
+ itime = 60
+ kmetro metro 1/itime
+ kinit init 1
+ if (kmetro == 1) then
+ kndex = 0
+ while (kndex < isize) do
+ event "i", "liner", 0, itime, kndex, kinit
+ kndex += 1
+ od
+ if (kinit == 1) then
+ kinit = 0
+ endif
+ endif
+
+ event_i "i", "clickmaker", 0, 1
+
+ kmetro2 metro 3
+ if (ktime > 5 && kmetro2 == 1 && random:k(0, 1) > 0.95) then
+ event "i", "trigrndoise", 0, random:k(0.6, 2)
+ endif
+
+ ; pvsinit not working here..
+ f1 pvsanal oscils(1, 440, 0), gifftsize, gifftsize/4, gifftsize, 1
+ pvsftr f1, giampfn, gifreqfn
+ f2L pvscale f1, 0.03 + oscil(0.01, 0.01)
+ f2R pvscale f1, 0.03 + oscil(0.01, 0.02, -1, 0.26)
+
+ a2L pvsynth f2L
+ a2R pvsynth f2R
+ a2L pareq a2L, 200, 0.3, 0.6
+ a2R pareq a2R, 200, 0.3, 0.6
+
+ k2mul = 3 * (abs(oscil(0.7, 0.1)) + 0.2)
+ a2L *= k2mul
+ a2R *= k2mul
+
+ ay pvsynth f1
+ ay *= abs(oscil(0.7, 0.001, -1, 0))
+ ;ay exciter ay, 3000, 20000, 10, 10
+
+ a1L = ay
+ a1R = ay
+ ;a1L, a1R SCReverb ay, ay, 0.9, 10000
+ aL = a1L + a2L
+ aR = a1R + a2R
+
+ outs aL, aR
+endin
+
+
+
+
+</CsInstruments>
+<CsScore>
+
+
+i1 0 100
+
+</CsScore>
+</CsoundSynthesizer> \ No newline at end of file
diff --git a/BUG8/wavetables.udo b/BUG8/wavetables.udo
new file mode 100644
index 0000000..e81f075
--- /dev/null
+++ b/BUG8/wavetables.udo
@@ -0,0 +1,16 @@
+#ifndef UDO_WAVETABLES
+#define UDO_WAVETABLES ##
+/*
+ Debugger - Unfixed Bugs : BUG #3
+
+ General waveforms
+*/
+
+ipoints = 16384
+gifnCosine ftgen 0, 0, ipoints, 9, 1, 1, 90
+gifnSine ftgen 0, 0, ipoints, 10, 1
+gifnSquare ftgen 0, 0, ipoints, 10, 1, 0, 0.3, 0, 0.2, 0, 0.14, 0, .111
+gifnSaw ftgen 0, 0, ipoints, 10, 0, .2, 0, .4, 0, .6, 0, .8, 0, 1, 0, .8, 0, .6, 0, .4, 0, .2
+
+#end
+