Files
research_and_development/ai-conversation/include/audio.h
T
Arjun Patel 8870741c3e ai conversation (#49)
* capture audio with alsa

* add brainstorm thoughts

* use basecamp project for managing this project

* add libcurl basic example

* write pcm data to file

* transcribe audio file with deepgram

* transcribe raw audio

* hit anthropic API for ai question

* create full flow with stt, anthropic, tts, and playback

This organizes some components like deepgram into own module, and also
allows gets the full flow to work every time we run the program.

* organize audio and intelligence modules

* organize header files into include directory

* docs: add readme

* docs: explain future work

* docs: add disclaimer about hardcoded audio params
2025-07-27 15:07:30 -07:00

30 lines
808 B
C

#ifndef AUDIOCAPTURE_H
#define AUDIOCAPTURE_H
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <alsa/asoundlib.h>
#include <alsa/control.h>
#include <alsa/pcm.h>
// 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