Skip to content

Instantly share code, notes, and snippets.

@yoyz
Created December 2, 2017 19: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 yoyz/3b74116143d052c0de359a85f17ed5a0 to your computer and use it in GitHub Desktop.
Save yoyz/3b74116143d052c0de359a85f17ed5a0 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include "synth_waveform.h"
#include "synth_pwm.h"
#include "AudioStream.h"
AudioSynthWaveform asw;
AudioSynthWaveformPWM pwm;
int main()
{
audio_block_t * blk_rcv;
static audio_block_t blklst[20];
AudioStream::initialize_memory(blklst, 20);
asw.begin(WAVEFORM_SAWTOOTH);
asw.begin(WAVEFORM_TRIANGLE);
asw.frequency(440);
asw.amplitude(0.75);
asw.pulseWidth(0.15);
pwm.frequency(440);
pwm.amplitude(0.75);
FILE * FD = fopen("file","w");
while(1)
{
asw.update();
fwrite(blklst[19].data,128,1,FD);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment