aboutsummaryrefslogtreecommitdiff
path: root/sonics
diff options
context:
space:
mode:
Diffstat (limited to 'sonics')
-rwxr-xr-xsonics/instrument_gchord1.udo6
-rwxr-xr-xsonics/instrument_portchord.udo16
-rwxr-xr-xsonics/instrument_sineblips.udo2
-rwxr-xr-xsonics/lagdetect.udo59
-rwxr-xr-xsonics/sequencing_melodic.udo2
5 files changed, 73 insertions, 12 deletions
diff --git a/sonics/instrument_gchord1.udo b/sonics/instrument_gchord1.udo
index 64ed324..a2baf80 100755
--- a/sonics/instrument_gchord1.udo
+++ b/sonics/instrument_gchord1.udo
@@ -145,8 +145,8 @@ instr _fnmi_gchord1_notehold
ilen = ftlen(ifn) / ftsr(ifn)
; pitch lfo
- alfo oscil 2.5, 0.15, gifnSine
- kfreq += k(alfo)
+ alfo oscil 1.5, 0.75, gifnSine
+ ;kfreq += k(alfo)
kpitchratio = (kfreq / cpsmidinn(ibasenote)) * ipitchratio
@@ -238,7 +238,7 @@ instr _fnmi_gchord1_notehold
endif
if (random:k(0, 1) > 0.95) then
- kringmodmult = pow:k(2, round:k(random:k(-1, 2))) ; 3 up to 8
+ kringmodmult = pow:k(2, round:k(random:k(-1, 2))) ; 0.5 to 4
endif
if (random:k(0, 1) > 0.9) then
diff --git a/sonics/instrument_portchord.udo b/sonics/instrument_portchord.udo
index 1948f6e..a6dc51a 100755
--- a/sonics/instrument_portchord.udo
+++ b/sonics/instrument_portchord.udo
@@ -55,21 +55,23 @@ opcode portchord_sound, aa, ippjo
if (kamp != 0) then
- atime = abs(oscil(iend - istart, random(0.001, 0.1), gifnSine, random(0, 1))) + istart
+ atime = abs(oscil(iend - istart, random(0.001, 0.1), gifnSine, random(0, 1)))
+
+ atime *= idur
klfo = oscil:k(random(0.0001, 0.009), random(1, 5)) + 1
kpitch *= klfo
-
if (imode == 0) then
kpitch *= (ftsr(ifn) / sr) ; adjustment for sndwarp required
- ;apitch interp kpitch
- aL, aR sndwarpst kamp, atime, kpitch, ifn, istart, 4410, 441, 8, gifnHalfSine, 1
-
+ ; atime / 2???
+ aL, aR sndwarpst kamp, atime, interp(kpitch), ifn, istart, 4096, 128, 2, gifnHalfSine, 1
+ aL pareq aL, 90, 0.5, 0.6
+ aR pareq aR, 90, 0.5, 0.6
else
if (ichannels == 2) then
- aL, aR mincer atime, kamp, kpitch, ifn, 0, ifftsize
+ aL, aR mincer atime+istart, kamp, kpitch, ifn, 0, ifftsize
else
- aL mincer atime, kamp, kpitch, ifn, 0, ifftsize
+ aL mincer atime+istart, kamp, kpitch, ifn, 0, ifftsize
aR = aL
endif
endif
diff --git a/sonics/instrument_sineblips.udo b/sonics/instrument_sineblips.udo
index 7ddc407..e14064c 100755
--- a/sonics/instrument_sineblips.udo
+++ b/sonics/instrument_sineblips.udo
@@ -47,7 +47,7 @@ instr _fnmi_sineblip
else
kamp linseg 1, p3*0.9, 1, p3*0.1, 0
endif
- bus_mix(Sbus, aL*0.6*kamp, aR*0.6*kamp)
+ bus_mix(Sbus, aL*0.3*kamp, aR*0.3*kamp)
endin
diff --git a/sonics/lagdetect.udo b/sonics/lagdetect.udo
new file mode 100755
index 0000000..f4261b1
--- /dev/null
+++ b/sonics/lagdetect.udo
@@ -0,0 +1,59 @@
+#ifndef UDO_LAGDETECT
+#define UDO_LAGDETECT ##
+/*
+ Processing lag detection
+
+ This file is part of the SONICS UDO collection by Richard Knight 2022
+ License: GPL-2.0-or-later
+ http://1bpm.net
+*/
+
+#define LAG_DFLT_TTHRESH #0.05#
+
+
+/*
+ Detect when the CPU cannot keep up with proessing: when the realtime clock differs from Csound's clock by a specified threshold time.
+ The trigger klagging is output periodically every iautotimethreshold*2 seconds rather than continuously
+
+ klagging, ktimesincelastlag lagdetect [iautotimethreshold=LAG_DFLT_TTHRESH]
+
+ klagging trigger indicating lag has been detected in this k-cycle
+ ktimesincelastlag time in seconds sine the last lag detected
+ iautotimethreshold if realtime clock and Csound clock differ more than this number of seconds, lag is assumed
+*/
+opcode lagdetect, kk, j
+ iautotimethreshold xin
+ iautotimethreshold = (iautotimethreshold == -1) ? $LAG_DFLT_TTHRESH : iautotimethreshold
+ kstartrt init rtclock:i()
+ kclockrt rtclock
+ kstarts init times:i()
+ kclocks times
+ klag = abs:k((kclocks - kstarts) - (kclockrt - kstartrt))
+
+ klagging = 0
+ ; if time difference is above threshold and last adjustment is double threshold, reduce parameters and reset times
+ if (klag > iautotimethreshold && kclockrt - kstartrt > iautotimethreshold * 2) then
+ kstartrt = kclockrt
+ kstarts = kclocks
+ klagging = 1
+ endif
+ xout klagging, kclocks - kstarts
+endop
+
+
+/*
+ Detect when the CPU cannot keep up with proessing: when the realtime clock differs from Csound's clock by a specified threshold time
+ The trigger klagging is output periodically every iautotimethreshold*2 seconds rather than continuously
+
+ klagging lagdetect [iautotimethreshold=LAG_DFLT_TTHRESH]
+
+ klagging trigger indicating lag has been detected in this k-cycle
+ iautotimethreshold if realtime clock and Csound clock differ more than this number of seconds, lag is assumed
+*/
+opcode lagdetect, k, j
+ iautotimethreshold xin
+ klagging, ktimesincelag lagdetect iautotimethreshold
+ xout klagging
+endop
+
+#end
diff --git a/sonics/sequencing_melodic.udo b/sonics/sequencing_melodic.udo
index 69f6a70..81bc0c6 100755
--- a/sonics/sequencing_melodic.udo
+++ b/sonics/sequencing_melodic.udo
@@ -526,7 +526,7 @@ instr _mel_manager
; do something with gkmel_pause == 0
- if (gkseq_beat == 1) then
+ if (gkseq_beat == 1 && gkmel_pause = 0) then
if (kstep == 0) then
tablecopy gimel_current_notes, gimel_next_notes
kcurrent = _mel_future_pop:k()