EQ and Math

Jeff - Perhaps you (and / or I) could care to expand a little more on how analogue gets converted into digital?

Your explanation was great, however, the briefness which you covered A/D maybe of interest to expand upon? Not sure if people want to know more but it is interesting for some.

[pm me if you want my details (height, weight, shoe size etc)]
 
Most recent thread bump: MIT's Open CourseWare kicks all kinds of ass, so check out whatever they have in EE. If the equations and procedures seem too hard, try programming (and properly commenting!) them yourself - no book will come close to that.

Jeff - Perhaps you (and / or I) could care to expand a little more on how analogue gets converted into digital?

Your explanation was great, however, the briefness which you covered A/D maybe of interest to expand upon? Not sure if people want to know more but it is interesting for some.

[pm me if you want my details (height, weight, shoe size etc)]

You can go ahead and start, I doubt I'll have much time for that - my interests have gone about as far from this as possible, and what I had prepared for this is just total rubbish.

Jeff
 
Not really a tutorial, but a little insight in how to turn an analog filter into a digital one..

a filter (lowpass/higpass etc) can be derived from an analog design by taking it's transfer function.. (Vout/Vin)

250px-1st_Order_Lowpass_Filter_RC.svg.png


The Laplace transform is a tool for electrical engineers, in short: you substitute differential equations by the complex variable 's'.. not going into that one here ;)
The transfer function of a one pole lowpass filter in the Laplace domain: H(s) = 1/(1+C*R*s)
Can be turned into a digital filter by the bilinear transform: s = 2/T * (z-1)/(z+1), where T is the time step, 1/samplerate.
after the filter is transfered from the s domain(analog) to the Z domain(digital) by the BLT it looks something like this:

H(z) = T*(z+1) / (T*z+2*C*R*z+T-2*C*R) ...... (z = sample delay, 1 = current sample)

Which can be translated into a difference equation:
(T-2*C*R)*out1+(T+2*C*R)*out0 = T*in1+T*in0

and we solve for out0 ..:
out0 = (T*in1+T*in0-(T-2*C*R)*out1) / (T+2*C*R)

and to use the filter we need a function:
(C++)
double lowpass(double Input)
{
in1 = in0; //Remember the last input sample
in0 = input; //Insert the new sample
out1 = out0; //Remember the last output value
out0 = (T*in1+T*in0-(T-2*C*R)*out1)/(T+2*C*R) //Calculate the filter response
return out0;
}

This code is not optimized, and it's just for demonstration..
and yeah, just insert the R (resistor) and C (capacitor) values and you have a lowpass filter :P Complicated? :lol:
(Wikipedia is your friend)
 
boost bass, cut bass, boost mids, cut mids, boost highs , cut highs..................................everything else is really just a variation.
 
Heres something that may be off-topic on this thread but :bah: do you guys ever find that, for example... if you have like a lot of harshness at 2.89Khz that you will have some mud or resonance at 289 Hz?
I *sometimes* find this to be the case and I'm curious wether its coincidence or not.
 
Okay...

...

FUCK!

You already pointed that out! It isn't even relevant! Every fucking goddamned time someone brings up 'math' - and yes, I just said math! - someone has to say 'maths' AND THIS CONTRIBUTES NOTHING AT ALL! It's not even like someone's using the wrong their/they're/there or is saying 'could of' instead of 'could have'... maybe the first time someone said 'math' instead of 'maths' it would have been somehow relevant BUT EVERYONE IN ONE OF THE ONLY TWO ENGLISH SPEAKING COUNTRIES THAT COUNT (Fuck you, Canada! I'm caffeinated as balls!) says MATH! It simply is not relevant! There are very important things to discuss here AND THE LETTER S IS NOT (Fuck you, too, Sesame Street!) ONE OF THEM! And if one of you so much as thinks about replacing 'math' in my post with 'maths' or offering some other such suggestion, I will make your fucking head explode with several books on analytic number theory. If you're lucky. Just pray that I'm not in the mood for differential topology, grammar whores. I am fucking wired and you will not be amused. Do you tell a physicist that centrifugal force doesn't exist? No, because he will strap you to a rotating reference frame and make you wish it fucking didn't. Do you tell a linguist that a preposition is a horrible thing to end a sentence with? No, because talking to them fucking sucks. So, paying no mind to being polite or humble, there is quite clearly a similar reason not to correct people who say 'math' - I will fucking math you to death. Let's move on.

First, just to make sure everyone ('maths'-crackpots and others alike) is on the same page, here's how JBroll thinks of voltage. The fancy-pants definition basically says that a voltage is a potential difference between two sources - so on one side of the voltage a charged particle (electron, proton, positron, credit card after she-who-guards-the-snatch gets her way) there is something that can be gained from going to the other side (like when we deal with the motion of charged particles through fields with potential and the potential becomes kinetic energy), but it's not as quite intuitive as lemmings jumping off a cliff. How are lemmings jumping off a cliff intuitive? I might just tell you. I'm still wired as fuck. That last paragraph took twenty seconds. I'm not going anywhere.

Here's what happens when a lemming jumps off a cliff: the lemming has a sudden attack of the dumbass and decides that it would be fun to walk around on the invisible ground in front of him. Yes, I'm being sexist and assuming that the lemming jumping off the cliff is a male, so deal with it. He goes to the invisible ground, finds that it is also immaterial ground, and begins falling. Eventually he hits the ground and, for the vast majority of possible cliffs, makes a splat at the bottom of size roughly indicative of the height of the cliff. The height of the cliff is the voltage - your lemming can gain (temporarily) kinetic energy by jumping off the cliff. Note here that generally the higher the cliff the bigger the splat.

Now, say we have a whole hell of a lot of lemmings jumping off the cliff. What do we have? A current. Formally, a current is the move of electric charge. We have our lemmings (electrons) moving through a region where their potential energy (height, multiplied by a constant for gravity) becomes potential energy (related to the time spent falling and the same constant for gravity), and then they go splat on the ground.

If there is something blocking the lemmings, like a concerned larger creature of some kind or a fence put up by such a concerned larger creature, there will be fewer lemmings making smooshy messes on the ground below. This is resistance - a suitable name. So if fewer lemmings jump down the cliff there's going to be less splat on the ground.

The formula relating voltage (V, SI unit Volts), current (I, SI unit ampere), and resistance (R, SI unit ohms) is V=IR. Therefore, increasing the height of the cliff and not putting up a fence of some kind or reducing the blockage without changing the cliff's height makes a bigger splat, and vice versa.

To restate the original definition of voltage, when there is a potential difference between two regions we say that the voltage is the amount of this potential difference. Simpler with lemmings jumping off a cliff, no?

Then, you need to understand how the audio gets turned into a digital signal. Long story short, what you're going to see is very often just a logic circuit that figures out some way of accepting an input voltage and then finding some way of roughly representing it compared to a reference voltage so that it can express things as a fraction of said reference voltage. If you have something going in with a higher voltage than the reference voltage, you have clipping. We avoid clipping. Let's pretend it doesn't exist.

Now, we have to keep in mind that audio signals are AC current. The lemming example above is, for stationary cliffs, an explanation of DC voltage. AC voltage is like that, but not - it alternates between a high point and a low point. We don't need to take the lemmings any farther, unless you'd like them to have bungee cords attached to a large pole or something - that analogy has served its purpose, though, so I'll stop with that nonsense. So when you have alternating current, it alternates at some frequency (or combination thereof - but shut up and work with me and we'll pretend that we can have just one), and that frequency corresponds directly to sound of some kind. This frequency is measured in Hertz (or some multiple thereof), which is just 1/s - this is just the number of cycles/beats/whatever per second. Sound, however, doesn't happen as just a single wave of this form - it's pretty much going to have to be a combination of them - so what we have is a superposition (or sum, or combination) of several different waves. So our chip is trying to figure out what potential difference a practically infinite sum of waves has at any given point in time, and by doing this thousands of times per second it gets enough data to interpolate a rough guess of what it was that it just recorded. Interpolation (the process of generating a function from a collection of points) is a whole different ball of wax, so look that one up elsewhere. Long story short, our DAW pulls everything between the collected points out of its ass and decides that some (possibly somewhat different, but usually really fucking close) other collection of waves is our signal.

