Work-in-progress repo for ambisonics extensions for OM-SoX
Alexander Nguyen
22.01.25 92c40d00f8ffe4fc6491c0abb70210b31202bd70
commit | author | age
92c40d 1 ;*********************************************************************
AN 2 ; OM-SoX, (c) 2011-2013 Marlon Schumacher (CIRMMT/McGill University) *
3 ;             http://sourceforge.net/projects/omsox/                 *
4 ;                                                                    *
5 ;  Multichannel Audio Manipulation and Functional Batch Processing.  *
6 ;        DSP based on SoX - (c) C.Bagwell and Contributors           *
7 ;                  http://sox.sourceforge.net/                       *
8 ;*********************************************************************
9 ;
10 ;This program is free software; you can redistribute it and/or
11 ;modify it under the terms of the GNU General Public License
12 ;as published by the Free Software Foundation; either version 2
13 ;of the License, or (at your option) any later version.
14 ;
15 ;See file LICENSE for further informations on licensing terms.
16 ;
17 ;This program is distributed in the hope that it will be useful,
18 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 ;GNU General Public License for more details.
21 ;
22 ;You should have received a copy of the GNU General Public License
23 ;along with this program; if not, write to the Free Software
24 ;Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,10 USA.
25 ;
26 ;Authors: M. Schumacher
27
28 (in-package :om)
29
30 ; ==== SOX-PAN ========================
31
32 (defclass! sox-pan (sox-input)
33            (
34             (gains :accessor gains :initarg :gains :initform nil :documentation *sox-gain-doc*)
35             (panning :accessor panning :initform nil :initarg :panning :documentation *sox-panning-doc*)
36             (numchannels :accessor numchannels :initform nil :initarg :numchannels :documentation "Number of available output channels for panning.")
37             )
38            (:icon 13)
39            (:documentation "Sox-Pan allows panning a sound between a pair of adjacent channels. 
40
41 NB. Multichannel input is first summed into a single channel before panning.")
42            )
43
44 ; possibly replace numchannels with out-channels
45 ; Note: the slot "gains" should actually better be "gain" here (atom), not "gains" 
46 ; - this is inherited from sox-input
47
48 (defmethod initialize-instance :after ((self sox-pan) &rest args)
49   (declare (ignore args))
50   (when (sound self)
51     (unless (numchannels self) (setf (numchannels self) 2))   
52     (sox-init-gains self)
53     (sox-init-panning self)
54     (sox-init-sound self 'atom)
55     (when (< (numchannels self) (+ 1 (floor (panning self))))
56       (setf (numchannels self) (+ 1 (floor (panning self))))
57       )
58     )
59   )
60
61 #|
62  (loop for sound in (list! (sound self))
63                   for i from 0 to (- sound-length 1) collect
64                   (if (equal (tracknum sound) 0)
65                       (nth i panning-list)
66                     (+ (tracknum sound) (* 0.01 (pan sound))))
67 |#
68
69
70
71 #|
72 There's a number of options for dealing with 'pan' and 'tracknum' in sound objects
73 1) leave it as is, meaning, sox-mix-console does not consider (overrides) pan or tracknum
74 2) add the tracknum and pan parameters to sox-input -> consequence: cannot use paths as inputs to classes
75 3) work with sound objects in sox-input classes (no conversion in sox-input) -> requires changes in sox-process
76 |#