Skip to content

Instantly share code, notes, and snippets.

@kybr
Created January 10, 2019 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kybr/76b80db23080533ee652d9684fa136a3 to your computer and use it in GitHub Desktop.
Save kybr/76b80db23080533ee652d9684fa136a3 to your computer and use it in GitHub Desktop.
#include "everything.h"
using namespace diy;
int main(int argc, char* argv[]) {
float frequency = 220;
float phase = 0;
std::vector<std::string> a(argv, argv + argc);
if (argc > 2) phase = fmod(stof(a[2]), 2.0f);
if (argc > 1) frequency = stof(a[1]);
float perSampleIncrement = frequency / SAMPLE_RATE;
while (true) {
phase += perSampleIncrement;
if (phase > 1) phase -= 1;
printf("%f\n", phase);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment