SelectAll: NyquistPrompt:Command=";type tool\n\n(defun get-filename ()\n ;; Return most recent filename.\n (do ((i 12 (1- i)))\n ((= i 0) \"\")\n (if (< i 10)\n (setf fnum (format nil \"0~a\" i))\n (setf fnum i))\n (let ((fname (aud-do (format nil \"GetPreference: Name=RecentFiles/file~a\" fnum))))\n (setf fname (first fname))\n (when (string/= fname \"\")\n (return fname)))))\n\n(defun channels ()\n ;; Return max number of channels for non-muted tracks\n (let ((tracks (aud-get-info \"tracks\"))\n (max-chans 0)\n channels\n mute)\n (dolist (track tracks max-chans)\n (setf mute (second (assoc 'mute track)))\n (setf channels (second (assoc 'channels track)))\n (when (and mute (= mute 0)\n channels (> channels max-chans))\n (setf max-chans channels)))))\n\n(defun isnot-wav (fname)\n ;; Check for unsupported file extensions.\n (cond ((< (length fname) 5) (throw 'err \"Error.\\nInvalid filename.\"))\n ((string-equal (subseq fname (- (length fname) 4)) \".wav\") nil)\n (t t)))\n\n(let ((fname (get-filename))\n (channels (channels)))\n (cond ((= channels 0) \"Error.\\nNo audio to export.\")\n ((string= fname \"\") \"Error.\\nImported file name not found.\")\n ((isnot-wav fname) \"Error.\\nOnly WAV files are supported.\")\n (t (aud-do \"SelectAll:\")\n (aud-do-command \"Export2\" :filename fname :NumChannels channels)\n (format nil \"Exported to:~%~s\" fname))))\n" Parameters=""