I want to make a program that will fix a distorted sound, it is not any type sound, it is a tone (which actually makes things easier)
When the sound is too loud, it will be cut off.
I want to decrease the sound volume, and complete (by approximation) the parts that are missing.
I searched on google for "best fit curve", I have found programs that do this, but not for sounds, and I didn't find any source code.
What I want is to have a function where I give the points that I have (that are valid), and I want it to complete the rest of the points based on the points i'm giving it.
If you look at the attached picture you will have a better idea.
The top wave, is the distorted one, and the bottom, is one where I manually fixed one of the "bumps" of the sound.
the part in between the 2 vertical lines is the part where the function should complete.
I want to give the function a few points that are before the left line, and a few points after the right line.
I also found on the internet formulas to do it, but I'm not that good at math (grade 12 math is the last one I took, in coledge math is not required ), I was hoping that someone might explain to me how to do it in a programming way.
Any idea on how to do this ?
Please help...
Thank You.
Last edited by CVMichael; Mar 16th, 2005 at 07:34 PM.
A polynomial function of second or perhaps third degree can be approximated by the least squares method. The algorithm is rather complex but I know how to do it in Excel. Does it suit you?
...este projecto dos Deuses que os homens teimam em arruinar...
I have been to Vancouver a few years ago together with my wife and travelled through British Columbia and Alberta states. It was just marvellous. Nice cities, nice people and spectacular landscapes. You are lucky.
...este projecto dos Deuses que os homens teimam em arruinar...
It seems that what I need now is to find out how LINEST is calculated. Once I get the 3 numbers (a & b & c), I can draw the Polinomial Regression.
I looked up on the internet and I can't find anything, I have to code it in Visual Basic, and also in C/C++
In Visual Basic, I can create an Excel object, and just call the LinEst function, but if i do it in C++, I can't, I have to re-invent the wheel, and actually create the LinEst function.
I am sorry but I don´t know how the LINEST function is calculated. I only use it in MS-Excel. I like maths (mainly stats) and I use it a lot in my professional life, but I am not well acquainted with coding.
I am afraid you will have to "reivent the wheel" starting with the maths on the polinomial regression, unless you get help from other peers in the mean time.
Hope you manage.
...este projecto dos Deuses que os homens teimam em arruinar...