I have a signal coming in from mic and getting the level via minim, but it's really jumpy. Is there any algorithms anyone can suggest to smooth this signal out?
you can do an average with the recent values. What you want is called a filter, and normally they are done by adding some percentage of some recent values. That percentages can be calculated based on what frequencies you want to obtain. The easiest way is to do an average.
Right, I have done averaging, but I am looking for a smarter algo. Averaging is a bit primitive for how I would like it to smooth. i.e. outliers really mess up the overall average.
The majority of filters works like this:
y[t]=ax[t]+bx[t-1]+cx[t-2]+dx[t-3]+...
You can calculate those values based on the frequencies you want, but you would need to study a bit about signal processing. You can try the following filter (which I usually use, but my application is different from yours):
y[t]=0.5x[t]+0.5y[t-1]
Thsi filter will count 50% for actual value, 25% for the t-1 value, 12.5% for the t-2 value, 6.75% for the t-3 value, 3.375% for t-4 value and so on. I don't know if it would work on you application, but, as I said, you need to calculate the filter for a better result (for this I recommend using MATLAB just to get those values).
Answers
Hi, Do you want use signal in real time ?
yeah its a real time signal, but its ok if its delayed a little due to smoothing.
you can do an average with the recent values. What you want is called a filter, and normally they are done by adding some percentage of some recent values. That percentages can be calculated based on what frequencies you want to obtain. The easiest way is to do an average.
Right, I have done averaging, but I am looking for a smarter algo. Averaging is a bit primitive for how I would like it to smooth. i.e. outliers really mess up the overall average.
The majority of filters works like this: y[t]=ax[t]+bx[t-1]+cx[t-2]+dx[t-3]+...
You can calculate those values based on the frequencies you want, but you would need to study a bit about signal processing. You can try the following filter (which I usually use, but my application is different from yours):
y[t]=0.5x[t]+0.5y[t-1]
Thsi filter will count 50% for actual value, 25% for the t-1 value, 12.5% for the t-2 value, 6.75% for the t-3 value, 3.375% for t-4 value and so on. I don't know if it would work on you application, but, as I said, you need to calculate the filter for a better result (for this I recommend using MATLAB just to get those values).
I have no idea what any of that means :( or how to use it for that matter, nor where to start reading about how to use it.
here is my (poor) attempt at trying to write an averaging algorithm.