This experiment is a first step into testing interesting and alternative methods of wave distortion. In this case, superimposing a bezier curve onto a sinusoid.
For this experiment, I will be using Unity and C# as a means to test the resulting waveform; in the future I plan to migrate all of this over to JUCE / C++. Because of this, I tried to write my code as generically as possible. I created my own library of maths functions which contains various static classes, such as 'BigMaths' which contains a 'choose' method, a 'bezier' method, an 'interpolate' (and 'reverpolate') method and many more. The reason for this is that I'll be able to port the library over to C++ without too much hassle.
The way the code works currently is a function generates a sine wave, given a frequency and a sample rate (sample rate / frequency = samples per cycle). Then another generates a bezier curve, given the 'weight' points and the beginning and end points. Finally another function superimposes the wave sample values and the bezier curve values, then is passed through a hyperbolic tangent function (tanh), to stop the value from exceeding -1 or 1. This does alter the sound further, however for now it is the easiest way to stop clipping.
The overall result of the sound is certainly interesting, the slight harmonic distortion and harmonic phasing can be heard clearly, although not to the degree that I thought it would be. I will revisit the algorithms once I have a bit more knowledge regarding the maths, especially the Fourier series', as I would like to compare it to the results of bezier distortion. I also feel the tanh altered the sound too much, so I will explore other options next time - perhaps using some sort of compression / limiting algorithm.