Problem
Every time frequency changed, the remain part of last frequeny lost_Δt ≤ frequency_duration%(1/sample_frequency) will be dropped, in example graph which is between last frequency black sample dot (t<2) and frequeny change point (t=2).
Code Time Function: Brown
Real Mathematica Function: Blue

I think the real next sample value should be sampled at the red star,
and the lost part should be very minor so that it's usually hard to distinguish the effect.
Cause
The time lost happens on these codeMode.java, especially the force (int) cause lost
protected int convertMsToSamples(double durationMs) {
return (int) Math.round(durationMs * mSampleRate / 1000.0);
}
protected void setTone(double frequency) {
mRunningIntegral += 2.0 * frequency * Math.PI / mSampleRate;
mRunningIntegral %= 2.0 * Math.PI;
mOutput.write(Math.sin(mRunningIntegral));
}
Problem
Every time frequency changed, the remain part of last frequeny
lost_Δt ≤ frequency_duration%(1/sample_frequency)will be dropped, in example graph which is between last frequency black sample dot (t<2) and frequeny change point (t=2).I think the real next sample value should be sampled at the red star,
and the lost part should be very minor so that it's usually hard to distinguish the effect.
Cause
The time lost happens on these code
Mode.java, especially the force(int)cause lost