Skip to content

Instantly share code, notes, and snippets.

@barometz
Created March 27, 2014 14:40
Show Gist options
  • Save barometz/9809008 to your computer and use it in GitHub Desktop.
Save barometz/9809008 to your computer and use it in GitHub Desktop.
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