Cut an audio to 3.5 seconds of sound then 5 seconds of silence

How can I automatically cut an audio to 3.5 seconds of sound then 5 seconds of silence, then next 3.5 seconds of audio then 5 seconds of silence again etc?

So long as the track is not too long (a few minutes), you could use this code in the Nyquist Prompt effect.

(setf segment-dur 3.5)  ; Length of segment
(setf gap-dur 5)  ; Length of gaps

(setf dur (get-duration 1))
(setf loops (truncate (/ dur segment-dur)))

(defun process (sig)
  (let ((out (s-rest 0))
        (gap  (s-rest gap-dur))
        (final-part (extract (* loops segment-dur) dur sig)))
    (dotimes (i loops
              (seq out (cue final-part)))
      (let* ((start (* i segment-dur))
             (end (+ start segment-dur))
             (current-position (* i (+ segment-dur gap-dur))))
        (setf part (extract start end sig))
        (setf out (sim (extract 0 current-position out)
                       (at current-position (cue part))
                       (at (+ current-position segment-dur) (cue gap))))))))

(abs-env (multichan-expand #'process *track*))

1 Like

Thank you! These audios are minimum 20 minutes and I have so-so laptop. They won’t work, right?

I’ve just tested it with a 28 minute stereo track. It took over 3 minutes to process but completed successfully.

Thank you. I extensively tested it. It kinda eats a 0.1 or 0.2 from a beginning of a segment. Is it possible to do that a new segment takes a 0.1 or 0.2 of a previous one? I hope I sound coherent.
Example: I listen to a phrase and after a gap I hear that a syllable or two was “eaten”.

This topic was automatically closed after 30 days. New replies are no longer allowed.