Want to take part? Sign in or apply for an account below
Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.
for (int i=0;i<piece.duration*samplesPerSecond;i++) {
float curSample=0;
float curTime=i/samplesPerSecond;
for all sounds s in piece such that
s.start_time>=curTime and s.end_time<curTime {
float curFrequency=s.value(curTime - s.start_time);
float curLevel=s.envelope.value(
(curTime - s.start_time)/s.duration());
float curValue = s.waveform.value(curFrequency, curTime);
curSample += s.level * curLevel * curValue;
}
writeSample(curSample*(dynamicRangeMax-dynamicRangeMin) + dynamicRangeMin);
}
float Sine::value(float f, float t) {
return sin(2*f*t*PI);
}
1 to 8 of 8