Skip to content

Commit 4e0bf26

Browse files
Merge pull request #111 from chrisgjohnson/main
Reverb -> v1.3, improved DC blocking
2 parents c37716e + b55803c commit 4e0bf26

4 files changed

Lines changed: 15 additions & 13 deletions

File tree

releases/20_reverb/reverb.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
const CARD_ID_LOW = 20;
9797
const CARD_ID_HIGH = 0;
9898
const CARD_VER_MAJOR = 1;
99-
const CARD_VER_MINOR = 2;
99+
const CARD_VER_MINOR = 3;
100100

101101
function AdjustSpans(e)
102102
{

releases/20_reverb/reverb_dsp.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ int32_t __not_in_flash_func(buffer_read)(buffer *db, uint16_t tapId, uint16_t t)
102102
return db->buffer[(t + db->readOffset[tapId]) & db->mask];
103103
}
104104

105-
105+
typedef int32_t multiplier_type;
106106

107107
// Allpass filter
108108
int32_t __not_in_flash_func(allpass_process)(buffer *db, uint16_t t, int32_t gain, int32_t in)
@@ -113,11 +113,11 @@ int32_t __not_in_flash_func(allpass_process)(buffer *db, uint16_t t, int32_t gai
113113
gain >>= 4;
114114

115115
int32_t delayed = buffer_read(db, TAP_MAIN, t);
116-
in += ((delayed * -gain) >> 12);
116+
in += ((delayed * -gain + 2048) >> 12);
117117
// in = clamp(in, -16383, 16383);
118118

119119
buffer_write(db, t, in);
120-
return delayed + ((in * gain) >> 12);
120+
return delayed + ((in * gain + 2048) >> 12);
121121
}
122122

123123

@@ -131,14 +131,14 @@ where f_s is the sample rate
131131
*/
132132
int32_t __not_in_flash_func(lowpass_process)(int32_t *out, int32_t b, int32_t in)
133133
{
134-
*out += (((in - *out) * b) >> 16);
134+
*out += (((in - *out) * b + 32768) >> 16);
135135
return *out;
136136
}
137137

138138
// Highpass, as above
139139
int32_t __not_in_flash_func(highpass_process)(int32_t *out, int32_t b, int32_t in)
140140
{
141-
*out += (((in - *out) * b) >> 16);
141+
*out += (((in - *out) * b + 32768) >> 16);
142142
return in - *out;
143143
}
144144

@@ -357,16 +357,18 @@ void __not_in_flash_func(reverb_process)(reverb *v, int32_t in)
357357
// This almost certainly doesn't eliminate wrapping entirely, but helps avoid it
358358
for (int i = 0; i < 2; i++)
359359
{
360-
// ~23Hz input HPF, to cancel any input DC offset
361-
if (i == 0)
362-
x1 = highpass_process(&v->acCouplingHPF, 200, x);
363-
else
364-
x1 = x;
365360

366361
// Add cross feedback
367-
x1 = x1 + ((buffer_read(&v->postDampingDelay[1 - i], TAP_MAIN, v->t) * v->decayAmount) >> 16);
362+
x1 = x + ((buffer_read(&v->postDampingDelay[1 - i], TAP_MAIN, v->t) * v->decayAmount) >> 16);
368363
x1 = clamp(x1, -16383, 16383);
369364

365+
// 11 Hz DC-blocking HPF once within figure-of-eight
366+
if (i == 0)
367+
{
368+
x1 = highpass_process(&v->acCouplingHPF, 100, x1);
369+
x1 = clamp(x1, -16383, 16383);
370+
}
371+
370372
// Process single half of the tank
371373
x1 = allpass_process(&v->decayDiffusion1[i], v->t, -v->decayDiffusion1Amount, x1);
372374
// x1 = clamp(x1, -16383, 16383);

releases/20_reverb/sysex_sentences.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,4 +287,4 @@
287287
#define CARD_ID_LOW 20
288288
#define CARD_ID_HIGH 0
289289
#define CARD_VER_MAJOR 1
290-
#define CARD_VER_MINOR 2
290+
#define CARD_VER_MINOR 3

0 commit comments

Comments
 (0)