back to list

Re:FFT

🔗Robert Walker <robertwalker@...>

8/30/2001 7:49:42 PM

Hi Brian,

Hello, and thanks for your encouragement about Fractal Tune Smithy!

The linear predictive coding sounds interesting.

It's not the same thing, but I have an idea for improving the
wave counting method of finding the frequency by taking the
pitch one finds at a particular point and predicting future
crossings. Then if one hits a patch where one can't quite
deterimine the pitch because of a large number of extra
crossings, check for the predicted crossings, and if found,
use those instead.

I think this might reduce the number of extra notes it
finds. We'll see how it works.

Re soudn of FFT. Maybe bell like would be another way
of describing it - kind of crystal bell or something.
That is - the sound if one just adds together the
frequencies as sine waves.

However another hting one can do is to replace them
with other waves. With FTS, in the FFT section, just
for fun, have option to make the waveform from
trianglular or saw tooth waves insttead of the
usual and "proper" sine waves.

Also one can try using any of the midi voices for the
pitches.

That I thnk has quite a different kind of effect.
It's something that could have been done before
FFT, even back in the C17. If a number of
musicians were present who were able to hear
the partials in a bell sound, they could then
sing them along with the bell, and continue to sing them once
the bell stops sounding, and the result
might perhaps sound somewhat like a bell, and
somewhat like singing.

I'd have thought, probably not much like FFT synthesis.

I wonder if anyone has done this experiment?

I think perhaps some of the qualities you are
attributing to the FFT are really qualities of
the sine waves used to reconstruct it.

If so, replacing them with other wave forms
would change the effect. Of course that will change
the timbre (whihc I find interesting to do). If one wants
to keep the original timbre as closely as possible,
one could maybe try using a voice such as ocarina
instead of the sine waves, or anything very nearly
sine wave like (recorder in upper register is also
good, or maybe a sample of a suitable note from
bird song), but not actually sine waves.

One loses some information anyway about the waveform
by choosing the most prominent peaks in the FFT
plot, and ignoring the finer details. Maybe using
some other voice to reconstruct it
can help regain any subtleties lost by doing that.

Won't get back the original as one has lost
the attack, and the pitch and volume varying transients,
and the phase info, but could give interesting
timbres. Something I've been experimenting with
in FTS using Midi voices, as that's easy to do.

Robert

🔗Graham Breed <graham@...>

8/31/2001 2:15:57 PM

Robert Walker wrote:

> However another hting one can do is to replace them
> with other waves. With FTS, in the FFT section, just
> for fun, have option to make the waveform from
> trianglular or saw tooth waves insttead of the
> usual and "proper" sine waves.

It's not clear if you've done this or not. But whatever, I've
uploaded an example of a guitar resynthesised with square waves to
the MakeMicroMusic Files section.

I put it there because I can't upload to this group. It says the
moderator has disabled uploads.

If I'd done it properly, I would have processed the same input file
different ways. But I did it quickly instead.

> I wonder if anyone has done this experiment?
>
> I think perhaps some of the qualities you are
> attributing to the FFT are really qualities of
> the sine waves used to reconstruct it.

Ah, but he did list a lot of other kinds of synthesis. I don't know
what they mean myself, but Walsh synthesis was among them. This is
like normal FFT resynthesis but using square waves. And unlike what
I did above, you can do the analysis with the square-wave equivalent
of an FFT as well. If you think about it, it shouldn't be difficult
to see that you can get any waveform by combining square waves the
same as you can with sines.

The rationale is that you can add together square waves much more
quickly than sines using a digital synthesizer. I'm not sure if even
this would work in practice, because I don't think it would degrade
gracefully with small numbers of partials. There lots of samples
dominated by a few sine-partials, but I'm not sure that many would
work as a few square-partials. Perhaps this is the reason Walsh
synthesis has yet to take the world by storm.

Still, you can get some idea what it can do from my example. It uses
35 inharmonic partials. A more subtle waveform might work a bit like
an enhancer, but I haven't tried that yet.

Graham

🔗Robert Walker <robertwalker@...>

8/31/2001 4:04:40 PM

Hi Graham,

> > However another hting one can do is to replace them
> > with other waves. With FTS, in the FFT section, just
> > for fun, have option to make the waveform from
> > trianglular or saw tooth waves insttead of the
> > usual and "proper" sine waves.

> It's not clear if you've done this or not. But whatever, I've
> uploaded an example of a guitar resynthesised with square waves to
> the MakeMicroMusic Files section.

Thanks, yes, that's a lot of fun and a great demo of how some
of the "FFT" quality is because one is resynthesising using sine waves.

Nice first try at a crumhorn perhaps... Certainly more earthy
than the sine wave FFT in the kind of ethos of the timbre.

