mirror of
https://github.com/thestk/stk
synced 2026-02-07 01:36:16 +00:00
Version 4.2.1
This commit is contained in:
committed by
Stephen Sinclair
parent
a6381b9d38
commit
2cbce2d8bd
22
rawwaves/sine.c
Normal file
22
rawwaves/sine.c
Normal file
@@ -0,0 +1,22 @@
|
||||
// Utility to make a rawwave sine table (assumes big-endian machine).
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define LENGTH 1024
|
||||
#define PI 3.14159265358979323846
|
||||
|
||||
void main()
|
||||
{
|
||||
int i,j;
|
||||
double temp;
|
||||
short data[LENGTH + 2];
|
||||
FILE *fd;
|
||||
|
||||
fd = fopen("sinewave.raw","wb");
|
||||
for (i=0; i<LENGTH; i++)
|
||||
data[i] = 32767 * sin(i * 2 * PI / (double) LENGTH);
|
||||
fwrite(&data,2,LENGTH,fd);
|
||||
fclose(fd);
|
||||
}
|
||||
Reference in New Issue
Block a user