Writing Visualizations
Prev
Next

Chapter 2. Writing Visualizations

Everyone loves these, and Noatun makes it easy. The timer, the processing, Noatun does it before your plugin even notices. The most difficult part is just making the drawing routines fast. In the future, we'll have an SDL library available. Let's begin.

The first step is deciding what kind of Visualization it is. Noatun supports the FFTScope type, and the RawScope type. FFTScopes (Fast Fourier Transforms) are useful for when you want data grouped by frequency. Internally, it may or may not actually be Fourier transforms that do the work, however, you don't need to worry about that. The RawScope just returns the current data of the length you specify.

This document will show you how to write very simple, often slow, visualizations.

Getting Started (With Visualizations)

Create a standard plugin, the Type field in your spec file (.plugin) is "visualization". Calling start(); will then have the necessary scopeEvent() called on a regular basis.

In the constructor for all Visualizations, there is a number to set the timeout, in milliseconds. 50 to 250 are a good range, it does depend on what looks best. Experiment.

All scopeEvents give you float* data, or an array of floats, the amount of elements in this array is that of the size argument. On some scopes, there are two arrays of floats, one for each channel, and they are each the size of the size argument.

Sound

Sound is logarithmic (in several ways). For example, you will have to square the intensity to double the volume. Same goes to the frequency compared to the pitch.

The range of most values (both Raw and FFT), are from -1 to 1. However, it doesn't always fall in this range.

Prev
Next
Home