Is the FFT effective for analyzing real world music?

In summary, the FFT doesn't work well with real music because it only applies to a repeated waveform. You can suppress the unwanted artefacts by taking a long string of samples and "windowing" them down to a smaller number of samples in the middle. However, this topic gets very hard very quickly. Have a look in this Wiki article.
  • #1
btb4198
572
10
so I have a program that pull data from a microphone and does an FFT.
now it is working for computer Generated Sin waves like from:
http://onlinetonegenerator.com/
and
youtube..

but not for read work sound from youtube.
so I do not have a piano, but I have been using youtube videos that play middle c scale
and my program is not working so will with it...

does the FFT not work well with real music ?
is there anything I should add to the FFT?
I
 
Engineering news on Phys.org
  • #2
The thing about an FFT is that it only applies (by definition) to a repeated waveform. You take a string of samples and FFT (A Discrete Fourier Transform) assumes that goes round and round for ever. An FFT of just any old string of samples can give you a load of very misleading results, telling you there is a structure of harmonics (of the repeat of the sample loop) when there may well not be in the original signal source.

One way round this is to take a very long string and then 'window' them down to a smaller number of samples in the middle, which will suppress the unwanted artefacts a bit. Unfortunately, this topic gets very hard very quickly. Have a look in this Wiki article.

Another way to get some sense would be to look at the samples on a digital editor and to snip out a sequence that looks as though it repeats. But you will find it hard to get any information about the transients of the attack of notes.

You can still have fun with waveforms and their transforms and see if you can make sense out of relating the two together.
 
  • #3
sophiecentaur said:
One way round this is to take a very long string and then 'window' them down to a smaller number of samples in the middle, which will suppress the unwanted artefacts a bit. Unfortunately, this topic gets very hard very quickly. Have a look in this Wiki article.

You don't need to take a "very long" string. Windowing is a good idea for any signal-processing using Fourier analysis.

I agree the subject can get esoteric, but a practical recipe that doesn't throw away any information is to use the Hanning (or Hann) window (as defined on the wiki page), and split the data into chunks that overlap half way. In other words if you use a 1024 point FFT, then do FFTs on samples 1...1024, 513...1536, 1025...2048, etc. That choice of window function makes the whole process invertible, because the overlapping window functions add up to exactly 1 everywhere. The window function ##(1 - \cos 2x)/2 = \sin^2 x##, the successive windows look like an alternation between ##\sin^2 x## and ##\cos^2 x##, and ##\sin^2 x + \cos^2 x = 1##.

If you are interested in the transients at the beginning and end of the data, add some 0's at the start and end, so half the first chunk of data is zero .

If you are processing "music", one FFT will show you all the harmonics of all the notes that were played in that time interval, which can just look like a mess. It might work better to use fairly short FFTs, e.g. 4096 points which is about 1/10 of a second at 44100 samples /second. See http://en.wikipedia.org/wiki/Short-time_Fourier_transform
 
Last edited:
  • #4
ok I am windowing ... I think...
I taking 16384 samples at a time..
and i forget about the other samples
well I just do not use them
are you saying I should make them 0 and put them in my FFT?
 
  • #5
btb4198 said:
ok I am windowing ... I think...
I taking 16384 samples at a time..
and i forget about the other samples
well I just do not use them
are you saying I should make them 0 and put them in my FFT?

No, he's saying you should apply a filter to your data (a window) such that the beginning and the end of the data sequence are roughly equal. Otherwise there will be significant "frequency leakage" in your FFT and it could be very misleading.
 
  • #6
what kind of filter ? and what should it do ?
 
  • #8
  • #9
If you are doing an FFT on 16384 samples and the Nyquist frequency is 22050 Hz, the resolution of your FFT frequencies will be 22050/16384 = 1.35 Hz.

If you didn't do any windowing and are just looking at a plot of the FFT data, getting within 2 or 3 frequency increments of of the "accurate" frequency is probably about as good as you will get. In any case, there is no guarantee that the pitch of the music you played from youtube was actually A = 440 Hz.
 
  • #10
I have a filter that removes low noise ..
is the magnitude is less 300,000
I do not display it

that is kind of like windowing
and you are right about the youtube Video
 

Related to Is the FFT effective for analyzing real world music?

1. What is real world music?

Real world music refers to any type of music that is created or performed by humans in their everyday lives, as opposed to music that is produced in a studio or through electronic means. It includes a wide range of genres such as folk music, traditional music, and street performances.

2. What is the FFT (Fast Fourier Transform) and how is it used in music?

The FFT is an algorithm that is used to convert a signal from its original domain (such as time) to a representation in the frequency domain. In music, the FFT is commonly used to analyze and visualize the frequency components of a sound wave, allowing us to identify the different pitches and harmonics present in a piece of music.

3. How does real world music differ from recorded music?

Real world music is unique in that it captures the natural sounds and imperfections of live performances, whereas recorded music is often edited and polished to create a more polished and perfect sound. Real world music also tends to have a more organic and authentic feel, while recorded music can sometimes sound artificial or manufactured.

4. Can FFT be used to analyze different types of real world music?

Yes, the FFT can be used to analyze any type of sound signal, including real world music. However, the results may vary depending on the complexity and composition of the music. For example, a solo acoustic performance may have a simpler frequency spectrum compared to a full orchestra piece.

5. How does understanding real world music and FFT benefit us?

Studying real world music and using techniques like FFT can provide valuable insights into the cultural, social, and historical aspects of different music traditions. It can also help us better understand the science behind sound and how it is processed by the human brain, which has implications for fields such as music therapy and acoustics.

Similar threads

  • STEM Educators and Teaching
Replies
3
Views
1K
  • Electrical Engineering
Replies
9
Views
1K
Replies
6
Views
2K
  • Electrical Engineering
Replies
1
Views
974
  • Electrical Engineering
Replies
10
Views
2K
  • Electrical Engineering
Replies
29
Views
6K
Replies
38
Views
4K
  • Electrical Engineering
Replies
4
Views
2K
Replies
1
Views
1K
  • Classical Physics
Replies
12
Views
874
Back
Top