claude

clive workshop 2022-01-15

clive is an audio live-coding skeleton for the C programming language

diff @ 2022-01-11 15:59:02 +0000
diff --git a/client/go.c b/client/go.c
index da9235e..0cf8444 100644
--- a/client/go.c
+++ b/client/go.c
@@ -70,7 +70,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
     { snare * noise()
     , snare * noise()
     };
-  sample snare_gain = 0; // amplify before filters for smoothness
+  sample snare_gain = 1; // amplify before filters for smoothness
   sn[0] *= snare_gain;
   sn[1] *= snare_gain;
   sample snQ = flatq; // resonance
diff @ 2022-01-11 15:59:06 +0000
diff --git a/client/go.c b/client/go.c
index 0cf8444..2f59a12 100644
--- a/client/go.c
+++ b/client/go.c
@@ -54,7 +54,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   kick = kick * sin(12 * twopi * kick); // shape into waveform
   sample kick_gain = 1; // amplify before filters for smoothness
   kick *= kick_gain;
-  sample kkQ = flatq; // resonance
+  sample kkQ = 10; // resonance
   sample kkHz = 60 + 0 * 10 * floor(4 * t); // pitch, quantisation in value
   kick = biquad(highpass(&s->kickbq, kkHz, kkQ), kick); // filter
 #if 0 // change 0 to 1 to enable
diff @ 2022-01-11 15:59:10 +0000
diff --git a/client/go.c b/client/go.c
index 2f59a12..501f8f3 100644
--- a/client/go.c
+++ b/client/go.c
@@ -73,7 +73,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   sample snare_gain = 1; // amplify before filters for smoothness
   sn[0] *= snare_gain;
   sn[1] *= snare_gain;
-  sample snQ = flatq; // resonance
+  sample snQ = 10; // resonance
   sample snHz = 600; // pitch
   sn[0] = vcf(&s->snarevcf[0], snQ * sn[0], snHz, snQ); // filter
   sn[1] = vcf(&s->snarevcf[1], snQ * sn[1], snHz, snQ);
diff @ 2022-01-11 15:59:13 +0000
diff --git a/client/go.c b/client/go.c
index 501f8f3..f5bffd9 100644
--- a/client/go.c
+++ b/client/go.c
@@ -57,7 +57,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   sample kkQ = 10; // resonance
   sample kkHz = 60 + 0 * 10 * floor(4 * t); // pitch, quantisation in value
   kick = biquad(highpass(&s->kickbq, kkHz, kkQ), kick); // filter
-#if 0 // change 0 to 1 to enable
+#if 1 // change 0 to 1 to enable
   kick = tanh(2 * kick); // distortion
 #endif
   mixdown[0] += kick;
diff @ 2022-01-11 15:59:17 +0000
diff --git a/client/go.c b/client/go.c
index f5bffd9..5c73251 100644
--- a/client/go.c
+++ b/client/go.c
@@ -54,7 +54,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   kick = kick * sin(12 * twopi * kick); // shape into waveform
   sample kick_gain = 1; // amplify before filters for smoothness
   kick *= kick_gain;
-  sample kkQ = 10; // resonance
+  sample kkQ = 20; // resonance
   sample kkHz = 60 + 0 * 10 * floor(4 * t); // pitch, quantisation in value
   kick = biquad(highpass(&s->kickbq, kkHz, kkQ), kick); // filter
 #if 1 // change 0 to 1 to enable
diff @ 2022-01-11 15:59:19 +0000
diff --git a/client/go.c b/client/go.c
index 5c73251..caf9844 100644
--- a/client/go.c
+++ b/client/go.c
@@ -54,7 +54,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   kick = kick * sin(12 * twopi * kick); // shape into waveform
   sample kick_gain = 1; // amplify before filters for smoothness
   kick *= kick_gain;
-  sample kkQ = 20; // resonance
+  sample kkQ = 40; // resonance
   sample kkHz = 60 + 0 * 10 * floor(4 * t); // pitch, quantisation in value
   kick = biquad(highpass(&s->kickbq, kkHz, kkQ), kick); // filter
 #if 1 // change 0 to 1 to enable
diff @ 2022-01-11 15:59:20 +0000
diff --git a/client/go.c b/client/go.c
index caf9844..13875b8 100644
--- a/client/go.c
+++ b/client/go.c
@@ -54,7 +54,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   kick = kick * sin(12 * twopi * kick); // shape into waveform
   sample kick_gain = 1; // amplify before filters for smoothness
   kick *= kick_gain;
-  sample kkQ = 40; // resonance
+  sample kkQ = 80; // resonance
   sample kkHz = 60 + 0 * 10 * floor(4 * t); // pitch, quantisation in value
   kick = biquad(highpass(&s->kickbq, kkHz, kkQ), kick); // filter
 #if 1 // change 0 to 1 to enable
diff @ 2022-01-11 15:59:22 +0000
diff --git a/client/go.c b/client/go.c
index 13875b8..414e2dd 100644
--- a/client/go.c
+++ b/client/go.c
@@ -54,7 +54,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   kick = kick * sin(12 * twopi * kick); // shape into waveform
   sample kick_gain = 1; // amplify before filters for smoothness
   kick *= kick_gain;
-  sample kkQ = 80; // resonance
+  sample kkQ = 100; // resonance
   sample kkHz = 60 + 0 * 10 * floor(4 * t); // pitch, quantisation in value
   kick = biquad(highpass(&s->kickbq, kkHz, kkQ), kick); // filter
 #if 1 // change 0 to 1 to enable
diff @ 2022-01-11 15:59:31 +0000
diff --git a/client/go.c b/client/go.c
index 414e2dd..34d8fe1 100644
--- a/client/go.c
+++ b/client/go.c
@@ -80,7 +80,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   sn[0] = sin(4 * sn[0]); // distortion
   sn[1] = sin(4 * sn[1]);
   // quantisation in time (bit-crush effect)
-  if (0) // change 0 to 1 to enable
+  if (1) // change 0 to 1 to enable
   {
     sample crush = phasor(&s->crush, 4000 * pow(1, cos(twopi * t)));
     sn[0] = samphold(&s->snaresh[0], sn[0], crush);
diff @ 2022-01-11 15:59:46 +0000
diff --git a/client/go.c b/client/go.c
index 34d8fe1..55d5c46 100644
--- a/client/go.c
+++ b/client/go.c
@@ -52,7 +52,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   sample kick = 1 - beat; // descending ramp
   kick = pow(kick, 8); // make curved
   kick = kick * sin(12 * twopi * kick); // shape into waveform
-  sample kick_gain = 1; // amplify before filters for smoothness
+  sample kick_gain = 0; // amplify before filters for smoothness
   kick *= kick_gain;
   sample kkQ = 100; // resonance
   sample kkHz = 60 + 0 * 10 * floor(4 * t); // pitch, quantisation in value
@@ -82,7 +82,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   // quantisation in time (bit-crush effect)
   if (1) // change 0 to 1 to enable
   {
-    sample crush = phasor(&s->crush, 4000 * pow(1, cos(twopi * t)));
+    sample crush = phasor(&s->crush, 4000 * pow(2, cos(twopi * t)));
     sn[0] = samphold(&s->snaresh[0], sn[0], crush);
     sn[1] = samphold(&s->snaresh[1], sn[1], crush);
   }
diff @ 2022-01-11 15:59:53 +0000
diff --git a/client/go.c b/client/go.c
index 55d5c46..7fd86c2 100644
--- a/client/go.c
+++ b/client/go.c
@@ -118,7 +118,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
 
   // feedin from mix, feedback to mix and delays
   sample feedin = 1;
-  sample feedback = 0;
+  sample feedback =10;
   mixdown[0] *= feedin;
   mixdown[1] *= feedin;
   del[0] *= feedback;
diff @ 2022-01-11 16:00:01 +0000
diff --git a/client/go.c b/client/go.c
index 7fd86c2..cc2eef2 100644
--- a/client/go.c
+++ b/client/go.c
@@ -52,7 +52,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   sample kick = 1 - beat; // descending ramp
   kick = pow(kick, 8); // make curved
   kick = kick * sin(12 * twopi * kick); // shape into waveform
-  sample kick_gain = 0; // amplify before filters for smoothness
+  sample kick_gain = 1; // amplify before filters for smoothness
   kick *= kick_gain;
   sample kkQ = 100; // resonance
   sample kkHz = 60 + 0 * 10 * floor(4 * t); // pitch, quantisation in value
diff @ 2022-01-11 16:00:15 +0000
diff --git a/client/go.c b/client/go.c
index cc2eef2..f02d8a2 100644
--- a/client/go.c
+++ b/client/go.c
@@ -117,7 +117,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   }
 
   // feedin from mix, feedback to mix and delays
-  sample feedin = 1;
+  sample feedin = 0;
   sample feedback =10;
   mixdown[0] *= feedin;
   mixdown[1] *= feedin;
diff @ 2022-01-11 16:00:22 +0000
diff --git a/client/go.c b/client/go.c
index f02d8a2..834d15c 100644
--- a/client/go.c
+++ b/client/go.c
@@ -127,10 +127,10 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   del[1] += mixdown[1];
 
   // dynamic range compression with band pass filter
-  del[0] = hip(&s->hip[0], del[0], 10); // high pass
-  del[1] = hip(&s->hip[1], del[1], 10);
-  del[0] = lop(&s->lop[0], del[0], 10000); // low pass
-  del[1] = lop(&s->lop[1], del[1], 10000);
+  del[0] = hip(&s->hip[0], del[0], 100); // high pass
+  del[1] = hip(&s->hip[1], del[1], 100);
+  del[0] = lop(&s->lop[0], del[0], 1000); // low pass
+  del[1] = lop(&s->lop[1], del[1], 1000);
   compress(del, &s->compress, 10, 1, 1, 48, del);
 
   // write to delay lines
diff @ 2022-01-11 16:00:29 +0000
diff --git a/client/go.c b/client/go.c
index 834d15c..9d287a8 100644
--- a/client/go.c
+++ b/client/go.c
@@ -117,8 +117,8 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   }
 
   // feedin from mix, feedback to mix and delays
-  sample feedin = 0;
-  sample feedback =10;
+  sample feedin = 1;
+  sample feedback = 1;
   mixdown[0] *= feedin;
   mixdown[1] *= feedin;
   del[0] *= feedback;
diff @ 2022-01-11 16:00:44 +0000
diff --git a/client/go.c b/client/go.c
index 9d287a8..5c87acd 100644
--- a/client/go.c
+++ b/client/go.c
@@ -93,8 +93,8 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   s->delay1.length = 4 * SR; // should match delay1buf array size
   s->delay2.length = 4 * SR; // should match delay2buf array size
   sample ms[2] = // delay times in milliseconds per beat * fractions of a beat
