Spectrolite Help

Table of Contents

Introduction

Spectrolite visualizes sound in real time in the form of spectrograms. It is focused on constant-Q spectrograms, and now also supports traditional constant-bandwidth (STFT) as well as mel-scale spectrograms.

What is a spectrogram?

A spectrogram is a way to visualize the frequency content of a sound or other signal as a function of time. In Spectrolite, time is shown on the horizontal axis and frequency on the vertical axis. Brightness corresponds to the signal amplitude, or sound volume.

Starting Spectrolite for the first time

When you start Spectrolite for the first time, it will ask for permission to use the microphone. If you don't allow this, Spectrolite won't be able to hear anything, and the display will stay black. If access to the microphone was denied when Spectrolite was started the first time, you can still grant access later in the Settings app under Privacy / Microphone.

To check that Spectrolite is working, try whistling; you should see a trace on the display that rises and falls with the pitch of your whistle.

At the top left corner is a button that opens a set of controls including a Gain slider. The Gain slider controls the overall brightness of the spectrogram display. If the display is all black, move the slider to the right to increase gain and bring out the signal. If you are in a noisy environment, the background noise may drown out the signal and make much of the display white; if that happens, move the slider left to reduce the gain.

Spectrogram types

Spectrolite supports three types of spectrograms: constant-Q, constant-bandwidth, and mel-bandwidth spectrograms. These are selected using the buttons labeled CQ, CBW, and mel, respectively, in the Type control.

Constant-Q spectrograms

Constant-Q spectrograms are the main focus of the Spectrolite app, and what sets it apart from most other spectrogram apps. Constant-Q spectrograms use a logarithmic frequency scale, and the audio signal is divided into bands that are evenly spaced and equally wide on that scale. In other words, the bands are all the same width when measured in logarithmic units such as octaves, semitones, or orders of magnitude, but the width varies when measured in linear units such as Hz.

The bandwidth of each band can be defined as the band's center frequency frequency divided by the quality factor Q. In a constant-Q spectrogram, the value of Q is the same for all bands, hence the name.

Constant-Q spectrograms are well suited to visualizing music because musical notes appear evenly spaced.

From a time-domain perspective, a constant-Q spectrogram can be seen as a way of analyzing the signal over time windows that stretch inversely with the frequency such that they will always fit the same number of oscillations of the signal. This is the essential property of a wavelet, and consequently the constant-Q spectrogram can be considered a form of wavelet analysis.

Constant-bandwidth spectrograms

The constant-bandwidth spectrogram is simplest and most common type of spectrogram. It is commonly calculated by dividing the audio signal into short time windows of a fixed duration and calculating the Fourier transform of each window. This is also known as a Short-Time Fourier Transform or STFT, and produces a set of frequency bands that all have the same bandwidth (measured in Hz) and are evenly spaced in frequency (again, measured in Hz).

Constant-bandwidth spectrograms are useful for visualizing harmonic series, as the harmonics will appear evenly spaced.

Mel-scale spectrograms

In a mel-scale spectrogram, the frequency bands are spaced according to the mel scale, which is designed to mimic human pitch perception. A mel scale spectrogram is approximately constant-Q at high frequencies, and smoothly transitions to approximately constant-bandwidth at low frequencies.

Panning and zooming

The spectrogram initially grows towards the right, but when the edge gets close to the right edge of the screen, it will automatically start scrolling so that the most recent audio stays visible on the screen. If you want to look at older audio, you can swipe on the display to go back in time or forward again to the present. You can also pinch to zoom in time, frequency, or both: a horizontal pinch zooms in time, a vertical pinch zooms in frequency, and a diagonal pinch zooms uniformly in both time and frequency.

Time limits

Spectrolite keeps a limited amount of recorded audio in memory. This is usually about two minutes, but may vary depending on the audio sample rate of your device. If you let the display constantly auto-scroll such that the most recent audio is always visible, the oldest audio is automatically erased so that the scrolling display can continue to show the newest audio indefinitely. If you swipe back to view older audio, as long as you don't swipe too far or stay there too long, recording will continue uninterrupted, but if you swipe back by more than about a minute or swipe back and stay there, the recording will automatically stop. If you then swipe forward to the present again, recording will automatically resume, but the recording will have a gap.

Time-frequency trade-offs

Spectrum analysis involves a fundamental trade-off between time and frequency resolution: the higher the frequency resolution, the lower the time resolution, and vice versa.

In a constant-Q spectrogram, the frequency resolution is constant over the whole frequency range when measured in logarithmic units such octaves, semitones, or orders of magnitude, but it varies when measured in linear units such as Hz. The resolution in Hz is highest (or in other words, the bandwidth is narrowest) when analyzing low frequencies, for example around the lower edge of human hearing at 20 Hz.

Because the frequency resolution in Hz varies by frequency, the time resolution also varies by frequency: high frequencies have a higher time resolution than low ones. This can be demonstrated visually by making a short, impulse-like sound, for example by tapping on the device with a fingernail. This will produce a characteristic horn-like shape that is sharpest at the top (high-frequency) end where the time resolution is highest, and flares out exponentially towards the bottom (low-frequency) end where the time resolution is lower. This shape is also the basis of the Spectrolite app icon.

You can control the overall trade-off between time and frequency resolution by changing the value of Q. This is done by moving the Q slider. Moving the slider to the right increases Q, which increases the frequency resolution and decreases the time resolution. Visually, this has the effect of making the spectrogram sharper in the vertical direction and blurrier in the horizontal direction. Moving the slider to the left has the opposite effect.

When a constant-bandwidth or mel-scale spectrogram type is selected, the Q slider is replaced by a Bandwidth slider, which lets you make a similar time-frequency resolution tradeoff by adjusting the analysis bandwidth. The bandwidth is displayed next to the slider in units of Hz or mel as appropriate. Moving the slider towards the right decreases the bandwidth, which has a similar effect to increasing Q in the constant-Q case.

