Wave File Logging and -Analysis

Spectrum Lab is designed for real-time analysis of audio data. But you can also process data saved in a wave files (and others), and you can save the incoming (or outgoing) audio stream in a wave-file without interrupting the analysis.

Contents

  1. Wave File Logging
  2. Triggered Audio Recorder
  3. Wave File Analysis
    1. Other supported file formats (for analysis)
  4. Audio Playlist
  5. Controlling audio files through the interpreter
  6. Extra chunks in a wave file header (written by SpecLab)
  7. Auxiliary files (same name and folder as the logged audio file, but different file extension: *.aux; may contain GPS- and other data)

See also:

Triggered Audio Recorder;
Transmitting and receiving Ogg / Vorbis internet audio streams;
Analysing other audio file formats using Winamp (2) plugins;
Spectrum Lab's main index .


1. Wave File Logging

While audio samples are analyzed in real time, you can write them into a wave file (for "logging", "archiving" etc).

You can either log the "input" or the "output" in a wave file (but currently not both at the same time). A look at the circuit window shows the "input" at the left and the "output" at the right side. For most applications you will save the incoming audio stream ("input") as a wave file to have all opportunities for later post-processing.

You don't necessarily have to save the wave file data with the same sample rate as the ADC. Instead, you can use the lowest possible sample rate for the wave file to save a lot of disk space... consider this: A software VLF radio uses an ADC running at 44.1ksamples/second, and converts the signal down to 650 Hz, filtered to a bandwidth of 100Hz. Practically, it would be enough here to save the "downconverted" signal with 5512 samples/second which occupies only 12.5 % of the disk space. (5512 is the lowest "standardized" sample rate supported by all soundcards)

The settings for wave file logging can be modified in the configuration dialog, which can be opened through the main menu (Options .. Wave file settings) :

wave file settings

To starting or stop logging use either the file menu, or one of Spectrum Lab's interpreter commands.

While saving the audio stream in a wave file, the progress button will tell you how many kBytes are already written to the file. Be careful not to run out of disk space while logging, because Windows may crash in that case. If this is an issue, use a different partition of even a different harddisk to record wave files.

If a GPS is connected (and configured), there may be an auxiliary file (*.aux) written along with each audio file (*.wav). The auxiliary file will contain GPS coordinates, timestamps, and possibly some other data. If you don't need the AUX files, set the GPS output interval to zero in the GPS configuration window. Except for the file extension, aux files have the same names as their corresponding wave audio files. Without auxiliary files, there will only be one single GPS position in an extra chunk ("inf1") of the wave file header. More details about logging (exporting) GPS data along with audio files can be found in an extra document (gps_decoder.htm).

(*) In the author's opinion, a kByte ("kilobyte") still consists of 1024 bytes. Don't urge me to call this a "kibibyte" from now on, just because some egghead discovered that 1024 is not equal to 1000. A "kilobyte" has never been 1000 bytes. Full stop. :o)

back to top


2. Triggered Audio Recorder

As an alternative to the "normal" logging of wave files as explained in the previous chapter, the recording of audio files can also be started automatically (without using the FILE menu, and without the help of the interpreter). For example, you want to record the raw input only if "something interesting" happens (for example, the call of a bat in a certain frequency range). You may also want to record a few seconds before the event actually happened, and a only few seconds after that (to avoid filling the harddisk with useless data).

To configure the triggered recoder, select Options..Wave File Settings in SpecLab's main menu, on the panel labelled Triggered Audio Recorder (details in an extra document, please follow the link).

back to top


3. Wave File Analysis

To start or stop wave file analysis, use Spectrum Lab's main menu (under "File" ... "Audio Files & Streams" ).

Decide which of this file analysis modes you want to use by choosing the corresponding submenu. Then a file selector box opens in which you can select the audio file.

Note:
To analyze more than one file in a single over, use the CTRL- or shift-key in the file selector. This way you can select more than one file, like a little "play list".

After selecting one or more wave-file to be analysed, a dialog window appears where some parameters of the wave file are displayed. Some parameters (like the sample rate) can be adjusted for the following analysis.

