#ifndef AUDIOCAPTURE_H #define AUDIOCAPTURE_H #include #include #include #include #include #include // NOTE: find this via `arecord -l` #define ALSA_MIC_HARDWARE_DEVICE "hw:3" #define ALSA_SPEAKER_HARDWARE_DEVICE "default" // Captures audio for given seconds, and returns file name that we captured the // audio into char *audio_capture(uint seconds); /* count: how many bytes in the buffer * returns int: 0 if success, -1 if failure * NOTE: This function assumes that the audio data is using: * - linear16 formatting (each sample is 16 bits) * - one channel (1 sample) * - with 48000 HZ sampling rate * Hence, it's 2 bytes per frame. */ int audio_play(char *buf, size_t byte_count); #endif // AUDIOCAPTURE_H