Signal recording
The “Signal recording” block saves the samples of one or all channels to a file on the server for subsequent analysis in external programs (Python, MATLAB, GNU Octave, audio editors). The recording duration is 1 to 600 s.
Purpose
- accumulation of data for statistical processing and algorithm debugging;
- comparison of the original signal and the processing result for identical input data;
- obtaining reference recordings of sources (for example, an engine or a mechanism);
- playback and expert auditory assessment (WAV format).
Recording modes
| Windowed | Continuous | |
|---|---|---|
| FPGA mode | single-shot window capture | streaming |
| Channels | 4 or one | 4 or one |
| Word length | 24 bits | 16 or 24 bits (determined by UART throughput) |
| fs | any (7.81…48.83 kHz) | 1 channel: 16 bits — up to 43.2 kHz, 24 bits — up to 28.8 kHz; 4 channels: 16 bits — up to 10.8 kHz |
| Continuity | no gaps within a window; gaps between windows | no gaps |
| Fraction of the signal recorded | η = Twin/Tcycle (13…41 %, see “Capture”) | 100 % |
| Processing | filter and equalizer, each window with zero initial conditions | filter, equalizer, noise reduction |
| Formats | CSV, CSV.gz | CSV, CSV.gz, WAV |
Windowed mode is used when all four channels with 24-bit resolution are required, or a sampling rate that does not allow continuous transfer. If a windowed measurement is already running, the recording uses its fs and window length; otherwise the measurement is started for the duration of the recording. Windowed recording is unavailable during listening.
Continuous mode is used for analysing processes in time without interruptions: envelope, transients, frequency variation. If the same channel is being listened to at the same fs, the recording attaches to it without restarting the stream; otherwise the stream is restarted with the recording parameters.
Recorded signal
| Value | Contents |
|---|---|
| original | Samples received from the FPGA, unprocessed |
| processed | Output of the processing chain (see the table of modes) |
| both | Original and processed signals in adjacent columns (CSV only) |
The filter description and the noise reduction parameters at the start of the recording are stored in the file header and in
the list of recordings. In windowed mode the first S samples of each window of the processed signal correspond to the filter
transient; the value of S is given in the header (the settle= line).
File formats
| Format | Description | Size (estimate) |
|---|---|---|
| CSV | Text: a header with parameters (lines starting with “#”), a line of column names, one line per time instant | ≈ 8 bytes per value |
| CSV.gz | CSV compressed with gzip (RFC 1952); read by the same tools without unpacking | 2–3 times smaller than CSV |
| WAV | RIFF/WAVE, linear PCM, 16 or 24 bits, 1 or 4 channels; continuous mode and a single signal only | 2–3 bytes per value |
WAV word length: 16 bits for the original signal transferred with 16-bit resolution without shift; 24 bits otherwise. The WAV header is updated once per second during recording, so the file is valid even if the recording terminates abnormally. Free disk space is checked before the recording starts.
CSV structure
Example of a file header (the server writes header comments in Russian):
# created=2026-11-24T17:34:19+02:00
# mode=stream fs_hz=10557.432432
# непрерывно, без пропусков: t_s = n/fs
# signal=исходный
# units=отсчёты 24 бит (полная шкала ±8388608); dBFS = 20·log10(|x|/8388608); dB SPL ≈ dBFS + 120
n,t_s,ch0,ch1,ch2,ch3
0,0,-9728,1593344,-10752,-11520
1,0.000095,-9216,-1930240,-10752,-11520
| Column | Mode | Contents |
|---|---|---|
window | windowed | Window number in the recording |
n | both | Windowed: sample number in the window (0…W−1); continuous: sample number from the start of the recording |
t_s | both | Time, s. Continuous: n/fs. Windowed: window start time by the computer clock + n/fs |
ch0…ch3 | both | Original signal (or the processed one, if only it is recorded) |
ch0_f…ch3_f | both | Processed signal when recording “both” |
In windowed mode the header contains the window length (window=) and, with processing, the transient duration
(settle=). The window start value t_s is an estimate by the computer clock: the windows are not
contiguous, and the interval between them is determined by the transfer cycle.
Sample representation
- Values are given in the 24-bit two's complement scale: full scale ±8,388,608 (223).
- When transferred with 16-bit resolution, values are written in the same scale and are multiples of 256 (28).
- With an FPGA shift (s > 0) the original values are divided by 2s and may be fractional.
- The processed signal is written with a precision of 0.1 scale unit.
Processing recordings
from scipy.signal import welch
df = pd.read_csv("hdl-mic_2026-11-24_173419_all_cont_raw.csv.gz", comment="#") # .gz is read directly
fs = 1 / df.t_s.diff().median() # or the fs_hz value from the header
x = df.ch0.to_numpy() / 2**23 # fraction of full scale
f, pxx = welch(x, fs=fs, nperseg=4096) # PSD by Welch's method
# windowed recording: process window by window
for w, g in df.groupby("window"): ...
For windowed-mode recordings the analysis is performed separately for each window (grouping by the window column);
concatenating windows into a continuous signal is incorrect. For the processed signal in windowed mode the first S samples of
each window are excluded.
Storage and download
- Files are stored on the server under anonymized names; the “My recordings” list shows only the recordings of the current user, with the number of files and their total size.
- Download is performed via a personal link valid for 1 h. Partial download (HTTP Range) is supported: an interrupted download can be resumed.
- Downloaded file name:
hdl-mic_<date>_<time>_<all|chN>_<win|cont>_<raw|proc|raw+proc>.<csv|csv.gz|wav>. - A recording can be stopped early; the file is kept with the status “stopped”.
Limitations
- A windowed recording contains η = 13…41 % of the signal; it is unsuitable for analysing processes continuous in time.
- Incomplete windows (data loss in the USB channel, on average one in 150–300) are not included in the recording.
- Continuous recording of four channels is possible only with 16-bit resolution at fs ≤ 10.8 kHz.
- In continuous mode the stream is not resynchronized: if bytes are lost in the USB channel, the data of subsequent samples are shifted until the stream is restarted. Integrity is checked by recording with the test generator.
- Only one recording runs at a time.