Work-in-progress repo for ambisonics extensions for OM-SoX
Alexander Nguyen
25.01.25 a590ad25dc2fa20301f47b7b6c84e5f176e36db2
Update
2 files modified
32 ■■■■■ changed files
sources/classes/sox-hoaencode.lisp 4 ●●●● patch | view | raw | blame | history
sources/sox-process.lisp 28 ●●●● patch | view | raw | blame | history
sources/classes/sox-hoaencode.lisp
@@ -125,9 +125,9 @@
                                    (lambda (xyz) (multiple-value-list (om:xyz->aed (first xyz) (second xyz) (third xyz)))) 
                                    positions
                                )))))
                (t (error "Input must contain lists of length 2 (ae) or 3 (xyz)."))
                (t (error "Positions must consist of lists of length 2 (ae) or 3 (xyz)."))
            ))
        (t (error "Input must be 3dc or list."))))
        (t (error "Positions must be of type 3dc or list."))))
; High-level API
; Returns the gain value (linear, -1 to 1) for a single ACN-channel
sources/sox-process.lisp
@@ -183,13 +183,22 @@
(defmethod! sox-process ((sox-input sox-hoaencode) (sox-effect string) &key output filetype samplerate bitdepth recursive batch-mode)
    (if (probe-file *sox-path*)
        (progn
            (when
                (not (listp (sound sox-input)))
                (om-message-abort "sound must be a list.")
            )
            (when
                (not
                    (or
                        (subtypep (type-of (positions sox-input)) '3dc)
                        (and (subtypep (type-of (positions sox-input)) 'list) (> (length (positions sox-input)) 0) (subtypep (type-of (first (positions sox-input))) 'list) (> (length (first (positions sox-input))) 1)))
                )
                (om-message-abort "positions must be of type 3dc, or a list of lists.")
            )
            (let* 
                (
                    (sound 
                        (if (> (length (positions sox-input)) (length (list! (sound sox-input))))
                            (repeat-n (first (list! (sound sox-input))) (length (positions sox-input)))
                            (sound sox-input)
                        )
                        (sound sox-input)
                    )
                    (positions-ae 
                        (sox-hoaencode-auto-convert-positions (positions sox-input))
@@ -201,8 +210,8 @@
                )
                (let* 
                    (
                        (outfile (create-path nil output filetype))
                        (filenames (loop for soundfile in sound collect (namestring soundfile)))
                        (outfile (create-path nil output filetype))
                    )
                    (setf str (format nil " ~s ~a" (namestring *sox-path*) *sox-options*))
                    (if (= (length filenames) 1)
@@ -262,9 +271,12 @@
                    )
                    (setf str 
                        (cond 
                            ((equal output "realtime") (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))
                            ((equal output "realtime")
                                (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))
                        )
                    )
                    (setf str (string+ str sox-effect))