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-SPLICE ======================== |
|
31 |
|
|
32 |
(defclass! sox-splice (sox-input) |
|
33 |
( |
|
34 |
(gains :accessor gains :initarg :gains :initform nil :documentation *sox-gain-doc*) |
|
35 |
(splice-begin :accessor splice-begin :initarg :splice-begin :initform nil :documentation "Beginning of the splice (sec)") |
|
36 |
(splice-end :accessor splice-end :initarg :splice-end :initform nil :documentation "End of the splice (sec)") |
|
37 |
(fade-type :accessor fade-type :initarg :fade-type :initform nil :documentation "Fade type (linear, half-cosine, quarter-cosine) [symbol]") |
|
38 |
(tolerance :accessor tolerance :initarg :tolerance :initform nil :documentation "Temporal region for searching the best position to make the splice (ms).") |
|
39 |
) |
|
40 |
(:icon 18) |
|
41 |
(:documentation "Splice together audio sections. |
|
42 |
|
|
43 |
This provides two things over simple audio concatenation: |
|
44 |
A (usually short) cross-fade is applied at the join, and a wave similarity comparison is made to help determine the best place at which to make the join. <tolerance> determines the size of the region within to search (ms). Different envelopes are available for the crossfade. For multiple splices lists of parameters must be provided. |
|
45 |
|
|
46 |
NB. There is a limitation on the lenght of splices: The duration of the splice must be shorter than half of the first input file.") |
|
47 |
) |
|
48 |
|
|
49 |
|
|
50 |
(defmethod initialize-instance :after ((self sox-splice) &rest l) |
|
51 |
(declare (ignore l)) |
|
52 |
(when (sound self) |
|
53 |
(sox-init-gains self) |
|
54 |
(sox-init-sound self 'list) |
|
55 |
(unless (same-elements-p (sox-sound-channels (sound self))) |
|
56 |
(om-beep-msg "Input audio must have same number of channels.")) |
|
57 |
) |
|
58 |
) |
|
59 |
|
|
60 |
#| |
|
61 |
; It would be better to set splice-begin/end params to the marker points in this class - rather than in the sox-process function |
|
62 |
(defmethod initialize-instance :after ((self sox-splice) &rest initargs) |
|
63 |
(declare (ignore initargs))) |
|
64 |
|
|
65 |
|
|
66 |
(defmethod initialize-instance :after ((self sox-splice) &rest args) |
|
67 |
;(declare (ignore initargs)) |
|
68 |
(let ((themarkers (markers self)) |
|
69 |
(thebegins (first (mat-trans (markers self)))) |
|
70 |
(theends (second |
|
71 |
(setf (splice-begin self) (get-markers (sound self))) |
|
72 |
(setf (splice-end self) |
|
73 |
(setf (sound self) (sox-sound-path! (sound self))) |
|
74 |
(setf (gains self) (sox-input-convert-gain (gains self))) |
|
75 |
self) |
|
76 |
|
|
77 |
|# |
|
78 |
|