Now, there are a lot of ways of actually doing equalization digitally, so for convenience I'm going to look at high-pass and low-pass individually and extrapolate from them ways of doing everything else. I'm going to steal an image from Wikipedia to show the basic electronic high-pass and low-pass filters.

Rc_divider.png


Here's a low-pass - it sucks things out above a frequency related to the inverse of the product of the resistance and capacitance chosen (depending on whether you use Hz or radians/sec it'll be either 1/2piRC or 1/RC), and

210px-High_pass_filter.svg.png


is a high-pass filter, sucking out everything below a given frequency (again, 1/2piRC or 1/RC, depending on units)... the rate at which things drop changes between different implementations, but basically that's where things come from in the analog world. What we have to do with computers is discretize this... and I'm unfortunately not anywhere near wired enough to go into this one, so that'll be a post in the near future. Anyway, let's break and go on to the next thing.

What we can now generate from a low-pass and a high-pass is a hump. Not just any hump... the kind of hump we like to see on our graphic EQs. If we high-pass and low-pass at a given frequency we have a curve that is at its peak around that frequency and that decreases quickly as we go farther away. This means that we can boost individual frequencies with ease. Now, you ask, what about cutting frequencies? Simply take a hump and invert it, and you have a hump that goes in the other direction so you perceive a cut. The final frontier is then the shelf... or is it? Simply add a high-passed or low-passed chunk o' signal to what you already have, and you might like what you hear.

Thus, pending a possibly unnecessary discussion on discretizing functions, and a bit of work going into more technical details with more obvious mathematical reasoning, we have EQ.

DISCLAIMER: I'm not pissed at anyone... except you, you fucking lemmings, if you all go off and wind up extinct I'm going to be fucked, so don't even think of disappearing on me. Bastards. Again, I'm just wired as fuck...

Started writing this on Future Breed Machine. DEI isn't half over yet. Fuck me running. Oh, well, more later.

Jeff
<3
 
Jeff, you could make an awesome lecturer one day!!

Can't wait for some more on this, I'm comfortable with the physics but have never really considered the mechanisms of audio circuits in detail
 
If I do fill that in, I'll need a bit of help. As I mentioned above, I've already tossed my previous draft out the window and don't have much as much time as I used to.

Jeff
 
'Now, there are a lot of ways of actually doing equalization digitally, so for convenience I'm going to look at high-pass and low-pass individually and extrapolate from them ways of doing everything else.'

Why are you describing digital in terms of an analogue circuit apart from the use of the equations? As an emulation for the design in digital?


Those 'hump's are frequency response curves which are known as bode plots, for anyone who was interested. You get a gain vs frequency plot and a phase vs frequency plot. I don't see why you are just like 'you get the hump and invert it' without actually explaining how it's done and can't believe you haven't mentioned fourier in that entire post :P.

Also noodles, digital to analogue conversion comes from sampling, taking parts of the signal at points *sampling rate* and representing them 1's and 0's. If you're interested in that i suggest looking up nyquist theory and DSP as there is already linked.
 
Digital things tend to be discrete, but not so discrete that continuous descriptions are inaccurate enough for concern - whatever we're concerned about is (hopefully) so close to analogue that we've no reason to worry about much else. In any case, names are amazingly useless compared to technical information, and I figured that if I could describe anything then function was more important - and, of course, if I couldn't describe anything then I'd just be an ass if I threw names around.

As far as not mentioning Fourier transforms (and I am a little amused that so many people refer to the many FTs as if there were just one)... in my post, at least, that was meant to be a later writeup that wound up being postponed indefinitely because prettier things happened. I'm busy with other scary things, so - and I am perfectly sincere when I say this - if you want to help make something better (and that would not be a hard task at all, especially considering that as of the last *big* post I was an undergraduate who didn't drink and was fine with putting off serious details for later) then let me know and we'll start something more serious.

Finally, in case I didn't touch on it earlier... the distinction between 'math' and 'maths' is not a matter of Yanks vs. Brits so much as a matter of different ways of looking at mathematics - it's not just an abuse of the lovely, wonderful language of proper English *at all*, it's a matter of seeing all of mathematics as individual facets of one amazing whole, so prepare for whatever comes next by trying to figure out what that means.

Jeff