Time, frequency, and amplitude scales (with Pro purchase only)

If you have purchased the Pro features, you can enable time, frequency, and amplitude scales. The time scale shows the time since the start of the recording, either in seconds or in hours, minutes and seconds. The frequency scale can show either units of semitones (labeled by their note names), Hz, or mel.

When you zoom the display, subdivisions of the time and frequency scales will automatically appear and disappear to keep clutter under control. For example, the time scale will initially show divisions of 10 seconds, but as you zoom in, 1 second and 0.1 second subdivisions appear. The note scale will initially only show octaves, but as you zoom in, semitone subdivisions appear.

The amplitude scale appears at the bottom of the screen. It contains a horizontal trace similar to the spectrogram trace of a sine wave of increasing amplitude, labeled in dBFS. To estimate the amplitude of a frequency component in the spectrogram, find the part of the line having the same brightness and width, and read the amplitude off the dBFS scale. The dBFS units stands for decibels relative to full scale, where 0 dBFS corresponds to a sine wave of the greatest amplitude that can be digitally represented without clipping, or with a peak floating point value of ±1.0. Since most signals are of lower amplitude than this, the dBFS numbers are usually negative.

The amplitude scale also doubles as a convenient way to adjust the gain without having to open the controls to access the Gain slider. Simply drag the scale horizontally; this will move the dBFS labels relative to the stationary trace, and the spectrogram display will update accordingly.

Spectrum view (with Pro purchase only)

The View control lets you switch between the spectrogram view and a spectrum view, where frequency is shown on the horizontal axis and amplitude on the vertical axis. Like the spectrogram view, the spectrum view supports touch panning and pinch zooming in both the horizontal and the vertical direction. The Q factor can be adjusted and frequency and amplitude scales can be selected using settings shared with the spectrum view.

Like the spectrogram view, the spectrum view is based on constant-Q analysis, where the bandwidths of the analysis filters scale with frequency. This means lower-frequency bands will have narrower bandwidths, and consequently, they will respond more slowly to changes in the signal than the higher-frequency bands do. You can see this by tapping on the device; this will result in a "wave" moving from right to left as the higher-frequency bands respond first and the lower-frequency bands take successively longer. This effect is most noticeable at high values of Q.

When the signal includes random noise, the spectrum can fluctuate quickly, particularly in the higher frequencies where the analysis filters respond the fastest. To calm the display, use the Damping slider, which applies an adjustable amount of time-averaging to the spectrum. A setting of 0 gives the fastest response, and larger values make the spectrum change more slowly.

Note that in a constant-Q spectrum, a white noise signal will show a rising slope of 3 dB per octave, and the spectrum of a pink noise signal will be flat.

Tap to measure (with Pro purchase only)

To measure the frequency and amplitude of a frequency component, simply tap on it. The frequency is displayed both in Hz and as a musical note and offset in cents (¢), and the amplitude is displayed in dBFS.

When frequency components are closely spaced, zooming in will make it easier to tap the desired one. It is not necessary to hit it exactly — the tap point will automatically snap to the center of the closest detected frequency component.

The measurement function works in both the spectrogram view and the spectrum view, and uses a different frequency estimation method in each. In the spectrogram view, the measurement makes use of the signal phase, and can yield accurate measurements of the instantaneous frequency even for short-duration signal bursts. In the spectrum view, the measurement is based on locating a peak in the time-averaged magnitude spectrum, which can be more accurate for long-duration signals in background noise.

The measurement function is intended for measuring stationary sinusoidal signal components, such as the fundamental and harmonics of periodic waveforms. Accuracy will be reduced if the frequency and/or amplitude change over time, and in the presence of noise. The measurement function is not suitable for measuring transient or noise signals.

Sharing

By tapping the Share icon you can share, save, or print the current spectrogram or spectrum view.

Audio input

Tapping Audio input shows the currently selected audio input and related settings.

When using a device with multiple built-in microphones, the Source setting lets you select which one to use. Some external audio interfaces also support this setting for selecting between multiple sets of inputs, for example front and rear jacks.

When using a built-in microphone, the Polar pattern setting shows the polar pattern, or directivity of the microphone. With some devices and microphones, you can select among multiple patterns such as omnidirectional or cardioid.

The Channels setting shows the current number of audio channels, either 1 (mono) or 2 (stereo). If your hardware can operate in either mono or stereo, you can select which one you prefer. Stereo is typically only supported when using an external audio interfaces. Although some iOS devices have built-in stereo microphones, using them with Spectrolite is not supported because Spectrolite configures the iOS audio system in measurement mode for maximum accuracy, and iOS does not support the stereo functionality of the built-in microphones in this mode.

When stereo is selected and supported by the hardware, both channels will be displayed in a single spectrogram using a different color for each. Similarly, the spectrum display (if purchased) will show the spectrum of each channel using a different color.

Colors

If your device is running iOS 14 or newer, you can change the colors of the spectrogram, playhead, and scales (if purchased) by tapping one of the color wells to the right.

Using external audio sources

In addition to the built-in microphone, Spectrolite also works with the headset microphone and with other compatible audio input devices, such as compatible USB audio interfaces connected via a Lightning to USB Camera Adapter. Spectrolite uses the default audio input, which typically is the most recently attached audio input device.

More Apps

Check out our other apps at www.waxingwave.com!

Support

If you have any problems with Spectrolite, please email support@waxingwave.com. If it's working fine, please write a review in the App Store.

Legal

Spectrolite is Copyright © 2019-2023 Waxing Wave.

Spectrolite is powered by the Gaborator spectrogram library.