Created
January 10, 2019 18:00
-
-
Save kybr/76b80db23080533ee652d9684fa136a3 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
#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