• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by adrielags · Apr 19, 2019 at 12:20 PM · shaderaudiosoundprocessingsignal

How to choose FFT Window type

Hi. I noticed there are this types on the FFTwindow function from Unity

Rectangular W[n] = 1.0. Triangle W[n] = TRI(2n/N). Hamming W[n] = 0.54 - (0.46 COS(n/N) ). Hanning W[n] = 0.5 (1.0 - COS(n/N) ). Blackman W[n] = 0.42 - (0.5 COS(n/N) ) + (0.08 COS(2.0 n/N) ). BlackmanHarris W[n] = 0.35875 - (0.48829 COS(1.0 n/N)) + (0.14128 COS(2.0 n/N)) - (0.01168 COS(3.0 * n/N)).

How do I know which one is the best to use in my case and why? I did some research but it still not very clear to me, they all seem to be ok to use in different situations. If anyone know a good article or something about this topic would be very useful too!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
7
Best Answer

Answer by aldonaletto · Apr 19, 2019 at 01:31 PM

The FFT gets a subset of samples (a number of consecutive audio samples) and calculates how much of each harmonic is present in that subset. But the FFT "thinks" that all samples outside the subset are 0, which seems like a big rectangular pulse (as wide as the number of samples) multiplied by the signal, and the harmonics of such "pulse" are mixed with the audio signal.
The windowing function is a trick that greatly reduces these spurious harmonics: the samples are multiplied by special factors that vary along the window, and the resulting FFT gets much cleaner. Since these factors are calculated on-the-fly, a more complex windowing function can slow down the FFT - that's why Unity allows selection of the window type.
Rectangular means no correction window at all, which's fast but dirty. Triangle is a triangular window, cleans reasonably the FFT at very low cost. Hamming, Hanning, Blackman and BlackmanHarris windows are progressively more slower and cleaner alternatives (evaluating COS is usually a slow operation).
If you're going to use the FFT for precise operations like evaluating the pitch of a given sound, select the more complex windows - Blackman or BlackmanHarris. For less stringent operations like spectrum displays, evaluation of audio ranges (treble, bass, mid etc.) and other applications where precision is not required, try triangle, Hamming or Hanning windows (even the rectangular window may be good enough in many cases).

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by elix · Apr 19, 2019 at 12:45 PM

It's depends on continuity of the data. When start and end data are seamless,Rectangular is best to use. Other situation, may be Hamming.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

195 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Some audio does not play on Windows build but works perfectly in editor and on Mac 1 Answer

Intensity of sound. -1 Answers

Audio Not Always playing in Game 0 Answers

FMOD Distance Parameter: At 0 distance the sound is very quiet when it's supposed to be full volume? 0 Answers

Using Distance from AudioSource 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges