Chrispy
High-performance multichannel ADC sampling and audio recording.
Loading...
Searching...
No Matches
recording Namespace Reference

Functions

bool init (uint8_t nchannels, adc::Channel *channels, SdFat *sd)
 Initialize recorder with these fields.
 
int64_t record (const char *filenames[], BitResolution res, uint32_t sample_rate, uint32_t duration_ms, uint8_t *buf, size_t sz)
 Uses the SD singleton to record to every file in files with the same sample rate and duration.
 

Function Documentation

◆ init()

bool recording::init ( uint8_t  nchannels,
adc::Channel channels,
SdFat *  sd 
)

Initialize recorder with these fields.

Parameters
nchannelsNumber of channels to expect in mic_pins and power_pins.
channelsArray of channels to record on.
sdSD card to use for recording.
Returns
(bool): True if the module was successfully initialized. False otherwise.

◆ record()

int64_t recording::record ( const char *  filenames[],
BitResolution  res,
uint32_t  sample_rate,
uint32_t  duration_ms,
uint8_t *  buf,
size_t  sz 
)

Uses the SD singleton to record to every file in files with the same sample rate and duration.

Truncates all files to be equal to the shortest lengths.

Invariants:

  • SD is initialized and in the directory recordings should go.
  • files is of at least channels length and contains valid filenames.
Parameters
filenamesArray of filenames to record to. Must be at least as long as nchannels.
resBit resolution to record at.
sample_rateRequested sample rate for each channel.
duration_msLength in milliseconds to record for.
bufBuffer allocated to receive ADC samples.
szBuffer size.
Returns
(int32_t): The file size in bytes if successful. Returns a negative value if there is an error.

Variable Documentation

◆ channels

adc::Channel* recording::channels

◆ initialized

bool recording::initialized = false

◆ nchannels

uint8_t recording::nchannels

◆ sd

SdFat* recording::sd