Gaborator reference: render.h

Spectrogram Rendering with Power-of-Two Scaling

template <class OI, class T>
void render_p2scale(const analyzer<T> &a,
                    const coefs<T> &c,
                    int64_t xorigin, int64_t yorigin,
                    int64_t xi0, int64_t xi1, int xe,
                    int64_t yi0, int64_t yi1, int ye,
                    OI output);

Render a rectangular array of pixel values representing signal amplitudes in time-frequency space, optionally scaling up or down by powers of two.

a
The spectrum analyzer that produced the coefficients c
c
A set of spectrogram coefficients to render
xorigin
The point in time corresponding to pixel X coordinate 0, in samples. Due to limitations of the implementation, this must currently be 0. Instead, horizontal translation must be done by means of converting the origin to pixel units and adding it to both xi0 and yi0.
yorigin
The band number of the frequency band corresponding to pixel Y coordinate 0. Typically 0, or the band number of a reference frequency such as 440 Hz, to make that frequency always coincide exactly with a pixel regardless of the scale factor.
xi0
The X coordinate of the first pixel to render
xi1
The X coordinate one past the last pixel to render
xe
The horizontal scaling exponent. One horizontal pixel corresponds to 2xe signal samples.
yi0
The Y coordinate of the first pixel to render
yi1
The Y coordinate one past the last pixel to render
ye
The vertical scaling exponent. One vertical pixel corresponds to 2ye frequency bands.
output
A random access iterator through which the output pixel amplitude values will be written. This is typically a float *. A total of (xi1 - xi0) * (yi1 - yi0)) values will be written.

Utility Functions

template <class T>
unsigned int float2pixel_8bit(T amp);

Convert a normalized amplitude value to a 8-bit greyscale pixel value.

amp
A floating point value representing a signal amplitude, nominally ranging from 0 to 1

Returns an pixel value ranging from 0 to 255 (inclusive), using an approximation of the sRGB gamma.