HDL-MIC · Documentation

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

Recording modes

WindowedContinuous
FPGA modesingle-shot window capturestreaming
Channels4 or one4 or one
Word length24 bits16 or 24 bits (determined by UART throughput)
fsany (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
Continuityno gaps within a window; gaps between windowsno gaps
Fraction of the signal recordedη = Twin/Tcycle (13…41 %, see “Capture”)100 %
Processingfilter and equalizer, each window with zero initial conditionsfilter, equalizer, noise reduction
FormatsCSV, CSV.gzCSV, 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

ValueContents
originalSamples received from the FPGA, unprocessed
processedOutput of the processing chain (see the table of modes)
bothOriginal 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

FormatDescriptionSize (estimate)
CSVText: a header with parameters (lines starting with “#”), a line of column names, one line per time instant≈ 8 bytes per value
CSV.gzCSV compressed with gzip (RFC 1952); read by the same tools without unpacking2–3 times smaller than CSV
WAVRIFF/WAVE, linear PCM, 16 or 24 bits, 1 or 4 channels; continuous mode and a single signal only2–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):

# hdl-mic: запись сигнала INMP441 через ПЛИС
# 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
ColumnModeContents
windowwindowedWindow number in the recording
nbothWindowed: sample number in the window (0…W−1); continuous: sample number from the start of the recording
t_sbothTime, s. Continuous: n/fs. Windowed: window start time by the computer clock + n/fs
ch0…ch3bothOriginal signal (or the processed one, if only it is recorded)
ch0_f…ch3_fbothProcessed 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

L = 20·lg(|x| / 223) dBFS;    Lp ≈ L + 120 dB SPL (INMP441 sensitivity: −26 dBFS at 94 dB SPL)

Processing recordings

import pandas as pd, numpy as np
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

Limitations