* FFTExplorer Help Page

## FFTExplorer #version# Help Page

FFTExplorer is a signal processing workshop

(although "playground" might be more accurate).

Copyright © 2011, Paul Lutus — Message Page

FFTExplorer is released under the GPL.

Visit the FFTExplorer Home Page for more information and to be sure you have the latest version.

NOTE: For formatting reasons, users may want to temporarily make the FFTExplorer program frame larger to properly read these instructions.

NOTE: Users may prefer to search this document using the search feature at the bottom of this frame.

Introduction | The Basics | External Sources
Display Adjustments | In Depth | User support

Introduction

> FFTExplorer is a very portable Java program meant to explore modern signal processing, primarily by converting time-domain signals into frequency-domain equivalents using something called a "Fourier Transform".

> Most modern technology relies either directly or indirectly on some kind of signal processing, so it is worthwhile to become familiar with it. FFTExplorer is designed to produce an educational experience that is as much fun as possible, with sights and sounds meant to entertain as well as teach.

> FFTExplorer accepts inputs from its own internal signal generator as well as external sources such as a microphone or other live source attached to your system's sound card, or a sound or music file (FFTExplorer accepts mp3 and other audio file types). FFTExplorer displays these sources in live, animated time-domain and frequency-domain forms to show how they relate to each other.

> The FFTExplorer user interface has been carefully designed to allow intuitive gestures to stand in for typing at the keyboard. For example, most data entry fields can be changed by hovering the mouse cursor over them and spinning the mouse wheel. And when this is done, the FFTExplorer displays responds in real time, creating a game-like interactive experience.

> Educators take note: FFTExplorer represents a way for your students to acquire a familiarity with a number of advanced and very important signal processing concepts and methods, in an interactive form meant to balance fun and education.

> FFTExplorer remembers all the user's entries and choices, and places its configuration file in a directory it creates, so the user's settings and choices are preserved. This directory is located at #userdir# on this machine, and it contains a configuration file named "FFTExplorer.ini" containing quite a lot of detailed information unique to your use of the program (when run as an applet, FFTExplorer saves your choices in a browser cookie).

> Because FFTExplorer is written in Java, it is compatible with most modern computers running most operating systems. This means it can be used in a classroom setting with many different kinds of computers available. To run FFTExplorer most efficiently, be sure to acquire the latest free Java version at the Java download site.

The Basics

> First Run

> When FFTExplorer is run for the first time, it displays two oscilloscope-style windows with a control panel at the bottom. The upper window displays information in the time domain, while the lower window displays the same information in the frequency domain. What this means is that the horizontal axis of the upper (time-domain) window has units of time (seconds, milliseconds, etc.) while the horizontal axis of the lower (frequency-domain) window has units of frequency (Hertz, kilohertz, etc.). The distinction between the two will become clear in the examples below.

> > NOTE: FFTExplorer doesn't create any files and it can't hurt your computer, so feel free to experiment — play with the program's settings, see what they do. Experiment.

> To start the activity, press the "Start" button at the lower right. If FFTExplorer hasn't been run yet and has its default configuration, you will see two displays that loook like this:

> > Time-domain display | Frequency-domain display

> > NOTE: If the time and frequency displays don't resemble the above, click the "Configure" tab, press the "Reset All Defaults" button, then click the "Synthesizer" tab again.

> This display shows the FFTExplorer synthesizer's output, at the moment showing an "amplitude-modulated" (AM) waveform. Most people have heard of "AM Radio" — this is what an AM radio wave looks like. An AM wave consists of a carrier frequency and one or more modulation frequencies (the modulation frequencies change the amplitude of the carrier wave, hence the name). To change the carrier frequency, place your mouse cursor over the field marked "Carrier Freq. Hz" and spin the mouse wheel (if you don't have a mouse wheel, too bad, you will need to type your entries or use the up and down arrow keys).

> > NOTE: Virtually all FFTExplorer's data entries can be made, not by typing, but by positioning the mouse cursor over the data fields and spinning the mouse wheel. Another similar method, for those without a mouse wheel, is to click a data entry field and change its value by pressing the up and down keys. Both the mouse-wheel and arrow-key change rates are amplified by holding down the Shift and/or Alt keys at the same time.

> Noise Level

> The synthesizer has a number of entries to play with, including a noise level. The noise level is included because FFTExplorer is designed to show some of the problems real scientists and engineers must deal with in collecting information about the world, and the world is very noisy.

> Increase the noise level setting with the mouse wheel as explained above (the mouse wheel's action is amplified if you hold down the shift key while spinning it), and notice that, even though the original AM wave is eventually overwhelmed by noise in the upper time-domain display, you can still make out the three frequency components in the lower frequency-domain display.

> Sound Output

> After you have experimented with the AM wave and want to try something new, click the "Sound" selector at the lower right of the control panel. This activates FFTExplorer's sound output and allows you to hear what the AM wave sounds like.

> > NOTE: While its sound features are activated, FFTExplorer's display's update time is slower, and in the synthesizer mode it's just one update per second. This arises from the fact that, while driving the sound card, FFTExplorer must remain synchronized with the real world on the other side of the sound card. This means after delivering one second worth of data, FFTExplorer must wait until the sound card has used the data up — which takes one second. When not driving the sound card, FFTExplorer is relieved of any responsibility to stay synchronized with reality and can produce data at a much higher rate of speed.

> While playing with the sound feature, increase and decrease the noise level as before, but notice that if the noise level is set high enough, you can no longer see the original AM wave in the time-domain display, and you cannot hear the wave in the sound output, but the frequency-domain display still detects and shows it:

> > Time-domain noisy AM wave | Frequency-domain noisy AM wave

> Detecting Weak Signals

> This example shows one of the many advantages of modern signal processing. Now imagine that the AM wave is actually a signal from space, maybe from some aliens who just want to say hello. But distances in space are literally astronomical, the alien signal must travel a long way and becomes progressively weaker as it travels, nature has many ways to make noise, so the original signal may be completely overwhelmed by noise by the time it arrives — just like this example. But by using advanced signal processing, we can recover what would be lost. This, by the way, is exactly how SETI (the Search for ExtraTerrestrial Intelligence) searches for alien signals, and it explains why they need so much computer power.

> Other Synthesizer Modes

> The synthesizer also can generate an FM (frequency-modulated) wave, as well as square, triangle and sawtooth waves. Each of these waves produces different frequency spectra and sounds. It's worthwhile to experiment with these modes to see what frequency spectra they create. While exploring these different kinds of waves, it's important to realize that any periodic waveform can be constructed out of a series of frequency components. What this means is that the time-domain waveform in the upper display is fully represented by the series of spectral lines in the lower display, and the relationship can be reversed — the upper time-domain waveform can be mathematically constructed using only the frequency-domain lines in the lower display.

> This is the single most important fact to know about the Fourier Transform — a wave's two forms (time-domain and frequency-domain) have a reciprocal relationship (you can get one from the other). FFTExplorer focuses on creating frequency-domain spectra out of time-domain signals, but the reverse transformation is just as easy (click here for a more complete exposition of these issues).

External Sources

> > NOTE: When FFTExplorer is being run as an applet (in a Web page), the features described in this section are disabled for security reasons. To run FFTExplorer without any constraints, you need to download it and run it as a local Java application (FFTExplorer is free).

> FFTExplorer can accept inputs from your computer's sound card (from a microphone or any signal attached to the sound card's line input), or from sound and music files. To experiment with these modes, click the "External Sources" tab.

> Microphone

> To use a microphone with FFTExplorer, first experiment with the microphone directly to make sure it is working and delivering a signal through your sound card. Once you are satisfied that the microphone is properly connected and working, click the "Start" button next to the "Sound Card Source" label.

> > NOTE: For all modes that use the sound card or external signal sources, the FFTExplorer display rate decreases. This results from the fact that the program spends most of its time waiting for external data to become available. There are some remedies described below that minimize the slowdown effects, but they cannot be eliminated entirely.

> Sound Card Adjustments

> The user may want to optimize FFTExplorer's display update speed while using a sound card source. The best combination of settings maximizes the sound card's data rate and minimized the Fourier Transform data array size. Here is how to tune these settings:

