| | |
| | | ; ####### High-level API ########## |
| | | |
| | | |
| | | (defun sox-hoaencode-gain-single-component (order degree azimuth_deg elevation_deg) |
| | | (defun sox-hoaencode-gain-single-component (order degree azimuth_deg elevation_deg normalization) |
| | | "Returns the gain value (linear, -1 to 1) for a single ACN-channel" |
| | | (let |
| | | ( |
| | |
| | | ; However, the formulas inside assume that azimuth_deg runs clockwise, i.e. |
| | | ; the sign of azimuth_deg must be inverted. |
| | | (azimuth_deg_inverted (* -1 azimuth_deg)) |
| | | (normalization_factor |
| | | (if (eq normalization :sn3d) |
| | | (sox-hoaencode-sn3d-factor order degree) |
| | | (sox-hoaencode-n3d-factor order degree))) |
| | | ) |
| | | (* |
| | | (sox-hoaencode-sn3d-factor order degree) |
| | | (sqrt (/ 1 (* 4 pi))) |
| | | normalization_factor |
| | | (sox-hoaencode-azimuth-factor degree azimuth_deg_inverted) |
| | | (sox-hoaencode-elevation-factor order degree elevation_deg))) |
| | | ) |
| | | (sox-hoaencode-elevation-factor order degree elevation_deg) |
| | | ))) |
| | | |
| | | |
| | | (defun sox-hoaencode-gains-by-order (order azimuth_deg elevation_deg) |
| | | (defun sox-hoaencode-gains-by-order (order azimuth_deg elevation_deg normalization) |
| | | "Returns the gain values for all components at a specific order" |
| | | (loop for degree from (* -1 order) to order collect |
| | | (sox-hoaencode-gain-single-component order degree azimuth_deg elevation_deg))) |
| | | (sox-hoaencode-gain-single-component order degree azimuth_deg elevation_deg normalization))) |
| | | |
| | | |
| | | (defun sox-hoaencode-gains-up-to-order (order azimuth_deg elevation_deg) |
| | | "Returns the gain values for all components up to a specific order" |
| | | (sox-hoaencode-double-to-float |
| | | (flatten |
| | | (loop for ord from 0 to order collect |
| | | (sox-hoaencode-gains-by-order ord azimuth_deg elevation_deg))))) |
| | | (defun sox-hoaencode-gains-up-to-order (order azimuth_deg elevation_deg normalization) |
| | | "Returns the gain values for all components up to a specific order" |
| | | (flatten |
| | | (loop for ord from 0 to order collect |
| | | (sox-hoaencode-gains-by-order ord azimuth_deg elevation_deg normalization)))) |
| | | |
| | | |
| | | ; ####### SoX-HOAENCODE class ########## |