POV-Ray : Newsgroups : povray.off-topic : Random: FFT, Organ, Blahblah.. Server Time
6 Sep 2024 09:19:46 EDT (-0400)
  Random: FFT, Organ, Blahblah.. (Message 1 to 9 of 9)  
From: Mike Raiford
Subject: Random: FFT, Organ, Blahblah..
Date: 30 Jan 2009 09:12:35
Message: <49830ad3$1@news.povray.org>
Heh, neat... when messing with the FFT toy in polar mode (I've now fixed 
phase so it actually allows edits from π to -π You can actually see the 
phase of the waves change.

Silly, I know. The scaling seems right, but just sort of. Editing in the 
frequency domain makes the time domain really big.. :/

I really need to add my waveform/function feature now so I can play with 
different waveforms.

Next: write an FFT filtering algorithm and export the resulting wav.

Now...

I was playing around with the tone generator in Cool Edit, and 
discovered something that's probably smackingly obvious. If you set the 
   tones to the fundamental, then 1x 2x 4x etc ... it sound exactly like 
an organ. if you do 1x 3x 5x 7x setting each subesequent to half, you 
get an approximation of a square wave. 1x 2x 3x 4x, again half each, you 
get an approximation of a sawtooth wave.

Now I did know that would be a likely outcome, but it was kinda neat 
that I could hand make a square wave.. :)

-- 
~Mike


Post a reply to this message

From: Invisible
Subject: Re: Random: FFT, Organ, Blahblah..
Date: 30 Jan 2009 10:17:03
Message: <498319ef@news.povray.org>
Mike Raiford wrote:

> Silly, I know. The scaling seems right, but just sort of. Editing in the 
> frequency domain makes the time domain really big.. :/

If you add lots of waves together, the resulting wave is very large. 
Normally waves containing lots of frequencies have very little energy at 
each specific frequency, because it's so spread-out.

> Next: write an FFT filtering algorithm and export the resulting wav.

Good luck! ;-)

> If you set the 
> tones to the fundamental, then 1x 2x 4x etc ... it sound exactly like 
> an organ.

Yes. I myself have in fact used this in a musical composition. I wrote a 
small BASIC program that generated various waveforms, and then used 
OctaMED to play tunes with them.

Thinking about it... one technique frequently used in real organs is to 
play several stops at once, each tuned to some octave of the 
fundamental. (I.e., a power of two of the frequency.) If you assume the 
tone of each pipe is approximately a pure sinewave, this is what you get.

> if you do 1x 3x 5x 7x setting each subesequent to half, you 
> get an approximation of a square wave.

Assuming the amplitude is the reciprocol of the frequency, yes. This is 
the Fourier series of that waveform.

> 1x 2x 3x 4x, again half each, you get an approximation of a sawtooth wave.

Again, yes.

Also, if you take the square wave, make the amplitude the reciprocol of 
the *square* of the frequency, and make every other wave shifted 180° 
out of phase, you get a triangle wave.


Post a reply to this message

From: Mike Raiford
Subject: Re: Random: FFT, Organ, Blahblah..
Date: 30 Jan 2009 10:43:17
Message: <49832015$1@news.povray.org>
Invisible wrote:

>> Next: write an FFT filtering algorithm and export the resulting wav.
> 
> Good luck! ;-)
> 

Heh. Thanks. I'll post the program (and the results) when I'm done ;)

I'm doing all of this in C#. You should give C# a try, really. It 
doesn't bite. :) I promise... ;)

You seem to think this will be exceedingly difficult?

>> If you set the tones to the fundamental, then 1x 2x 4x etc ... it 
>> sound exactly like an organ.
> 
> Yes. I myself have in fact used this in a musical composition. I wrote a 
> small BASIC program that generated various waveforms, and then used 
> OctaMED to play tunes with them.
> 

So, combining square waves?

> Thinking about it... one technique frequently used in real organs is to 
> play several stops at once, each tuned to some octave of the 
> fundamental. (I.e., a power of two of the frequency.) If you assume the 
> tone of each pipe is approximately a pure sinewave, this is what you get.
> 

Yep. I was actually attempting to seek out the organ sound. I knew the 
frequencies were related, I just couldn't figure out the relationship 
till I tried 4 frequencies spaced an octave apart.

Odd how all sounds are some fundamental frequency + a combination of 
related frequencies (either harmonic or aharmonic)

>> if you do 1x 3x 5x 7x setting each subesequent to half, you get an 
>> approximation of a square wave.
> 
> Assuming the amplitude is the reciprocol of the frequency, yes. This is 
> the Fourier series of that waveform.
> 

amplitude was 1/harmonic * 100. It was darn close. Interestingly the 
right channel was 90° out of phase, which produced an interesting 
looking but identical sounding wave.

>> 1x 2x 3x 4x, again half each, you get an approximation of a sawtooth 
>> wave.
> 
> Again, yes.
> 
> Also, if you take the square wave, make the amplitude the reciprocol of 
> the *square* of the frequency, and make every other wave shifted 180° 
> out of phase, you get a triangle wave.

It should be possible to generate a Fourier series by using an iFFT to 
get a band limited saw/square/triangle, no?

... rather than iteratively combine the waveforms (which takes forever 
... the DOSBOX MT32 used that technique. it would generate the waves and 
save the resulting wavetable to disk after the first run. Yes, the MT32 
emulator was part wavetable/part pcm sampler, the real thing was part 
pcm/part subtractive)

It seems this would be a much quicker way to generate the proper waveforms.


-- 
~Mike


Post a reply to this message

From: Invisible
Subject: Re: Random: FFT, Organ, Blahblah..
Date: 30 Jan 2009 10:56:54
Message: <49832346$1@news.povray.org>
> You should give C# a try, really. It doesn't bite. :) I promise... ;)
> 
> You seem to think this will be exceedingly difficult?

Well for a start I'd need the hated .NET runtime first... :-P

>>> If you set the tones to the fundamental, then 1x 2x 4x etc ... it 
>>> sound exactly like an organ.
>>
>> Yes. I myself have in fact used this in a musical composition. I wrote 
>> a small BASIC program that generated various waveforms, and then used 
>> OctaMED to play tunes with them.
> 
> So, combining square waves?

Well, I wrote a program that would sum sinewaves together in various 
ways to produce different waveforms. It sounded a bit like a filter 
sweep. (Back when I was 12, I didn't know how to perform a *real* filter 
sweep!)

> Odd how all sounds are some fundamental frequency + a combination of 
> related frequencies (either harmonic or aharmonic)

Er, no... Actually it's a basic consequence of physics, and that's why 
the human auditory system is turned to detect it. ;-)

As an aside: You can use waveshaping to add new *higher* frequency 
components, but never *lower* frequency ones.

>>> if you do 1x 3x 5x 7x setting each subesequent to half, you get an 
>>> approximation of a square wave.
>>
>> Assuming the amplitude is the reciprocol of the frequency, yes. This 
>> is the Fourier series of that waveform.
> 
> amplitude was 1/harmonic * 100. It was darn close. Interestingly the 
> right channel was 90° out of phase, which produced an interesting 
> looking but identical sounding wave.

Yes. The human ear is insensitive to the relative phase between 
frequency components. (Lossy compression algorithms frequently take 
advantage of this.) Note that nonlinear systems that the waves pass 
though might respond differently though (e.g., your speakers).

> It should be possible to generate a Fourier series by using an iFFT to 
> get a band limited saw/square/triangle, no?

Yes.

> ... rather than iteratively combine the waveforms (which takes forever 

Depends how many waves you want, at what sampling frequency. But yes, at 
some point FFT becomes faster.


Post a reply to this message

From: Mike Raiford
Subject: Re: Random: FFT, Organ, Blahblah..
Date: 30 Jan 2009 11:06:24
Message: <49832580$1@news.povray.org>
Invisible wrote:

> 
> Well for a start I'd need the hated .NET runtime first... :-P
> 

Whats the difference between .NET and, say, JRE? Why so against the .NET 
framework?

>>
>> So, combining square waves?
> 
> Well, I wrote a program that would sum sinewaves together in various 
> ways to produce different waveforms. It sounded a bit like a filter 
> sweep. (Back when I was 12, I didn't know how to perform a *real* filter 
> sweep!)
> 

of course... For some reason I pictured you generating the sounds 
through the PC speaker, recording them recombining them.

> 
> Er, no... Actually it's a basic consequence of physics, and that's why 
> the human auditory system is turned to detect it. ;-)
> 

What amazes me is how the ear detects sounds. It literally works in the 
frequency domain. :)

> As an aside: You can use waveshaping to add new *higher* frequency 
> components, but never *lower* frequency ones.
> 

Right.


>> It should be possible to generate a Fourier series by using an iFFT to 
>> get a band limited saw/square/triangle, no?
> 
> Yes.
> 
>> ... rather than iteratively combine the waveforms (which takes forever 
> 
> Depends how many waves you want, at what sampling frequency. But yes, at 
> some point FFT becomes faster.

I wonder in this case. I'll have to grab the source again and look at 
how it was done.

-- 
~Mike


Post a reply to this message

From: Invisible
Subject: Re: Random: FFT, Organ, Blahblah..
Date: 30 Jan 2009 11:13:35
Message: <4983272f$1@news.povray.org>
>> Well for a start I'd need the hated .NET runtime first... :-P
> 
> Whats the difference between .NET and, say, JRE?

About 400MB. *rimshot*

> Why so against the .NET framework?

Java I just about put up with because it allows you to write software 
that will (easily) work on more than one platform. And because it has 
libraries which (just about) allow mere mortals to do things like 
multithreading, database access, graphics and sound, which would 
otherwise be impossible.

The .NET framework, on the other hand, it a vast sprawling mass of 
inefficiency which is more or less Windows-only. It has all the 
downsides of Java, without the advantages. And, obviously, it's made by 
M$, which everybody hates. ;-)

