Work-in-progress repo for ambisonics extensions for OM-SoX
Marlon Schumacher
4 days ago 03b73ca4c0d32c6011a17f9fa3fefe14181f27bd
refact: refactoring sox-hoaencoder method
1 files modified
36 ■■■■■ changed files
sources/sox-process.lisp 36 ●●●●● patch | view | raw | blame | history
sources/sox-process.lisp
@@ -188,30 +188,27 @@
    (if (probe-file *sox-path*)
        (progn          
          (let* ((sound (list! (sound sox-input))))
          (let ((sound (sound sox-input)))
            (when (and (find-if 'stringp sound) (equal output "pipe"))
            (when (and (stringp sound) (equal output "pipe"))
              (om-message-abort "Pipe output not possible with this type of input."))
            
            (let* ((filenames (loop for soundfile in sound collect (namestring soundfile))) ; not needed - soundfile should be an atom
                   (outfile (create-path nil output filetype)))
            (let ((filename (namestring sound))
                  (outfile (create-path nil output filetype)))
              
              (setf str (format nil " ~s ~a" (namestring *sox-path*) *sox-options*))
              (if (= (length filenames) 1)
                        ; case: one file
                  (let* ((filename (first filenames)))
                       ;  (position positions-ae))
                    (if (= (order sox-input) 0)
                (if (= (order sox-input) 0)
                     ; case: order = 0
                        (setf str (string+ str (format nil " ~s" filename)))
                    (setf str (string+ str (format nil " ~s" filename)))
                     ; case: order > 0
                      (progn ; here it would be more redundant to call sox-merge with the given params
                        (setf str (string+ str " -M"))
                        (loop for gain in (sox-hoaencode-gains-up-to-order (order sox-input) (azimuth sox-input) (elevation sox-input))
                              do (setf str (string+ str (format nil " -v~d ~s" gain filename))))
                        )
                      )
                    ))
                  (progn ; here it would be more redundant to call sox-merge with the given params
                    (setf str (string+ str " -M"))
                    (loop for gain in (sox-hoaencode-gains-up-to-order (order sox-input) (azimuth sox-input) (elevation sox-input))
                          do (setf str (string+ str (format nil " -v~d ~s" gain filename))))
                    )
                  )
              ;  )
            
              (setf str 
                    (cond 
@@ -219,14 +216,13 @@
                      (sox-samplebits (string+ str " -q ") bitdepth samplerate *sox-audio-device*))
                     ((equal output "pipe") 
                      (sox-samplebits str bitdepth samplerate "-p"))
                     (t
                      (sox-samplebits str bitdepth samplerate outfile))
                     (t (sox-samplebits str bitdepth samplerate outfile))
                     )
                    )
              (setf str (string+ str sox-effect))
              (print str)
              (sox-out str sox-input output outfile recursive)
                       ;optional removal of temp file
                  ;    (add-tmp-file outfile_tmp)
                  ;    (when *delete-inter-file* (clean-tmp-files))