             for (byte d=0; d<rDurlength; d++) {
                 newDuration[d] = serialIncoming[++i];
             }
-            midDuration = Duration; // midDuration is previous duration
-            Duration = atoi(newDuration);
+            midDuration = Duration; // midDuration is previous Duration
+            Duration = atol(newDuration);
         } else if (data == rReset) {
             defaults();
         } else if (data == rDoubleGliss) {

    return glissTime;
}

void durationturn(int duration, float pitch, bool dir, bool recentre) {
    _durationgliss(duration, pitch, pitch, 0, 0, dir, recentre);
}

long durationgliss(int duration, float startpitch, float endpitch,
        bool dir, bool recentre, int sustain) {
    return _durationgliss(duration, startpitch, endpitch, sustain, sustain, dir, recentre);
}

    return pulse;
}

long _durationgliss(unsigned long duration, float startpitch, float endpitch,
        int sustainstart, int sustainend, bool dir, bool recentre) {
    int startsustainpulse = pitchToPulse(startpitch + glissAdd - 1);
    int startpulse = pitchToPulse(startpitch + glissAdd);
