Audio
Records a USB microphone to a WAV file, with a timing file that has one row per chunk and a level meter to check the signal.
Each audio module instance records one input. A webcam’s built-in microphone is listed here as well as in the cameras module; record it here for a separate WAV, or through the cameras module to put the audio in the video file.
Getting started
- Connect the microphoneUSB. The system’s other audio inputs are listed too.
- Enable the moduleCheck Audio in the Modules menu. The inputs appear in the Devices panel.
- Connect the inputClick it in the Devices panel. A level meter appears when it is ready.
- RecordStart a session and click Record.
Level meter
The meter shows the input level so you can see that the microphone is picking up sound before a trial.
| Colour | Level | Meaning |
|---|---|---|
| Green | Below −12 dB | Normal |
| Yellow | −12 to −6 dB | Loud |
| Red | Above −6 dB | Close to clipping |
For speech, a level that touches yellow on the loudest words and rarely reaches red is about right.
What is written
For each trial, a WAV file and a timing CSV in the Audio folder.
{session_dir}/Audio/{token}_AUD_trial001_MIC0_{microphone}.wav
{session_dir}/Audio/{token}_AUD_trial001_MIC0_{microphone}_timing.csv MIC0 carries the input’s index on the host. The microphone name is lower case with spaces removed.
WAV format
| Property | Value |
|---|---|
| Encoding | PCM, 16-bit signed integer |
| Channels | One. A multi-channel input is recorded from its first channel |
| Sample rate | 48 000 Hz by default. If the input cannot run at the requested rate, the module records at the rate the driver gives it and logs the change |
Timing CSV, 8 columns
Audio arrives from the driver in chunks, and the timing file has one row per chunk.
| Column | Description |
|---|---|
trial | Trial number |
module | Audio |
device_id | The input’s index on the host |
label | The trial label, if any |
record_time_unix | Host wall-clock time in the driver callback that delivered the chunk, six decimals |
record_time_mono | Host monotonic clock at the same instant, nine decimals |
device_time_unix | The driver’s ADC timestamp for the chunk, in seconds on the audio stream’s own clock, when the driver provides one. Otherwise empty |
chunk_number | Sequential chunk number, from 1 |
Example row
1,Audio,0,baseline,1774149567.378456,373235.004822011,,1 The file does not record how many samples each chunk held. RSLogger lets the driver choose the chunk size, which is constant for most drivers, so the WAV’s sample count divided by the row count gives it. Synchronization shows two ways to find the sample at a given time.
Settings
| Setting | Default | Notes |
|---|---|---|
| Sample rate | 48 000 Hz | Set in the module’s configuration file. The driver may substitute a rate the input supports |
| Channels | One | Fixed |
| Bit depth | 16-bit | Fixed |
Troubleshooting
The input is not listed
Check the USB connection and that the operating system sees the input: arecord -l on Linux, System Settings > Sound > Input on macOS, Sound settings > Recording on Windows. On Linux, your user must be in the audio group.
The meter shows nothing
Speak into the microphone or tap it. Check for a mute switch on the microphone itself. Check that the right input is connected in the Devices panel. Restart the module from the Modules menu.
The WAV is silent
The meter would have shown nothing during the trial. Check the input’s level in the operating system’s sound settings and that the microphone was not muted.
device_time_unix is empty
The driver did not supply an ADC timestamp for that input. Nothing is wrong. Use record_time_mono.
The log warns about dropped audio blocks
The computer could not write chunks as fast as they arrived. Close other programs, record to faster storage, or lower the sample rate.