Shuffle / randomize chunks of speech

Help for Audacity on GNU/Linux.
Forum rules
ImageThis forum is for Audacity on GNU/Linux.
Please state:
  • which version of Linux you are using,
  • the exact three-section version number of Audacity from Help menu > About Audacity,
  • whether you installed your distribution's release, PPA version, or compiled Audacity from source code.

Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade (see https://www.audacityteam.org/download/).
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
Post Reply
naonaoned
Posts: 2
Joined: Thu Jan 05, 2017 1:20 pm
Operating System: OS X 10.9 Mavericks

Shuffle / randomize chunks of speech

Post by naonaoned » Thu Jan 05, 2017 1:30 pm

Hello,

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.

:-)
Attachments
tracks000.png
tracks000.png (24.79 KiB) Viewed 1324 times

steve
Site Admin
Posts: 80752
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Shuffle / randomize chunks of speech

Post by steve » Thu Jan 05, 2017 3:44 pm

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.

4) Close and restart Audacity so that you have a fresh empty Audacity project.
5) "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".

6) Ctrl+A to select all.
7) "Tracks > Align > Align End to End"
8) 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.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

steve
Site Admin
Posts: 80752
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Shuffle / randomize chunks of speech

Post by steve » Thu Jan 05, 2017 4:12 pm

steve wrote: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".

Code: Select all

(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)))
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Post Reply