 
 long _durationGliss(unsigned long duration, float startpitch, float endpitch,
         int sustainstart, int sustainend, bool dir, bool recentre) {
+    // adjust duration
+    duration = max(0, duration + durationGlissAdd) * durationGlissMul;
     int startsustainpulse = pitchToPulse(startpitch + glissAdd - 1);
     int startpulse = pitchToPulse(startpitch + glissAdd);
     int endpulse = pitchToPulse(endpitch + glissAdd);

    int glisssteps = (halfTurnSteps * halfturns) - (accelSteps * 2);
    int startpulse = pitchToPulse(startpitch + glissAdd);
    int endpulse = pitchToPulse(endpitch + glissAdd);
    digitalWrite(dirPin, dir);
    delayMicroseconds(pulseWidth);
    for (int i=0; i<accelSteps; i++) {
        oneStep(map(i, 0, accelSteps, max(maxPulse, startpulse), startpulse));
        if (alarmState) return;
    }
    for (int i=0; i<glisssteps; i++) {
        oneStep(map(i, 0, glisssteps, startpulse, endpulse));
        if (alarmState) return;
    }
    for (int i=0; i<accelSteps; i++) {
        oneStep(map(i, 0, accelSteps, endpulse, max(maxPulse, endpulse)));
        if (i>(accelSteps - decelLook) && digitalRead(sensorPin)) break;
        if (alarmState) return;
    }

        oneStep(pulse);
        if (alarmState) return;
    }
    for (int i=0; i<accelsteps; i++) {
        oneStep(map(i, 0, accelsteps, pulse, startstoppulse));
        if (i>(accelSteps - decelLook) && digitalRead(sensorPin)) break;
        if (alarmState) return;
    }
