back to list

Brain shifters [was: Infinitely recursive perverts....]

🔗J. Scott <cgscott@xxxxxxx.xxxx>

5/16/1999 12:57:43 AM

Ray Tomes wrote:
> If the frequencies are to be multiplied by 50 to 100 and it is done in
> real time, then clearly the speed up factor cannot be applied (as it is
> real time) and so in effect each little moment is played 100 times
> before moving onto the next. I say in effect because the phases of the
> waveforms must keep on developing correctly which is not trivial. This
> requires understanding how to use FFT software and a fair bit of
> programming, although there may be alternative approaches.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FFT is only necessary if you want to do fancy stuff like formant
correction (to un-chipmunkize). That's not necessary for this
application.

The easy way to do it in real time is just use a standard
pitch shift algorithm. Let's say you need to shift the brainwaves
up by 3 octaves - a factor of 8. So we grab snippets and
each snippet will get played 8 times at a rate of 8 times the
original.

Here's 4 "100ms" segments from the original sound
(segment length depends on application - experiment to find out):

Original sound:

1.......2.......3.......4.......

0 0.8 1.6 2.4 seconds

so shifted 3 octaves up it would go:

11111111222222223333333344444444

0 0.8 1.6 2.4 seconds

(the stuff in the original where the dots are is tossed out)

But the end of segment 1 and its beginning don't line
up - giving distortion! Same for segment's 2, 3, and 4.

Solution - play each segment back with another copy
of itself, delayed 50ms. Use two envelopes to window
these two copies so that most of the time only one is playing
back, and they quickly fade in and out near the end
of the sound.

This whole gizmo can be easily implemented with a
delay line written to by the input. Two delay taps
read the delay line from different locations (180
degrees out of phase with respect to the delay line
length). The delay line readers read at a different
frequency frem the delay line writer. As the
output pointer is about to cross the input
pointer, it is ramped out and the other wave
reader is ramped in.

The craft is in picking the shape of the ramping
envelope (also called the "overlap-add window")
and deciding how big to make the delay line.
Experimentation is the key here.

- Jeff