OutputFile ws=new OutputFile(1);
int waveform=0;
double freq=0.01;
double lasttime=0;
boolean gate=false;
ProcessElement sid=new SID6581();
// set any parameters you like. SID6581 treats unset parameters as 0.
// you may edit this template to test any features of the SID6581.
sid.setSource(VOL.i, ConstStream.c(0.8), OUT.i);
sid.setSource(SQUA1.i, ConstStream.c(1), OUT.i);
sid.setSource(DUTYCYCLE1.i, ConstStream.c(.75), OUT.i);
sid.setSource(RING1.i, ConstStream.c(1), OUT.i);
sid.setSource(SYNC1.i, ConstStream.c(1), OUT.i);
sid.setSource(A1.i, ConstStream.c(5/15.0), OUT.i);
sid.setSource(D1.i, ConstStream.c(8/15.0), OUT.i);
sid.setSource(S1.i, ConstStream.c(9/15.0), OUT.i);
sid.setSource(R1.i, ConstStream.c(3/15.0), OUT.i);
ProcessElement m=new mul();
// multiply the output with 0.05 to reduce signal volume, OutputFile expects abs(signal)<1
m.setSource(IN_IMAG.i, ConstStream.c(0.95), OUT.i);
m.setSource(IN.i, sid, OUT.i);
advancerRegistry.registerAdvancer(ws);
ws.setSource(0, m, OUT.i);
advancerRegistry.registerAdvancer(sid);
for(double time=0; time<10; time+=1/globalParameters.getSampleRate()){
if(time>lasttime){
gate=!gate;
sid.setSource(GATE1.i, ConstStream.c(gate), OUT.i);
lasttime+=0.3;
if(gate){
waveform++;
waveform%=3;
sid.setSource(SQUA1.i, ConstStream.c(waveform==0), OUT.i);
sid.setSource(TRIA1.i, ConstStream.c(waveform==1), OUT.i);
sid.setSource(SAWT1.i, ConstStream.c(waveform==2), OUT.i);
freq*=Math.exp(Math.log(2)/12d);
sid.setSource(StandardParameters.FREQUENCY1.i, new ConstStream(freq), StandardParameters.OUT.i);
sid.setSource(StandardParameters.FREQUENCY3.i, new ConstStream(freq/2), StandardParameters.OUT.i);
}
}
advancerRegistry.advanceAll();
}
try{