ai conversation #49

Merged
talksik merged 14 commits from ai-conversation into main 2025-07-27 22:07:30 +00:00
3 changed files with 44 additions and 1 deletions
Showing only changes of commit 1d0cb5bb93 - Show all commits
+1 -1
View File
@@ -2,7 +2,7 @@ CC = gcc
CFLAGS = -Wall -g
TARGET = audio_capture
SRC = audio_capture.c
LIBS = -lavdevice -lavformat -lavcodec -lavutil -lasound
LIBS = -lavdevice -lavformat -lavcodec -lavutil -lasound -lcurl
$(TARGET): $(SRC)
$(CC) $(CFLAGS) -o $(TARGET) $(SRC) $(LIBS)
+27
View File
@@ -3,6 +3,7 @@
#include <alsa/asoundlib.h>
#include <alsa/control.h>
#include <alsa/pcm.h>
#include <curl/curl.h>
// NOTE: find this via `arecord -l`
#define ALSA_MIC_HARDWARE_DEVICE "hw:3"
@@ -13,6 +14,32 @@ void print_pcm_state(snd_pcm_t *pcm_handle) {
printf("State of pcm handle: %s\n", state_name);
}
size_t write_callback(void *contents, size_t size, size_t nmemb, void *userp) {
size_t total_size = size * nmemb;
printf("%.*s", (int)total_size, (char*)contents);
return total_size;
}
void test_request() {
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://www.google.com");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
res = curl_easy_perform(curl);
if (res != CURLE_OK)
{
fprintf(stderr, "curl failed: %s\n", curl_easy_strerror(res));
return;
}
curl_easy_cleanup(curl);
}
}
int main() {
snd_pcm_t *pcm_handle = NULL;
+16
View File
@@ -0,0 +1,16 @@
[
{
"arguments": [
"/usr/bin/gcc",
"-c",
"-Wall",
"-g",
"-o",
"audio_capture",
"audio_capture.c"
],
"directory": "/home/talksik/Documents/research_and_development/ai-conversation",
"file": "/home/talksik/Documents/research_and_development/ai-conversation/audio_capture.c",
"output": "/home/talksik/Documents/research_and_development/ai-conversation/audio_capture"
}
]