> 1. Adjust the "Data Rate" field below the "Sound Card Source" label, choose the largest numerical value your sound card will accept. Most modern sound cards will accept the FFTExplorer default value of 192000 (units are bits per second). An unacceptable value (too high) will ring a bell and the "Sound Card Source" label will turn red. An acceptable value will cause the label to turn black and data will begin to appear in the time and frequency displays.
> 2. Move to the "Configure" tab and adjust the "FFT Array Size" entry for the smallest value that produces acceptable frequency spectra. Small numerical values speed up the conversion process but create coarse spectra with little detail. Large values produce better, more detailed spectra, but take more time to produce.
> 3. Experiment with these settings to create an acceptable result. Remember that the width of the frequency spectrum in Hertz is governed by setting (1) above, while the number of spectral lines, the amount of detail, is governed by item (2).

> Audio File Source

> To play a sound file, press "Start" next to "Audio File Source" on the "External Sources" tab. Navigate to an audio file and click "Accept". FFTExplorer will play the audio file while simultaneously showing its time and frequency representations. This particular display is somewhat intriguing, not to say addicting. For music files in particular, it may not be like anything you've ever seen before. Watching the detailed, varying spectral lines of a favorite piece of music while simultaneously listening to it can be a memorable experience.

> The "FFT Array Size" setting on the "Configure" tab may be adjusted as the audio plays, to trade off the speed of the display against the amount of spectral detail.

Display Adjustments

> Here is how to use the controls on the time and frequency displays. Each display has two adjustments (and remember to use the mouse-wheel adjustment method explained above), one for either time or frequency, the other for amplitude. For simplicity's sake these fields have fixed values selected from a list, which makes the mouse-wheel selection method very quick.

> Amplitude Adjustment

> For either display, if you expect to see data but all you see is a horizontal line, increase the "Vertical Gain" setting for that display. Conversely, if the display is filled with too much data or a series of vertical lines, decrease the "Vertical Gain" setting.

> Frequency Adjustment

> If there is no data visible, or if all the spectral lines are crowded against the left margin, decrease the frequency setting. Conversely, if the spectral lines look too wide or are not grouped as you would like, increase this setting (another way to increase the spectral detail is explained above as item (2) above under "Sound Card Adjustments").

> Display Mouse Controls

> First, the displays have two axes, X (horizontal) and Y (vertical). X represents either time or frequency, Y represents amplitude.

> Hovering the mouse over either of the displays will produce a flyout text containing the time (or frequency) and amplitude for the present mouse coördinate. This means the user can point the mouse at a spectral line of interest and get a reading of its frequency and amplitude (this same information is present on the program status bar). To show or hide this flyout text, press the right mouse button.

> Spinning the mouse wheel over one of the displays zooms in on the X (time or frequency) axis at the cursor's position. To zoom into a particular region of the displayed frequency spectrum, point the mouse cursor at the region of interest and spin the mouse wheel to zoom in (or out) with that region centered.

> The difference between zooming the display directly as described above, and adjusting the time or frequency controls as explained earlier, is that a direct time or frequency control adjustment expands the X axis from the left margin, while a mouse zoom gesture expands the display in both directions, centered on the mouse cursor. The latter action is more generally useful, but both have their place.

> Finally, dragging the mouse (meaning moving the mouse while holding its button down) horizontally pans the display's X axis (this only works after a zoom action has expanded the horizontal scale beyond the boundaries of the display).

> The "Blue Bar"

> Below the two displays, and above the control panel, you will find a thin blue bar with some option selectors. They are:

> - "Time". This option toggles the time-domain display. Deselect this option to give the frequency-domain display more space.
> - "Frequency". This option toggles the frequency-domain display. Deselect this option to give the time-domain display more space.
> - "Horizontal". This option rearranges things so the time and frequency displays are ordered in a row rather than a column. For certain display geometries and application sizes, this may make the data easier to see.
> - "Antialias". This option improves the appearance of the display, but takes more time to draw.
> - "Line Width". This choice represents the line width for drawn lines and the minimum width for frequency spectral lines. Values greater than one will slow down drawing.

> On the topic of speed ...

> Display Speed Notes

> Here is a list of things that affect display speed:

