;*********************************************************************
|
; 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-SYNTH ========================
|
|
(defparameter *sox-durs-doc* "Specify durations for synthesis components before processing (seconds). [float, list]")
|
(defparameter *sox-mod-doc* "... . [float, list]")
|
(defparameter *sox-waveform-doc* "... . [float, list]")
|
|
(defclass! sox-synth (sox-input)
|
(
|
;(waveform :accessor durs :initarg :durs :initform nil :documentation *sox-durs-doc*)
|
;(combination :accessor durs :initarg :durs :initform nil :documentation *sox-durs-doc*)
|
(gains :accessor gains :initarg :gains :initform nil :documentation *sox-gain-doc*)
|
(durs :accessor durs :initarg :durs :initform nil :documentation *sox-durs-doc*)
|
)
|
(:icon 16)
|
(:documentation "Sox-synth will mix audio from multiple inputs together ...")
|
)
|
|
(defmethod initialize-instance :after ((self sox-synth &rest l)
|
(declare (ignore l))
|
(when (sound self)
|
(sox-init-gains self)
|
(sox-init-sound self 'list)
|
)
|
)
|
|
; Methode fuer sox-synth
|
; dies ist übernommen von Sox-Mix
|
|
(defmethod! sox-process ((sox-input sox-mix) (sox-effect string) &key output filetype samplerate bitdepth recursive batch-mode)
|
(if (probe-file *sox-path*)
|
|
(progn
|
(when (and (find-if 'stringp (sound sox-input)) (equal output "pipe"))
|
(om-message-abort "Pipe output not possible with this type of input."))
|
|
(let ((outfile (create-path nil output filetype))) ;(create-path (first (soundfiles sox-input)) output filetype)
|
|
(let* ((filenames
|
(loop for soundfile in (sound sox-input) collect ;I guess this throws the error when using pipes as inputs
|
(namestring soundfile))))
|
|
(setf str (format nil "~s ~a -m " (namestring *sox-path*) *sox-options*))
|
(print str)
|
|
; hier wird der Aufruf erzeugt - mit string+ konkatenieren Sie dies m
|
(loop for filename in filenames do ; hier z.B. waveforms
|
for gain in (db->lin (gains sox-input)) do
|
(setf str (string+ str (format nil " -v~d ~s " gain filename ))))
|
;)
|
|
|
; dies hier kann wahrscheinlich genauso belassen werden
|
(setf str (cond ((equal output "realtime") (sox-samplebits (string+ str " -q ") bitdepth samplerate *sox-audio-device*))
|
((equal output "pipe") (sox-samplebits str bitdepth samplerate "-p"))
|
(t (sox-samplebits str bitdepth samplerate outfile))))
|
|
(setf str (string+ str sox-effect))
|
|
(sox-out str sox-input output outfile recursive))))
|
|
(sox-not-found))
|
)
|
|
; PS Die Funktion sox-out finden Sie in utilities.lisp
|
|
|
; was gibt es für Optionen für MOD
|
|
#|
|
(defun synth (gen freq dur gain &optional mod &optional save )
|
(cond((and (equalp mod nil) (equalp save nil)) (format nil "play -n synth ~D ~D ~D vol ~D" dur gen freq gain))
|
((and (not (equalp mod nil))(equalp save nil))(format nil "play -n synth ~D ~D ~D ~D vol ~D" dur gen freq mod gain))
|
((and (not (equalp mod nil))(not (equalp save nil)))(format nil "sox -n ~D.wav synth ~D ~D ~D ~D vol ~D" save dur gen freq mod gain))
|
((and (equalp mod nil)(not (equalp save value)))(format nil "sox -n ~D.wav synth ~D ~D ~D vol ~D" save dur gen freq gain))))
|
|
(defmethod! synth ((gen symbol) (freq number) (dur number) (gain number) &optional (mod symbol))
|
(cond((and (equalp mod nil) (equalp save nil)) (format nil "play -n synth ~D ~D ~D vol ~D" dur gen freq gain))
|
((and (not (equalp mod nil))(equalp save nil))(format nil "play -n synth ~D ~D ~D ~D vol ~D" dur gen freq mod gain))
|
((and (not (equalp mod nil))(not (equalp save nil)))(format nil "sox -n ~D.wav synth ~D ~D ~D ~D vol ~D" save dur gen freq mod gain))
|
((and (equalp mod nil)(not (equalp save value)))(format nil "sox -n ~D.wav synth ~D ~D ~D vol ~D" save dur gen freq gain))))
|
|
(defmethod! synth ((gen list) (freq list) (dur list) (gain list) &optional (mod symbol))
|
(loop for g in gen
|
for f in freq
|
for d in dur
|
for g in gain
|
()
|
)
|
)
|
|#
|