Skip to content

Instantly share code, notes, and snippets.

View RafalLauterbach's full-sized avatar

RafalLauterbach

  • Poland
View GitHub Profile
@jacobsebek
jacobsebek / tone_gen.c
Last active January 5, 2024 20:14
SDL2 tone generator
#include <SDL.h> // The SDL library
#include <math.h> // sin, fmod
#include <stdio.h> // printf
#define BUFFER_DURATION 1 // Length of the buffer in seconds
#define FREQUENCY 48000 // Samples per second
#define BUFFER_LEN (BUFFER_DURATION*FREQUENCY) // Samples in the buffer
void play_buffer(void*, unsigned char*, int);