The sample rate in a file is often different from the sample rate of the soundcard. For ELF work, the wave files are often decimated to a low sample rate to save disk space. For this reason, you often need a different FFT size to analyze files than for real-time analysis with the soundcard. Before the above dialog opens, the program calculates the best FFT size to achieve a similar frequency resolution as for real-time analysis. The resulting resolution is shown in the audio file analysis dialog (see screenshot above). If you are not satisfied with the FFT settings, you can modify the settings before clicking "OK" to start the file analysis.

While the analysis runs, the progress button shows the current playing time, the file name, and some other info.

Note: The file analysis without playback runs much faster than the real-time analysis. You can select "slow","medium" and "fast" analysis in the dialog, or on the "Wave Files" tab in the configuration dialog. The different "speeds" have the following effects (in fast file analysis mode only !):

Note: The option 'plotting the result in fast file analysis mode' was implemented in October 2004. It didn't work in older versions !

When finishing Fast File Analysis, the program will not automatically switch back to real-time operation (analyze samples from the soundcard), because you may want to analyze other files too, and see the result in the same spectrogram and/or plot of analyzed data. To return to real-time processing with the soundcard, use the main menu, "Start/Stop"..."Start Audio Thread".

3.1 Other supported file formats (for input)

Besides the uncompressed wave file format, the program supports the following file formats for input (analysis):

3.2 Analysing 'Raw' (headerless) binary data files

These raw, uncompressed, headerless data files - for example, the output of a 16-bit DAC dumped into a file without any format conversion.

To analyse these files, you will need to fill out some additional fields in the 'File Analysis' dialog which automatically pops up after selecting the file:

back to top


4. Audio Playlist

Explained in a separate file .


5. Controlling audio files via interpreter commands

The recording and playback can be controlled by interpreter commands, for example through one of the programmable buttons in the left part of the main window. You can assign any function to a button, for example to start / stop a recording, or to temporarily pause replay / analysis.

A list of commands related with wave-audio file can be found in the file 'interpr.htm#wave_proc' . Here just an excerpt:

In addition, there's an extra set of commands for the Triggered Audio Recorder .


6. Extra chunks in a wave file header (written by Spectrum Lab)

For certain applications, it was necessary to embed some 'extra' information in wave files written by Spectrum Lab.

If this causes problems with other programs (which cannot skip such unknown chunks, like very old versions of Spectrum Lab..), you can turn off this feature in the configuration dialog .

The following 'extra' RIFF chunks may be written in wave audio files by Spectrum Lab, depending on the configuration :

"inf1" :  Info-Chunk #1
Contains  various "info" as a parsable, text string (zero-terminated like a "C" string, variable length).
Format:  <token>=<value> (space delimited if more than one token/value pair exist in the string)
Example: sr=95999.6917235 ut=1297602397.5586035 glat=52.14583 glon=8.45833 masl=0.0 kmh=0.0
Key to decode the string:
  sr= precise sampling rate (samples per second), "measured" or "calibrated".
  ut= Unix timestamp (seconds elapsed since 1970-01-01 00:00:00 UTC)
  glat= geographic latitude in degrees, positive north, negative south .
  glon= geographic longitude in degrees, positive east, negative west .
  masl= GPS height in meters above sea level. Only valid (and non-zero) if a GPS receiver is connected and operating .
  kmh= GPS speed in kilometers per hour .
Note: If no GPS receiver is connected, the lat/lon fields may still contain valid data. If GPS is not available (or not activated), the geographic position will be taken from the 'System Settings' .


7. Auxiliary files (to log "other data", like GPS, along with the audio files)

If a GPS is connected (and configured), there may be an auxiliary file (*.aux) written along with each audio file (*.wav). The auxiliary file will contain GPS coordinates, timestamps, and possibly some other data. If you don't need the AUX files, turn off the option 'save extra data in auxiliary files' on the 'Wave Files' tab in SL's configuration screen:

wave file settings

To change the interval in which GPS data are emitted to the aux file, modify the GPS output interval in the GPS configuration panel (see right image below, default is 1 second) :

Screenshot of the GPS Receiver Control Panel      

Except for the file extension, aux files have the same names as their corresponding wave audio files. Without auxiliary files, there will only be one single GPS position in an extra chunk ("inf1") of the wave file header.

All details about logging (exporting) GPS data along with audio files can be found in an extra document (gps_decoder.htm).
An example of an aux file with GPS- and additional data (added by means of an interpreter command) is here .


Last modified: 2011-10-26 .

back to top