> - First and foremost, the "FFT Array Size" option on the "Configure" tab has a big impact on display speed. This adjustment balances the amount of frequency spectrum detail against update speed. Low settings result in very fast updates but coarse spectra, with only a few, wide lines. High settings produce very detailed spectra but they take longer to compute.
> - All options that involve the sound card slow the display down, because this option ties FFTExplorer's displays to the real world. In some cases such as using the sound option in the synthesizer, the display is limited to one frame per second (in order that FFTExplorer's displays not fall out of synchronization with the sound). For technical reasons, other uses of the sound card don't have this dramatic impact on update speed, but all uses of the sound card slow FFTExplorer down from its native computation and drawing speed.
> - Line widths greater than one, and use of the "Antialias" option, will slow display updates as well.

In Depth

> This section covers some more technical aspects of the program. FFTExplorer shows the different ways periodic waveforms can be represented — they can be expressed either as a function of time or frequency, and these two representations are equivalent and interchangeable. FFTExplorer also converts waveforms between the two forms using a method called a "Fourier Transform". Beginning with Carl Friedrich Gauss and extending to the present, people have been thinking of more efficient ways to perform Fourier Transforms (which represent a change from a time representation to a frequency representation or the reverse).

> The present speed and efficiency champion for this conversion task is called the "Fast Fourier Transform", or "FFT". Even though this method was understood for many years, it only came into general use with the advent of inexpensive computer power.

> Basically, an FFT algorithm accepts an array of discrete (meaning composed of separate samples) real-world data and converts it from a time ordering to a frequency ordering, or the reverse. In FFTExplorer, the upper and lower (or left and right) displays represent the time and frequency orderings respectively, of whatever signal the user supplies to the program. For a more technical exposition of Fourier Transforms and the FFT specifically, read my online article "Signal Processing Workshop".

> Here are some general comments about FFTExplorer:

> - As is true for most common FFT algorithms and for technical reasons, the data array must be some power of 2 in length. The user will notice about the "FFT Array Size" selector on the "Configuration" tab that it contains a list array sizes that are all powers of 2. This fixed-list arrangement prevents the entry of an unworkable value.
> - The FFT's conversion speed declines proportional to O(N log N), N being the array size, so choose the smallest array size consistent with acceptable results.
> - The FFT algorithm's frequency resolution is equal to the array size divided by 2 in Hertz (in keeping with the Nyquist-Shannon sampling theorem).
> - The "Sample Rate" entry, to the left of the "FFT Array Size" entry, was originally a normal data field, but for most FFTExplorer operating modes its value is constrained by hardware factors, like available sound card conversion rates or the data rate of a music file. Consequently in most operating modes this field won't accept a user entry.
> - FFTExplorer was originally written in C++ on the Linux platform, but to make it more widely available I decided to rewrite it in Java. My primary worry about this conversion was that Java, not being a particularly fast language, would show unacceptably slow data conversion rates while executing the FFT. But to my surprise, the Java version of this program is only marginally slower than the C++ version, for the reason that both programs spend most of their time drawing lines or waiting for input from an external source, activities that are unrelated to the math-intensive FFT conversion task and that tend to blunt the advantage C++ has over Java (because both languages use similar graphics routines).
> - The present version of FFTExplorer benefited from my earlier effort and is much better than its predecessor in every way, as well as being compatible with all modern operating systems.

> Memory issues

> In most environments and for most user settings, it's not likely that FFTExplorer will run out of memory, but just in case I offer this remedy. If memory limitations become an issue, it's always possible to launch FFTExplorer in a way that provides more memory than the Java virtual engine will supply without encouragement. Here is a program launch command that assures an adequate supply of momory:

> > `java -Xmx1000m -jar (path to FFTExplorer)/FFTExplorer.jar`

> This remedy might be required if a very large conversion array is specified for some exotic purpose.

User support

> There is a more detailed description of FFTExplorer and signal processing in general located at the FFTExplorer Home Page.

> Because FFTExplorer is released under the GPL (but please visit The CareWare Page anyway), there is no user support. This help file plus the sort of knowledge available in textbooks and online should be sufficient to help the user make it productive.

> If you find a bug in FFTExplorer, please report it at http://www.arachnoid.com/messages. Thanks!