 #define minPulse      412 // microseconds
 #define maxPulse     2300 // microseconds
 
+// duration correction
+#define minimumDuration    50 // milliseconds
+#define timedTurnMul        0.9907
+#define timedTurnAdd       -8
+#define durationGlissMul    0.9332
+#define durationGlissAdd -283
+#define doubleGlissMul      0.9144
+#define doubleGlissAdd   -331
 // pitch correction
-#define durationGlissMul 0.95
-#define durationGlissAdd -290
-#define glissAdd       -0.45
+#define glissAdd           -0.45
 
 /*************************
  * communication commands

    findSensor(max(maxPulse, endpulse));
}

int timedTurn(int halfturns, unsigned long duration, bool dir) {
    int fullspeedsteps = (halfTurnSteps * halfturns) - (accelSteps * 2);
    unsigned long pulse = ((duration * 1000L) - (maxPulse * accelSteps)) /
                          (accelSteps + fullspeedsteps);
    int accelsteps = accelSteps;
    if (pulse > maxPulse) {
        accelsteps = 0;

    return pulse;
}

long _durationGliss(long duration, float startpitch, float endpitch,
        int sustainstart, int sustainend, bool dir, bool recentre) {
    // adjust duration
    duration = (duration + durationGlissAdd) * durationGlissMul;
    if (duration < minimumDuration)
        return 0;
    int startsustainpulse = pitchToPulse(startpitch + glissAdd - 1);
    int startpulse = pitchToPulse(startpitch + glissAdd);
    int endpulse = pitchToPulse(endpitch + glissAdd);
    int endsustainpulse = pitchToPulse(endpitch + glissAdd - 1);
    int accelsteps = map(startpitch, 48, 72, accelSteps-10, accelSteps+10);
    int decelsteps = map(endpitch, 48, 72, accelSteps-10, accelSteps+10);
    long glisstime = ((duration - sustainstart) * 1000L) -
        (((max(maxPulse, startpulse) + startpulse) * (accelsteps / 2)) +
         ((endpulse + max(maxPulse, endpulse)) * (decelsteps / 2)));
    if (glisstime < (minimumDuration * 1000L))
        return 0;
    int glisssteps = glisstime / ((startpulse + endpulse) / 2);
    int sustainstartsteps = (sustainstart * 1000L) / startpulse;
    int sustainendsteps = (sustainend * 1000L) / endpulse;
