Files
audio-playground/test_audio_wasm/beep.c
T
2026-10-27 22:10:43 +01:00

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);
}
}