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
+30
View File
@@ -0,0 +1,30 @@
#include "utils.h"
#include <string.h>
size_t curl_read_callback_file(void *ptr, size_t size, size_t nmemb,
void *userdata) {
struct curl_file_data *data = (struct curl_file_data *)userdata;
size_t bytes_to_read = size * nmemb;
return fread(ptr, 1, bytes_to_read, data->file);
}
size_t curl_write_callback_response(void *contents, size_t size, size_t nmemb,
void *userp) {
size_t total_size = size * nmemb;
struct curl_response_data *response = (struct curl_response_data *)userp;
// Reallocate buffer to fit new data
response->data = realloc(response->data, response->size + total_size + 1);
if (response->data == NULL) {
return 0; // Error
}
// Copy new data to buffer
memcpy(&response->data[response->size], contents, total_size);
response->size += total_size;
response->data[response->size] = '\0'; // Null terminate
printf("read an extra %d bytes of data\n", (int)total_size);
return total_size;
}