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
This commit was merged in pull request #49.
This commit is contained in:
Arjun Patel
2025-07-27 15:07:30 -07:00
committed by GitHub
parent 57133f3d2c
commit 8870741c3e
15 changed files with 693 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
#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