Shuffle / randomize chunks of speech


I have recording of a sequence of words (single track). I want to randomize / shuffle the order in which these chunks of audio are played instead of doing it by hand. Is there a script for this or is it possible to to write such a script ? Thanks a lot for your suggestions.

PS: I included a photo of my track.


The simplest solution given that you have labels, would be:
(save the current project first so that you have a backup)

  1. add one more label at the start, then put random text / numbers into the labels. Just ensure that the text is different in every label.
  2. In “Edit > Preferences > Import/Export” turn off the option to “Show metadata editor prior to export”
  3. “Export Multiple”, based on labels and using the label text as the name.

You will now have a load of small files with random names.

  1. Close and restart Audacity so that you have a fresh empty Audacity project.
  2. “File > Import > Audio” and select all of the files that you exported in step 3.

You will now have each file on a new track, imported in alpha-numeric order, which because the file names are “random”, the order is also “random”.

  1. Ctrl+A to select all.
  2. “Tracks > Align > Align End to End”
  3. Tracks > Mix and Render.

If you have a lot of these to do, you could modify the “Silence Finder” effect so that it adds random text automatically rather than having to manually enter random names. Let me know if you need to do this.

If you want to do this, here’s a Nyquist function that creates unique random numbers. This function could be added to the Silence Finder script and called instead of the fixed string “S”.

(setf names (list)) ;an empty list to keep track of used names

(defun uniquerand ()
; this could be done with alphanumeric characters by using character codes
  (do ((num (format nil "~a" (random 10))
             (format nil "~a~a" num (random 10))))
      ((not (member num names :test 'string=))
       (progn (push num names) num))))
;; Test it:
(dotimes (i 40)
  (print (uniquerand)))