You can resynthesise to square, triangle, and saw tooth in FTS for a single
note in FTS, rather than as an "instrument" to use in a melodic line,
but I suppose the single note can be made into a sample for a midi instrument.

You can also make the FFT analysis into a timbre with midi instruments
playing all the partials, which one _can_ use in FTS immediately,
and select it into one of the "voice channels" just like any of
the midi voices.

For the FFT section, see the FFT help section of the FTS beta
download page. I've just added a couple of sentences about the saw tooth
and midi instrument resynthesis option.
http://members.tripod.com/~robertinventor/ftsbeta.htm#FFT

N.B. if you go to Config | Freq Detection | FFT Freq. detection
there are some tick boxes at bottom of the window for
Ooura's fft - untick that and you get your one, but without
the sine table (because it's just in the debug code so far) - this
is there by accident, and the FFTW tick box comes up with
message about a dll that doesn't exist (well, I have it
here, but never uploaded it anywhere as I'm not sure
whether or not I'm supposed to be able to use it
as a "plug in").

I'll do a demo of single recorder note resynthesised as sine,
triangle, saw tooth, and square, some time
soon. Also play a recorder tune into FTS and get it to
find the notes, then play them back with same timing and
pitch, but re-synthesized with some other midi instrument playing
the partials (guitar, tubular bells, violin, or whatever).

FTS can already do this for the recorder timbre
reasonably well if the tune isn't too fast,
though as it is at present, one needs to play around with
the various parameters to find the "sweet spot" where everything works well.
(I plan to have a drop list of defaults for the wave counting
section when finished).

> Ah, but he did list a lot of other kinds of synthesis. I don't know
> what they mean myself, but Walsh synthesis was among them. This is
> like normal FFT resynthesis but using square waves. And unlike what
> I did above, you can do the analysis with the square-wave equivalent
> of an FFT as well. If you think about it, it shouldn't be difficult
> to see that you can get any waveform by combining square waves the
> same as you can with sines.

The integration would be easy to do anyway. I think I'd need to look
up the proof that the fourier series integration gives you a sequence
of sine waves that sums up to give the original waveform, and then
see how one can do the same for square waves, can well imagine one
might. Could also try to prove it just by showing that one can
make a sine wave out of square waves - then I think with this
as converging series, one would then get convergence easily
from the sum of the sine waves, but don't know if that would
be any quicker to do.

> The rationale is that you can add together square waves much more
> quickly than sines using a digital synthesizer. I'm not sure if even
> this would work in practice, because I don't think it would degrade
> gracefully with small numbers of partials. There lots of samples
> dominated by a few sine-partials, but I'm not sure that many would
> work as a few square-partials. Perhaps this is the reason Walsh
> synthesis has yet to take the world by storm.

Yes, just as a square wave or saw tooth can be FFT analysed as an
infinite sequence of sine wave harmonics, I suppose a sine wave
would be an infinite sequence of square wave harmonics.

I wonder if we really do hear sine wave partials? Would be perhaps
a bit surprising if it is a mathematically perfect sine wave, and a close
approximation to a sine wave might be more likely. I wonder if
anyone has tried varying the shape of the sine wave just slightly
for the FFT.

Come to think of it, in my update of your FFT code, there are no
calls to the sine and cosine functions any more during the
actual calculation, just a sine table that gets filled in
at the start of the calculation.

I wonder what would happen if one just replaced the sine wave
table there by a saw tooth, or square wave, or whatever, and
did the standard FFT calculation with that instead?

> Still, you can get some idea what it can do from my example. It uses
> 35 inharmonic partials. A more subtle waveform might work a bit like
> an enhancer, but I haven't tried that yet.

Could be fun to try...

Robert

🔗genewardsmith@...

8/31/2001 9:08:14 PM

--- In crazy_music@y..., "Graham Breed" <graham@m...> wrote:

> I did above, you can do the analysis with the square-wave
equivalent
> of an FFT as well. If you think about it, it shouldn't be
difficult
> to see that you can get any waveform by combining square waves the
> same as you can with sines.

It's not as easy as all that, for in fact Walsh functions consist of
more than just your ordinary square waves--you need 2^n Walsh
functions to get a complete orthogonal basis in a period of length
2^n, so you need other step-functions taking on two values (1, -1.)

🔗Robert Walker <robertwalker@...>

9/1/2001 7:16:50 AM

Hi Jeff,

> > I think I'd need to look up the proof that the fourier series
> > integration gives you a sequence of sine waves that sums up
> > to give the original waveform, and then see how one can do
> > the same for square waves, can well imagine one might.

> Eeek! I don't think so!

Yes, just looked it up on the web, here's a nice page with
some pretty animations:
http://www.sosmath.com/fourier/fourier1/fourier1.html

One needs to have functions with those properties:

