This is so passé... wrong is the new right.krabbencutter said:True. And if you need more than 20dB compression you're either doing something wrong, or you need an 1176 ;D
This is so passé... wrong is the new right.krabbencutter said:True. And if you need more than 20dB compression you're either doing something wrong, or you need an 1176 ;D
abbey road d enfer said:B) I often use 40+dB of compression; why? Because I can. Check the piano at the end of "A day in the life".
Yes; isn't it a form of compression?ruffrecords said:As I understand a lot of live fader riding was done during the take.
Cheers
Ian
If you put 5V DC on a fader and ride it 100.000 times a second it's also PWM ;Dabbey road d enfer said:Yes; isn't it a form of compression?
To go back on topic: thanks for the insight!squarewave said:I like it. But you could improve the parts a LOT. A regular ol' 74H cmos chip is going to give you distortion. Something high voltage with low on resistance (Ron) and good on resistance flatness would be better. Like MAX4600 (and with that particular chip you wouldn't need an inverter because it's dual SPST with one NO and and one NC). With low Ron and +-15V circuit you could get the noise and distortion very low. You could also use an LCL filter to get a 3 pole filter, keep the characteristic impedance low and use small passive parts. The PWM at 60kHz could be fine but any jitter in the PWM could be an issue. It might be worth while using a high speed PWM IC and run a 600kHz. If you do all of those things, it could perform very well. But of course when pushing the envelope with parts like I suggest you will run into unexpected problems. For example, the gate capacitance of the MAX4600 is very high at over 500pF. In theory it should not matter in this particular case (might even be good) but it is high.
int pwm = 64;
void setup() {
TCCR2A = 0b10110011;
TCCR2B = 0b0000001;
}
void loop() {
analogWrite(3, pwm);
analogWrite(11, pwm);
}
krabbencutter said:True. And if you need more than 20dB compression you're either doing something wrong, or you need an 1176 ;D
But I guess the -60dB came up, because you could also use PWM for a mixer circuit. But besides the switching speedm clock speed would be another constraint. As PWM resolution decreases drastically the lower you go -40dB already equals 1% Pulse Width. So to get 100KHz switching speed with 16bit PWM resolution would a require a 6,5GHZ clock, if I'm not mistaken.
You don't need it to be that fast. Because of aliasing effects, you can get a very accurate level without getting even to 20kHz.krabbencutter said:Unfortunately the Arduino's ADC only has a 10KHz sampling rate.
#define ADCMUX_PS_32 0b101
#define ADCMUX_PRESCALER ADCMUX_PS_32
const uint8_t C_ADCSRA = (1 << ADEN) | (1 << ADSC) | (1 << ADATE) | (1 << ADIF) | ADCMUX_PRESCALER;
const uint8_t C_ADMUX = (1 << REFS0);
init()
{
ADCSRB = ADHSM | 0x00;
ADMUX = C_ADMUX;
ADCSRA = C_ADCSRA | (1 << ADSC);
// setup ADC pins ... or not
// these are chip pin numbers not Arduino labels
DIDR0 = (1 << lopin);
DIDR2 = (1 << (hipin - 8));
}
loop()
{
// do stuff
// check if sample ready
while (!(ADCSRA & (1 << ADIF)));
uint32_t aval;
ADCSRA = C_ADCSRA;
aval = ADCL & 0xff;
aval |= (ADCH & 0x3) << 8;
// factor aval into your running value
}
WARNING: This code is just condensed fragments from file so it's definitely not going to run correctly unless you study the datasheet and compensate accordingly.
Note that the 60dB limit is theorized based on the switching speed. But one could switch the PWM to completely 0 in which case you go from that limit to something much deeper which could certainly qualify as "deep kill". That's sort of how a fader works anyway.JohnRoberts said:Indeed for simple compression /limiting you should be able to get away with say 20-30 dB of attenuation. Fader automation OTOH requires deep kill.
I wonder why you have to do that; the time-constant is supposed to take care of that.krabbencutter said:I need to use some averaging method, to get a stable peak value. The easiest way would be to add 4 samples and divide the value by 4.
Again, why do you need a hold function? This should be integral to the TC algorithm.- to keep things simple I'll start with some fixed compression & time constants. The envelope will be a simple hold value without retriggering
#define DMATE 16
uint32_t dmate = 0;
uint32_t bq0 = 0;
uint32_t bq1 = 0;
uint32_t bq2 = 0;
uint32_t rval = 0; // running value
add_sample(struct context *ctx, uint32_t aval)
{
// rectify
if (aval >= 511) {
aval -= 511;
} else {
aval = 511 - aval;
}
// scale up to make integer math more accurate
aval *= AMULT;
// decimation
dmate = dmate * (DMATE - 1) + aval / DMATE;
// biquad filter
bq0 = bq1;
bq1 = bq2;
bq2 = (DMATE - 93 * bq0 + 218 * bq1) / 128; // beware can go neg
rval = (bq0 + bq2) + 2 * bq1;
}
NOTES: I just typed this in "freestyle" so adjust as necessary. Bi-quad filter values are non-sense. You need to compute that somehow (using an online calculator for example).
Enter your email address to join: