Generating overtones with fixed phases in SigmaDSP processors

Question asked by Alexei_Bazlaev on Mar 16, 2017

Dear colleagues!
I would like to share my experience in generating overtones (harmonics) of the sine tone with fixed phase relationships in SigmaDSP processors. For example if we need to generate sine tones sin(wt), sin(2wt), sin(3wt),... with the strictly specified phase relationships, it will be not enough to use sine tone generators from the toolbox of SigmaStudio. Even if we will specify the initial phases, these generators will not keep phase relationships intact and their phases will be permanently shifting. Even if we will generate equal tones using two generators with the same initial phases, the shift between their phases will permanently change.
Usually to generate overtones of the fundamental frequency with the fixed phase relationships, engineers use multiplication of sine tones by itself and summing the products with different coefficients. For example, sin(2x)=1-2(sin(x-pi/2))^2, sin(3x)=3sin(x)-4(sin(x))^3. But these techniques are pretty bulky and are not universal. What if we need to generate any arbitrary overtone of sin(x), for example sin(5x) or even sin(1,5x)? It will be hard enough to realize it using restricted resources of SigmaDSP. Moreover the amplitudes and phase relationships of the products are hardly predictable.
But this is not the problem for SigmaDSP to generate any sine tone the same way as it is realized in modern DDS IC's. We need the sawtooth generator, which will serve as the phase accumulator, and the lookup table (LUT) with the sine wave values. When the level of the sawtooth generator is equal to the index of the LUT, the output of the LUT will be equal the value of the element with that index. In this manner we can generate multiple signals with any desired forms and phase relationships. The number of points of the LUT of sine wave must be odd, and the last point must be equal to the first. The more points in the LUT, the more SFDR, the more accuracy of the phase relationships and the less the minimal phase shift. The frequency of the sawtooth generator must be equal to the required frequency of the fundamental sine tone. In the example there is one fundamental tone sin(x) and two overtones sin(2x), sin(3x). Their phase relationships are strictly specified in the LUTs. Because the value of the sawtooth is changed between -1,..,+1 we need to lift it above the zero, so we add 1 Volt DC and multiply it by 0.5. After this manipulation the output of the sawtooth will change between 0,..+1, which is within the range of the fractional input of the LUT. It is also possible to use LUT with the integer input, in that case we should multiply the sawtooth by half of the LUT's size, in my example it is 96, so the input of the LUT will change between 1,...,+193. But in that case because of the stepped sine envelope, generation of the sine tone will not be very smooth, and SFDR of such sine generator will not be very good.

With best regards!