Triggered Audio Recorder (in Spectrum Lab)
In addition to the 'normal' wave-file logging routine implemented in Spectrum Lab, there is the possibility to save audio streams in disk files triggered by certain events, such as ...
The last point is the reason why the "triggered audio recorder" is different from SpecLab's normal wave recording routine: Only the 'Triggered Audio Recoder' has its own, quite large buffer in RAM which is permanently filled with the last N seconds of audio, without keeping the hard disk busy. Only when this recorder is triggered, it begins to write the data from the buffer to disk.
The current status of the triggered recorder is displayed as a small symbol in the menu of SL's main window :
passive (gray)
pre-trigger
phase
Recording
post-trigger
phase
The triggered recorder was designed to operate entirely automatic, which means recording is controlled by a trigger signal. Additionally, the triggered recorder can be started and stopped manually: Click on the status indicator (in SpecLab's main menu) to open a popup where you can configure / start / stop the recorder, and see the current status of the recorder in plain text (like "waiting for trigger", "recording", etc).
Note: If the triggered audio recorder was started manually, it won't stop just because the (automatic) trigger condition is FALSE. When manually started, the recorder must be manually stopped. When automatically started (i.e. trigger condition became TRUE), it will stop when the trigger condition became FALSE again, *and* the post-trigger interval has expired.
In this document, we begin with a simple example demonstrating the basic usage of the triggered audio recorder.
See also: Wave File Settings; normal wave file logging (started from the menu or via command); Spectrum Lab's main index .
Let's assume you want to record the call of bats in a certain frequency range. Five seconds of data shall be recorded before the event actually happened (let's call this the pre-trigger area). While the bats are loud enough, the recording shall continue. Then, if no sound exceeded the programmed threshold for ten seconds, the recording shall stop to avoid filling the harddisk with unimportant data (let's call those ten seconds the post-trigger area).
First configure the triggered recoder: Select Options..Wave File Settings in SpecLab's main menu, with the panel Triggered Audio Recorder (we'll configure the universal trigger later):
See also:
The Triggered Audio Recorder can use SL's 'universal trigger module' to start (and stop) saving an audio stream to disk. Details about the trigger, how to select the trigger source, how to set the threshold and hysteresis etc can be found here. To configure the universal trigger, select "View/Windows" in SL's main menu, and select "Spectrum Lab Components (circuit window)". Locate the trigger box (it's near the lower right corner of the window), and click on it to open this popup menu:
After adjusting the trigger parameters (if necessary), select the trigger source. It will often be "L1", the left input channel from the soundcard aka "Line In".
In addition to the "universal" trigger, you can start or stop the recorder by setting/clearing the trigger flag via command, or manually as explained in the introduction.
Sets the trigger-flag for the recorder only (not for the "universal trigger module" in general). N can be any numeric expression. A NON-ZERO value of N sets the trigger (so the recorder starts recording, if enabled). N = 0 (zero) clears the trigger-flag, which will stop the recorder after the post-trigger time expires.
Note: If the universal trigger is also enabled for the triggered audio recorder, the actual trigger flag which starts the recorder will be a logic "OR"-combination of the trigger-flag from all sources. This also applies to the manual trigger flag, which you can set through SpecLab's main menu. In other words, if *ANY* of the trigger sources is "TRUE", the recorder will be started.
The command "rec.trigger" is most useful in the conditional action table (for example, if your script just detected a meteor, and you want to record the past few seconds before the meteor was detected, triggered by the script).
The current state of the trigger condition can be read with the "rec.trigger" function (in that context, it acts as a function, not a command). The next example demonstrates the use of this function for a programmable button (in SL's main menu) which shows the current trigger state, and toggles it when clicked:
"rec.trigger="+((rec.trigger)?"ON":"off")
rec.trigger = !rec.trigger
How does this work ? The function rec.trigger returns
zero, if the trigger condition is FALSE, otherwise TRUE. The boolean negation
(exclamation mark as operator in the C programming language) turns FALSE
into TRUE, and TRUE into FALSE. The result (inverted trigger flag) is finally
set as the new trigger flag when passed to the command
rec.trigger, which then starts or stops the triggered audio
recorder. The effect can also be seen in the recorder indicator in SL's main
menu.
Allows to get and set the current file index for the audio recorder (accessable like a variable).