sources/classes/sox-hoaencode.lisp | ●●●●● patch | view | raw | blame | history | |
sources/sox-process.lisp | ●●●●● patch | view | raw | blame | history |
sources/classes/sox-hoaencode.lisp
@@ -38,7 +38,8 @@ ; ### Ambisonics ### (defun sox-hoaencode-sn3d-factor (order degree) ; andere Nomenklatur, "degree" wäre besser "order" um Verwechslung mit Winkeln zu vermeiden (defun sox-hoaencode-sn3d-factor (order degree) "This is a placeholder for documentation" (ecase order (0 1) (1 1) @@ -60,6 +61,7 @@ ) (defun sox-hoaencode-azimuth-factor (degree theta_deg) "This is a placeholder for documentation" (let* ( (theta (sox-hoaencode-deg-to-rad theta_deg)) @@ -72,6 +74,7 @@ ) (defun sox-hoaencode-elevation-factor (order degree phi_deg) "This is a placeholder for documentation" (let* ( (phi (sox-hoaencode-deg-to-rad phi_deg)) @@ -101,6 +104,7 @@ ; #### Utility functions #### #| (defun sox-hoaencode-auto-convert-positions (positions) "Ensures that positions are given as '((azimuth elevation) ...) (in degrees), i.e. 1) if list of list of three values, input is assumed to be '(x y z) coordinates and will be transformed to '(azimuth elevation) coordinates (in the navigational spherical coordinate system). @@ -132,7 +136,7 @@ (t (error "Positions must consist of lists of length 2 (ae) or 3 (xyz).")) )) (t (error "Positions must be of type 3dc or list.")))) |# ; ####### High-level API ########## @@ -174,8 +178,10 @@ (defclass! sox-hoaencode (sox-input) ( (positions :accessor positions :initarg :positions :initform '(0 0) :documentation *sox-hoaencode-positions-doc*) (order :accessor order :initarg :order :initform 3 :documentation *sox-hoaencode-order-doc*) (gain :accessor gain :initarg :gain :initform 0 :documentation "gain value in dB (decibel)") (azimuth :accessor azimuth :initarg :azimuth :initform 0 :documentation "azimuth angle in degrees") (elevation :accessor elevation :initarg :elevation :initform 0 :documentation "elevation angle in degrees") (order :accessor order :initarg :order :initform 3 :documentation *sox-hoaencode-order-doc*) ) (:icon 100) (:documentation "Sox-hoaencode encodes <sound> into a <order>-th ambisonic (HOA) signal at <positions>. sources/sox-process.lisp
@@ -188,21 +188,24 @@ (if (probe-file *sox-path*) (progn (unless (listp (sound sox-input)) (setf (positions sox-input) (list (positions sox-input)))) ; quick hack to prevent having to provide position arg as list of lists (when ;(unless (listp (sound sox-input)) (setf (positions sox-input) (list (positions sox-input)))) ; quick hack to prevent having to provide position arg as list of lists #| (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)) ) ; (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 (list! (sound sox-input))) (positions-ae (sox-hoaencode-auto-convert-positions (positions sox-input)))) (positions-ae (list (azimuth sox-input) (elevation sox-input)))) (when (and (find-if 'stringp sound) (equal output "pipe")) (om-message-abort "Pipe output not possible with this type of input.")) @@ -214,12 +217,12 @@ (if (= (length filenames) 1) ; case: one file (let* ((filename (first filenames)) (position (first positions-ae))) (position positions-ae)) (if (= (order sox-input) 0) ; case: order = 0 (setf str (string+ str (format nil " ~s" filename))) ; case: order > 0 (progn (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) (first position) (second position)) do (setf str (string+ str (format nil " -v~d ~s" gain filename)))) @@ -227,6 +230,7 @@ ) ) ; case: multiple files #| (if (= (order sox-input) 0) ; case: order = 0 (progn @@ -266,6 +270,7 @@ ) ) ) |# ) (setf str (cond