WaveWarp Users' Guide: last updated 28 February 2002
  

9.3-- ASCII file format for storage of spectra |
 
|
In order for you to produce WaveWarp-readable spectral data files from an application other than MATLAB, the appropriate file specifications are included below. The file format is straightforward. All spectral data are stored in floating point double-precision (64 bit) format (although WaveWarp truncates them to 32 bit format for real-time processing).
There is no requirement on the filename or the filename extension. However, to avoid confusion it is advisable to stick to the default extension ".txt" as appears by default in the WaveWarp file I/O dialog boxes.
9.3.1-- Magnitude spectra file format |
 
|
Some WaveWarp components such as those which implement noise reduction by spectral subtraction, require to store only the magnitude spectra of the data (e.g. for storing the measured average noise spectra for later use as noise reduction templates). Such a magnitude spectrum , which is computed as the absolute value of the (dc term plus) positive-frequency FFT of real data) is stored in an ASCII file as described in Table 12.
Table 12 ASCII file structure for storing magnitude spectra readable by WaveWarp
Line number
|
Entry
|
Notes
|
1
|
WW_SPECTRUM_MAGNITUDE
|
ID description of the spectrum (string variable type).
|
2
|
Fs
|
Sample rate in Hz of the original time-series before performing the FFT (integer variable type).
|
3
|
N
|
Length of the spectrum (integer variable type).
|
4 to N+3
|
X(1) to X(N)
|
Absolute value of the data in each of the N FFT bins corresponding to positive frequencies ranging from 0 to Fs/2 (double variable type).
|
See for example the files in the "wwtemplates/denoise/spectra" sub-directory of the WaveWarp root directory.
9.3.2-- General (complex) spectra file format |

|
Other WaveWarp components such as the Spectrum Analyser and the Frequency Response Analyser, enable you to save the entire complex spectrum to a file (e.g. for external post-processing and analysis). Note that WaveWarp only stores the dc lag and positive-frequency parts of the general FFT spectra (since all audio signals are real!). A spectrum is stored in an ASCII file as described in Table 13.
Table 13 ASCII file structure for storing complex spectra readable by WaveWarp
Line number
|
Entry
|
Notes
|
1
|
WW_SPECTRUM_COMPLEX
|
ID description of the spectrum (string variable type).
|
2
|
Fs
|
Sample rate in Hz of the original time-series before performing the FFT (integer variable type).
|
3
|
N
|
Length of the spectrum (integer variable type).
|
4 to 2*N+3
|
Real{X(1)}, Imag{X(1)} to Real{X(N)}, Imag{X(N)}
|
The data in each of the N FFT bins (the corresponding real and imaginary parts of each bin entry are stored as real numbers in interleaved rows) corresponding to positive frequencies ranging from 0 to Fs/2 (double variable type). The data is scaled "naturally" such that the FFT absolute value in a given bin corresponds one-to-one to the signal rms level in that bin.
|
See for example the files in the "wwtemplates/demo_fft_spectra" sub-directory of the WaveWarp root directory.

   
|