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-SYNTH ======================== |
|
31 |
|
|
32 |
(defparameter *sox-durs-doc* "Specify durations for synthesis components before processing (seconds). [float, list]") |
|
33 |
(defparameter *sox-mod-doc* "... . [float, list]") |
|
34 |
(defparameter *sox-waveform-doc* "... . [float, list]") |
|
35 |
|
|
36 |
(defclass! sox-synth (sox-input) |
|
37 |
( |
|
38 |
;(waveform :accessor durs :initarg :durs :initform nil :documentation *sox-durs-doc*) |
|
39 |
;(combination :accessor durs :initarg :durs :initform nil :documentation *sox-durs-doc*) |
|
40 |
(gains :accessor gains :initarg :gains :initform nil :documentation *sox-gain-doc*) |
|
41 |
(durs :accessor durs :initarg :durs :initform nil :documentation *sox-durs-doc*) |
|
42 |
) |
|
43 |
(:icon 16) |
|
44 |
(:documentation "Sox-synth will mix audio from multiple inputs together ...") |
|
45 |
) |
|
46 |
|
|
47 |
(defmethod initialize-instance :after ((self sox-synth &rest l) |
|
48 |
(declare (ignore l)) |
|
49 |
(when (sound self) |
|
50 |
(sox-init-gains self) |
|
51 |
(sox-init-sound self 'list) |
|
52 |
) |
|
53 |
) |
|
54 |
|
|
55 |
; Methode fuer sox-synth |
|
56 |
; dies ist übernommen von Sox-Mix |
|
57 |
|
|
58 |
(defmethod! sox-process ((sox-input sox-mix) (sox-effect string) &key output filetype samplerate bitdepth recursive batch-mode) |
|
59 |
(if (probe-file *sox-path*) |
|
60 |
|
|
61 |
(progn |
|
62 |
(when (and (find-if 'stringp (sound sox-input)) (equal output "pipe")) |
|
63 |
(om-message-abort "Pipe output not possible with this type of input.")) |
|
64 |
|
|
65 |
(let ((outfile (create-path nil output filetype))) ;(create-path (first (soundfiles sox-input)) output filetype) |
|
66 |
|
|
67 |
(let* ((filenames |
|
68 |
(loop for soundfile in (sound sox-input) collect ;I guess this throws the error when using pipes as inputs |
|
69 |
(namestring soundfile)))) |
|
70 |
|
|
71 |
(setf str (format nil "~s ~a -m " (namestring *sox-path*) *sox-options*)) |
|
72 |
(print str) |
|
73 |
|
|
74 |
; hier wird der Aufruf erzeugt - mit string+ konkatenieren Sie dies m |
|
75 |
(loop for filename in filenames do ; hier z.B. waveforms |
|
76 |
for gain in (db->lin (gains sox-input)) do |
|
77 |
(setf str (string+ str (format nil " -v~d ~s " gain filename )))) |
|
78 |
;) |
|
79 |
|
|
80 |
|
|
81 |
; dies hier kann wahrscheinlich genauso belassen werden |
|
82 |
(setf str (cond ((equal output "realtime") (sox-samplebits (string+ str " -q ") bitdepth samplerate *sox-audio-device*)) |
|
83 |
((equal output "pipe") (sox-samplebits str bitdepth samplerate "-p")) |
|
84 |
(t (sox-samplebits str bitdepth samplerate outfile)))) |
|
85 |
|
|
86 |
(setf str (string+ str sox-effect)) |
|
87 |
|
|
88 |
(sox-out str sox-input output outfile recursive)))) |
|
89 |
|
|
90 |
(sox-not-found)) |
|
91 |
) |
|
92 |
|
|
93 |
; PS Die Funktion sox-out finden Sie in utilities.lisp |
|
94 |
|
|
95 |
|
|
96 |
; was gibt es für Optionen für MOD |
|
97 |
|
|
98 |
#| |
|
99 |
(defun synth (gen freq dur gain &optional mod &optional save ) |
|
100 |
(cond((and (equalp mod nil) (equalp save nil)) (format nil "play -n synth ~D ~D ~D vol ~D" dur gen freq gain)) |
|
101 |
((and (not (equalp mod nil))(equalp save nil))(format nil "play -n synth ~D ~D ~D ~D vol ~D" dur gen freq mod gain)) |
|
102 |
((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)) |
|
103 |
((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)))) |
|
104 |
|
|
105 |
(defmethod! synth ((gen symbol) (freq number) (dur number) (gain number) &optional (mod symbol)) |
|
106 |
(cond((and (equalp mod nil) (equalp save nil)) (format nil "play -n synth ~D ~D ~D vol ~D" dur gen freq gain)) |
|
107 |
((and (not (equalp mod nil))(equalp save nil))(format nil "play -n synth ~D ~D ~D ~D vol ~D" dur gen freq mod gain)) |
|
108 |
((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)) |
|
109 |
((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)))) |
|
110 |
|
|
111 |
(defmethod! synth ((gen list) (freq list) (dur list) (gain list) &optional (mod symbol)) |
|
112 |
(loop for g in gen |
|
113 |
for f in freq |
|
114 |
for d in dur |
|
115 |
for g in gain |
|
116 |
() |
|
117 |
) |
|
118 |
) |
|
119 |
|# |