Welcome, Guest. Please login or register.

Author Topic: Fourier analysis (of a sound)  (Read 6507 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Fourier analysis (of a sound)
« on: October 04, 2007, 07:59:43 PM »
I was fascinated to learn recently that any sound, no matter how complex, can be broken down in to constituent sine waves of varying frequencies, and that if all of those sine waves are played back simultaneously they will be perceived as the original sound.

I would like to try this. So does anyone know of any software which will perform the Fourier analysis on a sound file and show the parameters for the resulting sine waves? Once I have these I can generate the sine waves and layer them up, and hopefully the result will be the original sound (more or less).

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Fourier analysis (of a sound)
« Reply #1 on: October 05, 2007, 10:31:54 AM »
Well, I don't care if the resulting dataset is larger than the original sound, since I'm not interested in this for the purpose of compression. I just want to try it out of curiosity, to see if it really does work :-) (and no, I can't just take your word for it ;-)  )

I understand that the frequencies and amplitudes of a complex sound will vary over time, and thus so will the amplitudes of the constituent pure tones. So how would you get around this? Perform the Fourier analysis on each individual sample, then generate the pure tones for each sample one sample in length, then play back all of the resulting (different) samples consecutively?

Again, I know this is pointless since the goal is to end up with pretty much the same sound you started with. It is purely for personal interest not for any practical application that I want to try this. Imagine how exciting it would be to take a sample of your own voice saying "hello", perform the necessary analyses to determine the parameters for its constituent pure tones, then generate all of those tones simultaneously and magically hear your own voice saying "hello"!

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Fourier analysis (of a sound)
« Reply #2 on: October 06, 2007, 10:04:24 AM »
Quote
Karlos wrote:
When doing a full transform, the decomposition produces a spectrum of frequencies. When you reproduce the sine waves with the appropriate intensity, frequency and phase shift, the complex constructive/destructive interaction of them (re)produces the time varying properties you heard in the origninal sound.


That seems to contradict what you said earlier, unless I misunderstand this:

Quote
Karlos wrote:
However, complex sounds obviously change with time. Translation into the frequency domain produces time invariant data so what you have to do is to split your sound into tiny windows and perform a discrete FFT on each one. Each frame of sound will have a different spectrum that you can turn back into an impulse of sound.


@Oliver
I will have a look at those web sites when I have time. Unfortunately I have too much reading to do anything else :-(

Quote
Oliver wrote:
Btw, you seem be thinking on a number of maths/physics/programming/engineering type questions; are you sure you're not being lured into an engineering career?

Heh, no. The maths/trig/programming questions were to do with my port of GridWars to the GP2X. Part of my Speech & Language Therapy course (which I started in September) is a module on Hearing & Acoustics, which is all about the physics of sound. So that's why I've been asking questions about Fourier. Though I find it interesting, I struggle to see how it is of use to a Speech & Language Therapist.

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Fourier analysis (of a sound)
« Reply #3 on: October 06, 2007, 05:17:57 PM »
Quote
Oliver wrote:
Frequency content of a signal can be used to characterise a system which the signal comes from or a system which it passes through. So, I guess there could be some application to dealing with speech impediments (is that what your course is about?). I'm not sure it would be any better than using your own ear, though.

Yes that is one aspect of my course. The only reason I can think of for teaching us about sound spectra is to demonstrate that a complex signal like speech is different from a pure tone in that it has a variety of frequencies embedded within it. If somebody's ears are damaged and they are unable to perceive certain frequencies, then auditory feedback of their own speech will be less effective, which can cause degradation in ability to produce speech sounds properly. Of course, detailed knowledge of Fourier analysis is not really needed. it has just piqued my interest :-)

Quote
Karlos wrote:
In the pure mathematical case, a finite duration signal of arbitary complexity (that varies across time) can be broken down into a spectrum composed of (up to) an infinite number of discrete sine waves, each having a distinct frequency, amplitude and phase shift. These sine waves do not vary over time (except in the regular sense), ie, they don't have an envelope and they don't slowly change phase or frequency. Therefore, this spectrum is not a function of time in the same way the original signal was.

Is that another way of saying that even if the original complex signal is aperiodic, the resultant sine waves will be periodic?

Quote
Karlos wrote:
Now, if you take this (potentially infinite) number of sine waves and mix them back together, the interference between them reproduces the original signal for the duration of that original signal. Mathematically you cannot do this for an infinitely long random signal since you'd require an infinitely large spectrum which is incalculable.

Understood. But I'm not talking about using an infinitely long signal - just a short one, e.g. somebody saying "hello".

Quote
Karlos wrote:
In computational reality, you simply cannot do this. The longer your complex sound, the larger your resulting spectrum is going to get and the longer it's going to take to calculate

That makes sense. And I would assume that a speech sound would be fairly complex, even if it is short.

Quote
Karlos wrote:
Instead, you slice up your sound into frames which are individually a much shorter length and perform the (F)FT on each one individually, where you'd get a much more reasonable (and hence managable) spectrum per frame than you would for the entire original signal.

Ahhh I think I understand what you're saying. A FT on a whole 10 second signal may create 10 million pure tones, whereas a FT on each of the 10 one-second chunks would create 10 much smaller spectra, maybe of 1000 pure tones each, because each chunk is less complex (by virtue of the fact that it is shorter). Is that kind of what you mean?

Quote
Karlos wrote:
The only time when you can reasonably encode a long duration sound in one FT is when that sound is basically time invarying (or varies in a cyclic way) since you get a managable spectrum out of it.

Sure, but as I said it would only be a very small signal anyway.

Quote
Karlos wrote:
Is that any clearer?

Yes, unless I have totally misunderstood :lol:

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Fourier analysis (of a sound)
« Reply #4 on: October 06, 2007, 06:52:34 PM »
So what are the implications for some half-baked home experiment? ;-) I really want to try this with a (very short) speech sound. Is that possible with software on a home computer? I don't care if I have to leave it running for a few days.

Thanks, BTW, for taking the time to go in to so much detail in your replies.


--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Fourier analysis (of a sound)
« Reply #5 on: October 07, 2007, 07:00:54 AM »
Thanks Karlos, I'll give it a go. I don't really have the time to write my own software from code examples, but I have find this software which claims to be able to transform between time and frequency domains. My Parallels Windows installation is running a macro to remove a watermark from an 800 page PDF at the moment, so I'll have to wait until it's done before I can try it out.

@nbit7
Thanks for the link. I will try that too.

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Fourier analysis (of a sound)
« Reply #6 on: October 07, 2007, 12:24:28 PM »
Why didn't I think of that??!! It would be much more fun to do it on an Amiga, and would make me feel much more smug when I show my results to my lecturer ;-) Thanks Boot_WB!

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10