Need ones to stand in for the cos and the sin.

First of all, integral over one cycle of the fundamental
for the transform is zero - that's okay for periodic function.

Then, integral of the product of the "cos" for m with the "sin"
for n has to be zero, for any m, or n.

Try case m = n, then it will be true for a periodic function if the
positive and negative sections of the waveform are
reflections of each other, as wave then is (to do it a bit
graphically):

sin
looks like:
/ \
\ /

i.e. putting in the signs:

/ \
-/-\
where -\ is same as \ with sign change, same for / and-/

cos
\ /
-/-\

product
/*\ -/*-\
-/*\ /*-\

where /*\ means integral of the product of the / and \ parts of the wave.

Let's go to algebraic notation, /=a, \ = b, then we want
a*b + -a*b + -a*-b + a*-b
to integrate to 0, which it does, hurray!

Since nothing was assumed about the shape of the / or \
it will work for any periodic function with the
positive and negative sections of the curve the same.

Need this to work for any m or n though, cos(m)*sin(n)
integrating to zero.

Then, integral of product of the functions for frequencies
m and n with m !=n has to be 0.

However, just kind of doodling a few possibilities,
looks as this might be possibly be true for any periodic function
that has second half = rpeat of first half with change of
sign, and provided we also have symmetry in each half
of the waveform too, so that the / is the
same as \ backwards in that diagram as well.

Anyone know if this is the case? I can't quite see how
to prove it yet, if it is.

Then, integral of the square of the function has to be
constant independent of the frequency. That's okay for
periodic function. E.g. if you double the frequency, then
the integral for each cycle of the wave is halved (you've
squashed it up by factor of two in the time domain), so
as the number of cycles has also doubled, total integral
remains the same

Finally of course, one needs to show that any function
of interest _can_ be constructed as a sum of these
stand-in cos and sin functions - that part of the
proof isn't dealt with on that page.

That I think is the tricky part that won't generally
work for all periodic functions.

Still, could be fun to play around and see what happens.

One rather wild idea. Suppose one tried to use
an acutal instrument sample in place of teh sine waves.

E.g. oboe waveform (one cycle). Now analyse, say, recorder
in terms of oboes. Might one get a number of "partials"
which when played on oboes sounded a bit like a single
note on the recorder???... Might be fun just to see
what happens - even if it doesn't work, the "mistake"
might give an interesting timbre.

N.B.
http://sepwww.stanford.edu/oldsep/hale/FftLab.html
Neat applet for experimenting with FFT - drag
the dot for the freq. of FFT analysis in the top part and
the wave shows below.

Do Zero all, then click for the dot for the freq in
top or bottom half and you'll get the wave. Or try
making a wave for it to analyse. Great fun.

To make the graph for the real fft, I.e. input
with zero imaginary component, zero all, and in the bottom
half set, say, the leftmost imaginary dot positive,
and rightmost one negative by same amount (or any
symmetrical pairs of dots in the imaginary section
for F(x)).

Page of FFT links:
http://www.fftw.org/links.html

Robert

🔗Robert Walker <robertwalker@...>

9/1/2001 7:49:54 AM

Hi Brian,

> The excellent book Wlash Functions (can't recall the author) goes into all
> of this, and in fact shows how to generate a near-sine-wave using Wlash sal and
> cal functions. In fact, I built a logic circuit to do this in the electronics
> lab during my university education as a bit of fun. By heavens, it worked.
> Walsh sal and cal functions are very easy to generate by stacking logic gates.
> Just add some AND and OR and XOR gates on the outputs and you get any Walsh sal
> or cal you want. The sequency depends on the master clock rate and the amount
> by which the logic gates subdivide the master clock.

That sounds fun!

Interesting idea to combine the two, or use different functions depending on
the characteristics of the wave form and how "noisy" it is.

Robert

🔗John Starrett <jstarret@...>

9/1/2001 9:32:18 AM

--- In crazy_music@y..., "Robert Walker" <robertwalker@n...> wrote:
<snip>
>
> Robert

Thanks Robert. Here's another FFT app with sound:
http://www.phy.ntnu.edu.tw/java/sound/sound.html
He has many more applets here, where you see different lists by
putting the mouse over the hyperlinks on the top of the page
http://www.phy.ntnu.edu.tw/java/

John Starrett

🔗Robert Walker <robertwalker@...>

9/1/2001 11:12:53 AM

Hi John

Thanks Robert. Here's another FFT app with sound:
http://www.phy.ntnu.edu.tw/java/sound/sound.html
He has many more applets here, where you see different lists by
putting the mouse over the hyperlinks on the top of the page
http://www.phy.ntnu.edu.tw/java/

Thanks!

You can click the Set button while the sound is
playing and hear the partials pop in and out, which
is fun.

Robert