instruments.h (528B)
- #ifndef _XOPEN_SOURCE
- #warning Should #define _XOPEN_SOURCE 700
- #define _XOPEN_SOURCE 700
- #endif
- #include <math.h> // sinf(), M_PI
- float
- pure_sin(struct au_header *header, int hertz, int t)
- {
- float w1 = 2*M_PI*hertz/header->samplerate;
- return sinf(w1*t);
- }
- float
- clarinet(struct au_header *header, int hertz, int t)
- {
- float w1 = 2*M_PI*hertz/header->samplerate;
- float tune = sin(w1*t) + 0.75*sin(3*w1*t) + 0.5*sin(5*w1*t) + 0.14*sin(7*w1*t) + 0.5*sin(9*w1*t) + 0.12*sin(11*w1*t) + 0.17*sin(13*w1*t);
- return tune/10;
- }