Distortion Modulation with LUT generated signals on BF706

Discussion created by mghecea on Jun 19, 2018

Ever wonder how to get your sine or square wave to distort mathematically via a random number generator ? Well we could do it the Matlab way using the randn () function which works out to : yn = xn + 0.25*randn(seed)

problem is perhaps that your amplitude would end up something like 1.0 so not very useful on the BF706 Blackfin without a scaler option so I came up with the following range setting algorithm...


I have not only passed in the noise level in fractional form, but had a little issue on the Blackfins, keeping my random seed rotating, so I did this clever trick of index rotation which switches seeds in a circular manner. Now I can add random distortion and scale my factor as such from the console.


I can turn my signal on with aud on and see the pure sine wave at 1KHz...


Terminal command noise on will distort my 1KHz sine wave in the same fashion you see at the top of this blog. Each incremental noise up command will increment the distortion factor passed into the equation by an additional factor I've decided as one-quarter signal to noise (SNR) scaling factor, which I have worked out in the equation above. I can turn the noise off with a simple command noise off. I can also switch frequencies with the noise added in and it works fine, just not as detailed in the noise scaling as the lower frequencies, because of the lesser sampled data points adding sparse detail to the random noise...



Last but not least, this is how I pass in my scaling factor i.e.



And the devil is always in the detail, so I simplified this time, but I will add complexity later after this successful test...


If you like this route, go ahead and update my previous code with something similar or write your own methodology...Why not ?!