# [LAD] SysEx data-conversion woes: nibbles and complements (Microwave 2)

Thu May 13 23:42:36 CEST 2021

```On Thu, May 13, 2021 at 09:27:57PM +0200, Jeanette C. wrote:
> May 13 2021, Fons Adriaensen has written:
> ...
> > FFT theory will provide
> > a solution. If you want to think about it, I can give you two hints:
> >
> > * It's related to the sin() vs. cos() thing mentioned earlier.
> > * In this particular case there's an extra twist to it - think
> >  of shifting a cyclic waveform in time by half a sample.

> Could it be as simple, as bluntly put: forget about the phase, only use
> the amplitude/overall power of any harmonic from an FFT and reconstrcut
> the signal from all sines at 0 phase?

Absolutely right ! Except that for the FFT, sin() means the phase is
+/- 90 degrees, remember than sin() components turn up in the imaginary
part, with the real part zero.

Now imagine the 128 samples generated by

T [i] = sin (h * i * 2 * pi / 128), for i = 0...127, and fixed h
(h = harmonic number, 0...64).

For each h, and also for any waveform which is a sum of these sine
waves, we will have

T [64+i] = -T [64-i] or equivalently
T [128-i] = -T [i]

That means we have anti-symmetry w.r.t. samples 0 and 64.

Now consider again the sysex format: to make up a cycle of 128 samples
the first 64 samples are repeated in reverse order and negated.

Now ask yourself: where is the symmetry point in that case ?

Ciao,

--
FA

```