 # what's going on ?

When you have a scalar product, you can build a rotation application.

So what about messing with rotation applications on spaces we don't often see rotations on, such as function space ?

In the graph here, the red curve (originally the purple sinus) is turning in the plane defined by the two functions yellow and green.

# how to implement ?

One way would be to use a function basis and do traditionnal transformations with huge matrices.

This works and it's what you're seeing on the animated graph here.

But is terribly inefficient when considering arbitrary audio files.

A smarter approach is to consider a weighted combination of the projected and rejected functions (weights beeing $sin$ and $cos$ as well as some eventual normalizations)

This better implementation has been done in scilab :

# scilab code

You can try my implementation of wave files rotation with scilab

You can modify the script to load any sound you like.

# conclusion

Well the result does look nice, but doesn't sound very interesting.

It just sound like we surperposed the two sounds with a weight, which you can feel when you look at the actual calculation. (it's not obvious from an abstract rotation in function space though)

However, since it seems like rotation is a fun way to mix function in the regular space, maybe adding functions in the fourier space might sound more interesting.

So I tried convolution of a sound with another one and it sounded really cool !

Scilab implementation of such a thing is almost trivial :

snd1 = loadwave("/path/to/sound1.wav") snd2 = loadwave("/path/to/sound2.wav") snd3 = squarewave(1:100,50) // if you wanna try things snd1 = snd1(1,:) // extract one channel snd2 = snd2(1,:) // extract one channel out = convol(snd1,snd2) // convolution ! out = out/max(out) // normalize playsnd(out) // check it out