-    { (1000 * 60 / s->bpm) * (wrap(1 * t) < 1 ? 4. / 4 : 1. / 64)
-    , (1000 * 60 / s->bpm) * (wrap(2 * t) < 1 ? 4. / 4 : 1. / 48)
+    { (1000 * 60 / s->bpm) * (wrap(1 * t) < 1 ? 4. / 3 : 1. / 64)
+    , (1000 * 60 / s->bpm) * (wrap(2 * t) < 1 ? 4. / 3 : 1. / 48)
     };
   ms[0] = lop(&s->lag[0], ms[0], 3); // make changes gradual
   ms[1] = lop(&s->lag[1], ms[1], 3);
@@ -118,7 +118,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
 
   // feedin from mix, feedback to mix and delays
   sample feedin = 1;
-  sample feedback = 1;
+  sample feedback = 10;
   mixdown[0] *= feedin;
   mixdown[1] *= feedin;
   del[0] *= feedback;
diff @ 2022-01-11 16:01:04 +0000
diff --git a/client/go.c b/client/go.c
index 5c87acd..39b99ce 100644
--- a/client/go.c
+++ b/client/go.c
@@ -52,7 +52,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   sample kick = 1 - beat; // descending ramp
   kick = pow(kick, 8); // make curved
   kick = kick * sin(12 * twopi * kick); // shape into waveform
-  sample kick_gain = 1; // amplify before filters for smoothness
+  sample kick_gain = ; // amplify before filters for smoothness
   kick *= kick_gain;
   sample kkQ = 100; // resonance
   sample kkHz = 60 + 0 * 10 * floor(4 * t); // pitch, quantisation in value
@@ -64,7 +64,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   mixdown[1] += kick;
 
   // simple snare drum
-  sample snare = 1 - wrap(2 * bar + 0.5); // ramp
+  sample snare = 1 - (4 * bar - 0.666); // ramp
   snare = pow(snare, 16); // make curved
   sample sn[2] = // shape into waveform
     { snare * noise()
diff @ 2022-01-11 16:01:05 +0000
diff --git a/client/go.c b/client/go.c
index 39b99ce..bc2783f 100644
--- a/client/go.c
+++ b/client/go.c
@@ -52,7 +52,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   sample kick = 1 - beat; // descending ramp
   kick = pow(kick, 8); // make curved
   kick = kick * sin(12 * twopi * kick); // shape into waveform
-  sample kick_gain = ; // amplify before filters for smoothness
+  sample kick_gain = 0; // amplify before filters for smoothness
   kick *= kick_gain;
   sample kkQ = 100; // resonance
   sample kkHz = 60 + 0 * 10 * floor(4 * t); // pitch, quantisation in value
diff @ 2022-01-11 16:01:11 +0000
diff --git a/client/go.c b/client/go.c
index bc2783f..45c0fa3 100644
--- a/client/go.c
+++ b/client/go.c
@@ -64,7 +64,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   mixdown[1] += kick;
 
   // simple snare drum
-  sample snare = 1 - (4 * bar - 0.666); // ramp
+  sample snare = 1 - wrap(4 * bar - 0.666); // ramp
   snare = pow(snare, 16); // make curved
   sample sn[2] = // shape into waveform
     { snare * noise()
diff @ 2022-01-11 16:01:20 +0000
diff --git a/client/go.c b/client/go.c
index 45c0fa3..53ab16f 100644
--- a/client/go.c
+++ b/client/go.c
@@ -52,9 +52,9 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   sample kick = 1 - beat; // descending ramp
   kick = pow(kick, 8); // make curved
   kick = kick * sin(12 * twopi * kick); // shape into waveform
-  sample kick_gain = 0; // amplify before filters for smoothness
+  sample kick_gain = 1; // amplify before filters for smoothness
   kick *= kick_gain;
-  sample kkQ = 100; // resonance
+  sample kkQ = 10; // resonance
   sample kkHz = 60 + 0 * 10 * floor(4 * t); // pitch, quantisation in value
   kick = biquad(highpass(&s->kickbq, kkHz, kkQ), kick); // filter
 #if 1 // change 0 to 1 to enable
diff @ 2022-01-11 16:01:35 +0000
diff --git a/client/go.c b/client/go.c
index 53ab16f..5fe11c0 100644
--- a/client/go.c
+++ b/client/go.c
@@ -82,7 +82,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   // quantisation in time (bit-crush effect)
   if (1) // change 0 to 1 to enable
   {
-    sample crush = phasor(&s->crush, 4000 * pow(2, cos(twopi * t)));
+    sample crush = phasor(&s->crush, 2000 * pow(2, cos(twopi * t)));
     sn[0] = samphold(&s->snaresh[0], sn[0], crush);
     sn[1] = samphold(&s->snaresh[1], sn[1], crush);
   }
diff @ 2022-01-11 16:01:36 +0000
diff --git a/client/go.c b/client/go.c
index 5fe11c0..b4b7292 100644
--- a/client/go.c
+++ b/client/go.c
@@ -82,7 +82,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   // quantisation in time (bit-crush effect)
   if (1) // change 0 to 1 to enable
   {
-    sample crush = phasor(&s->crush, 2000 * pow(2, cos(twopi * t)));
+    sample crush = phasor(&s->crush, 1000 * pow(2, cos(twopi * t)));
     sn[0] = samphold(&s->snaresh[0], sn[0], crush);
     sn[1] = samphold(&s->snaresh[1], sn[1], crush);
   }
diff @ 2022-01-11 16:01:49 +0000
diff --git a/client/go.c b/client/go.c
index b4b7292..ab3ffca 100644
--- a/client/go.c
+++ b/client/go.c
@@ -117,7 +117,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   }
 
   // feedin from mix, feedback to mix and delays
-  sample feedin = 1;
+  sample feedin = 0;
   sample feedback = 10;
   mixdown[0] *= feedin;
   mixdown[1] *= feedin;
diff @ 2022-01-11 16:01:58 +0000
diff --git a/client/go.c b/client/go.c
index ab3ffca..da4627a 100644
--- a/client/go.c
+++ b/client/go.c
@@ -140,7 +140,7 @@ int go(S *s, int inchannels, const float *in, int outchannels, float *out) {
   mixdown[1] += del[1];
   
   // output stereo audio
-  sample volume = 0.25;
+  sample volume = 0.;
   for (int c = 0; c < outchannels && c < 2; ++c) {
     out[c] = tanh(volume * mixdown[c]); // clip
   }

the end