;*********************************************************************
|
; OM-SoX, (c) 2011-2013 Marlon Schumacher (CIRMMT/McGill University) *
|
; http://sourceforge.net/projects/omsox/ *
|
; *
|
; Multichannel Audio Manipulation and Functional Batch Processing. *
|
; DSP based on SoX - (c) C.Bagwell and Contributors *
|
; http://sox.sourceforge.net/ *
|
;*********************************************************************
|
;
|
;This program is free software; you can redistribute it and/or
|
;modify it under the terms of the GNU General Public License
|
;as published by the Free Software Foundation; either version 2
|
;of the License, or (at your option) any later version.
|
;
|
;See file LICENSE for further informations on licensing terms.
|
;
|
;This program is distributed in the hope that it will be useful,
|
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
;GNU General Public License for more details.
|
;
|
;You should have received a copy of the GNU General Public License
|
;along with this program; if not, write to the Free Software
|
;Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,10 USA.
|
;
|
;Authors: M. Schumacher
|
|
(in-package :om)
|
|
;;; SOX-SPLICE ========================
|
|
(defclass! sox-splice (sox-input)
|
(
|
(gains :accessor gains :initarg :gains :initform nil :documentation *sox-gain-doc*)
|
(splice-begin :accessor splice-begin :initarg :splice-begin :initform nil :documentation "Beginning of the splice (sec)")
|
(splice-end :accessor splice-end :initarg :splice-end :initform nil :documentation "End of the splice (sec)")
|
(fade-type :accessor fade-type :initarg :fade-type :initform nil :documentation "Fade type (linear, half-cosine, quarter-cosine) [symbol]")
|
(tolerance :accessor tolerance :initarg :tolerance :initform nil :documentation "Temporal region for searching the best position to make the splice (ms).")
|
)
|
(:icon 18)
|
(:documentation "Splice together audio sections.
|
|
This provides two things over simple audio concatenation:
|
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.
|
|
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.")
|
)
|
|
|
(defmethod initialize-instance :after ((self sox-splice) &rest l)
|
(declare (ignore l))
|
(when (sound self)
|
(sox-init-gains self)
|
(sox-init-sound self 'list)
|
(unless (same-elements-p (sox-sound-channels (sound self)))
|
(om-beep-msg "Input audio must have same number of channels."))
|
)
|
)
|
|
#|
|
; It would be better to set splice-begin/end params to the marker points in this class - rather than in the sox-process function
|
(defmethod initialize-instance :after ((self sox-splice) &rest initargs)
|
(declare (ignore initargs)))
|
|
|
(defmethod initialize-instance :after ((self sox-splice) &rest args)
|
;(declare (ignore initargs))
|
(let ((themarkers (markers self))
|
(thebegins (first (mat-trans (markers self))))
|
(theends (second
|
(setf (splice-begin self) (get-markers (sound self)))
|
(setf (splice-end self)
|
(setf (sound self) (sox-sound-path! (sound self)))
|
(setf (gains self) (sox-input-convert-gain (gains self)))
|
self)
|
|
|#
|