## the Convolution – part 1 of 2

31/10/2012 § 2 Comments

This part is about the definition and feeling of Convolution. Part 2 of 2 is implementation (in a programming language)

There is a mathematical definition and then there is *the visual definition*.

To be honest – I can’t visualize what that integration or summation is really trying to do. So, lets play with basics.

**what is convolution**

You can get a ‘word-to-word’ definition out there somewhere. But let’s try to *see* it rather than trying to be *verbally correct*.

What happens to an ‘impulse’ when it passes through a ‘channel’ is called ‘impulse response’ of that ‘channel’. Impulse response is just a way a channel behaves when its excited with unit impulse. In a sense, impulse response’ models the ‘channel’. The process of knowing the channel behavior given impulse response and input signal is convolution. Pretty straightforward, right ? Then how did scientists managed to get that complicated’ formula for such a simple thing ? You’ll know that once you manage to visualize it. 😉

**experimentation**

To visualize convolution there are pretty good tools out there, but we want to learn basics so lets not complicate the situation and use this tool. Forget the theory, get to the interactive Java applet, let’s experiment. x[n] is input signal and y[n] is output signal.

1. Choose x[n] as a unit impulse (second last from right) and y[n] as unit impulse (second last from right). Convolve it, we observe that at n = 0 output is 1 and 0 elsewhere.

2. Choose x[n] as unit impulse and y[n] as the first signal from left. Convolve it. This time we have non zero output even at time beyond n = 0, even though the input excitation was given only at time n = 0. Why so ? This is because the channel, y[n], tends to remember the input till 3 seconds after the input excitation is given. This is a kind of ‘memory’ that this channel has. Other way to see it is that the effect of single impulse of excitation lasts for 4 seconds. How does it matter ? Lets see.

3. Keep y[n] same as in last experiment. Choose x[n] as the first signal from left. This time the input excitation will not last for just 1 second but for 3 seconds. Don’t convolve yet! Try and think what should happen. Channel keeps memory of each input till 3 seconds… that means total excitation at a given instant will be the sum of excitation produced by current impulse and the memory of excitation of previous impulses. Think about it for a while and then go ahead with the convolution. Can you see it ? Can you feel it ? If no, write a comment down there in comment box and I’ll get back to you. And do not proceed till you can see it from eye of your mind.

4. So you can feel it, cool! Try convolving all different combinations and before you see the result on screen try to draw it on a paper using your gut feeling. It’ll take sometime but you’ll get it. You’ll also realize that if you interchange x[n] and y[n] the output remains same. That means convolution doesn’t care what is input and what the channel response, all it know is the basic maths which even you, now, understand. 🙂

5. Now that you can see it and feel it, let’s try to write this ‘gut feeling’ in form of a mathematical expression. Not a big deal, really.Lets see what we want to do:

- channel keeps memory
- total excitation at any given moment is the sum of memory that channel has and excitation of in coming signal
- hmm.. that means for excitation at a given instant I need value of current excitation and sum of values of past excitations which depends on how channel ‘remembers’ them.
- so, for a given instance n, I should know what has happened from n-1 th instance to instance till which channel can remember.
- take a paper and a pen, and try to write what you can feel.
*I am running out of words to express my feeling, probably I’ll get back later when I can find words to express it*. Once you are done you’ll realize that you are thinking what that ‘complicated’ formula wants you to think.

So, now you see how a simple gut feeling can take form of complicated mathematical equation.

## lets begin… the Basics

30/10/2012 § 1 Comment

Before I start, we need to know some basic stuff.

**types of signals**

Signal is physical quantity which varies with time.

Here, the first thing that comes to mind is a wave. There are two kinds of waves, electromagnetic waves and mechanical waves. This is a good place to learn more about them. Sound is a mechanical wave and when we are talking about making music from computer, we are – in a general sense – talking about mechanical wave. But we never actually manipulate ‘mechanical wave’, we modify their ‘computer (digital) representation’. We’ll get to that in a minute.

Now that we know that sound is a mechanical wave and we want to manipulate this wave by using a computer. To represent a mechanical wave in a way that computer understands we have to sample it in time and amplitude. This leads us to our next topic.

**sampling**

Sampling is fairly simple to understand. There are various resources out there to explain it way better than I can. The take-away is ‘The Sampling frequency‘. It’s the frequency at which samples should be taken so as to re-build the original analog wave. Sampling frequency must be more than twice the maximum frequency present in analog signal otherwise aliasing will occur. Generally we over-sample the analog signal so as to re-build analog wave more precisely. In this process there is always loss of information. But engineers manage to re build initial signal just good enough so that it still makes sense by sampling at sampling frequency.

Sampling in time gives us a signal what we call a ‘discrete signal’. Sampling of amplitude is also done so that computer may store the in coming information, this is generally called quantization. This representation is called ‘digital signal’

This complete process is called analog to digital conversion.

Now, how we get analog back from this representation, here it is.

**take aways**

- sampling frequency
- aliasing
- digital and discrete signal

I have just brushed the basics. I’ll write more about them in future.

## my target

30/10/2012 § Leave a comment

Apart form understanding DSP and developing that gut feeling, I am targeting:

1. Adding parametric eqs and other effects in Mixxx

2. Bringing up GUI for Effects Framework.

3. Making Mixxx LADSPA compatible

And , if possible add feature of loading VST and LV2 plugins.