Created
March 27, 2014 14:40
-
-
Save barometz/9809008 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double φ; | |
const double S, f; | |
short buffer[K]; | |
short[] getSamples(int count) { | |
short samples[count]; | |
const double dφ = 2 * π * f / S; | |
for (n = 0..(count-1)) { | |
φ = (φ + dφ) % (2π); | |
int position = floor(φ/(2π) * K); | |
samples[n] = buffer[K]; | |
} | |
return samples; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment