Skip to content

Instantly share code, notes, and snippets.

@mandel59
Created July 22, 2012 18:46
Show Gist options
  • Save mandel59/3160672 to your computer and use it in GitHub Desktop.
Save mandel59/3160672 to your computer and use it in GitHub Desktop.
YAGO synthesizer の使い方。仕様は仮のもので、後で色々変更すると思う。
#include <iostream>
#include <yago.hxx>
int main()
{
constexpr float sample_rate = 44100.0f;
constexpr double delta_t = 1.0 / sample_rate;
constexpr std::size_t buffer_size = 1024;
float buffer[buffer_size];
yago::Oscillator<decltype(buffer)> osc(440);
yago::Envelop<decltype(buffer)> env(0.2, 0.2, 0.8, 0.5, 0.8, 1.0);
std::cerr << delta_t << std::endl;
for (yago::time t = 0.0; t < 2.0; t += buffer_size * delta_t)
{
osc.signal(t, sample_rate, buffer);
env.signal(t, sample_rate, buffer);
std::cout.write((const char *) buffer, sizeof(buffer));
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment