14 lines
311 B
C
14 lines
311 B
C
#include <stdint.h>
|
|
#include "math.h"
|
|
#define SAMPLE_COUNT 44100
|
|
|
|
static float SAMPLES[SAMPLE_COUNT];
|
|
|
|
float* get_samples() { return SAMPLES; }
|
|
|
|
void beep(uint32_t sample_rate, float freq) {
|
|
for (int i = 0; i < SAMPLE_COUNT; ++i) {
|
|
SAMPLES[i] = sintau((float)i * freq / (float)sample_rate);
|
|
}
|
|
}
|