>> Er, no... Actually it's a basic consequence of physics, and that's why 
>> the human auditory system is turned to detect it. ;-)
> 
> What amazes me is how the ear detects sounds. It literally works in the 
> frequency domain. :)

Millions of years of evolution, my friend. ;-)

Actually, it wouldn't surprise me if the ear itself doesn't do a very 
good frequency analysis, but the brain post-processes it. Do you have 
*any idea* how crap the image data from your retinas is?? It's amazing 
humans can see at all...


Post a reply to this message

From: Mike Raiford
Subject: Re: Random: FFT, Organ, Blahblah..
Date: 30 Jan 2009 11:32:47
Message: <49832baf$1@news.povray.org>
Invisible wrote:
>>> Well for a start I'd need the hated .NET runtime first... :-P
>>
>> Whats the difference between .NET and, say, JRE?
> 
> About 400MB. *rimshot*
> 
>> Why so against the .NET framework?
> 
> Java I just about put up with because it allows you to write software 
> that will (easily) work on more than one platform. And because it has 
> libraries which (just about) allow mere mortals to do things like 
> multithreading, database access, graphics and sound, which would 
> otherwise be impossible.
> 
> The .NET framework, on the other hand, it a vast sprawling mass of 
> inefficiency which is more or less Windows-only. It has all the 
> downsides of Java, without the advantages. And, obviously, it's made by 
> M$, which everybody hates. ;-)
> 

.NET is big, but it's hardly inefficient. I'm the opposite. I don't care 
for Java. every Java-based application I've come across feels like its 
on the verge of total collapse. .NET apps on the other hand feel rather 
stable.... and mono allows cross-platform development.

.NET has similar libraries. I'd hazard a guess and say that its easier 
to do such things as graphics and sound under .NET

The 2.0 framework is 22M, Granted, 3.5 is a whopping 200MB o_0

But I could easily retarget to 2.0...

>>> Er, no... Actually it's a basic consequence of physics, and that's 
>>> why the human auditory system is turned to detect it. ;-)
>>
>> What amazes me is how the ear detects sounds. It literally works in 
>> the frequency domain. :)
> 
> Millions of years of evolution, my friend. ;-)
> 
> Actually, it wouldn't surprise me if the ear itself doesn't do a very 
> good frequency analysis, but the brain post-processes it. Do you have 

Hmm, each hair is at a length that resonates with a certain frequency. 
I'd imagine there would be a lot of crosstalk, hairs tuned for harmonic 
frequencies may also vibrate. Yep. a ton of post processing work to be 
done. :)

> *any idea* how crap the image data from your retinas is?? It's amazing 
> humans can see at all...

Well, a very tiny spot in the middle of the field of view is quite 
sharp, but other than that ... For fun. Look at a JPG file that appears 
"perfect" separate the chromiance from the luminance. Luma will always 
be nice and sharp. Chroma is likely extremely blocky. We don't notice 
because we don't see color as well as we would like to believe we do. :)



-- 
~Mike


Post a reply to this message

From: m a r c
Subject: Re: Random: FFT, Organ, Blahblah..
Date: 31 Jan 2009 03:37:14
Message: <49840dba@news.povray.org>

498319ef@news.povray.org...
>
> Thinking about it... one technique frequently used in real organs is to 
> play several stops at once, each tuned to some octave of the fundamental. 
> (I.e., a power of two of the frequency.) If you assume the tone of each 
> pipe is approximately a pure sinewave, this is what you get.
>
Not only octaves but even 5th , or better said 13th (octave+5th)  with a 2' 
2/3 stop added to a 8'
When you press C1 key, it plays G2
That fakes the 3rd harmonic.
In French it is called "Nasard" because it gives sound a 'nose' colour.
In English 'Quinte flute'

Marc


Post a reply to this message

From: Orchid XP v8
Subject: Re: Random: FFT, Organ, Blahblah..
Date: 31 Jan 2009 05:07:49
Message: <498422f5$1@news.povray.org>
m_a_r_c wrote:

> 498319ef@news.povray.org...
>> Thinking about it... one technique frequently used in real organs is to 
>> play several stops at once, each tuned to some octave of the fundamental. 
>> (I.e., a power of two of the frequency.) If you assume the tone of each 
>> pipe is approximately a pure sinewave, this is what you get.
>>
> Not only octaves but even 5th , or better said 13th (octave+5th)  with a 2' 
> 2/3 stop added to a 8'
> When you press C1 key, it plays G2
> That fakes the 3rd harmonic.
> In French it is called "Nasard" because it gives sound a 'nose' colour.
> In English 'Quinte flute'

Yes, that too...

(Although I must say, on the only organ I've ever played, the Mixture 
III didn't sound very pleasent to my ears.)

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.