blob: b949dd6ae043e62f299f9a7cb5ebe66fadf5a99e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
;;; PJMG.LSP
;;; Rutinas para Nyquist
; Some utilities and functions not defined in
; the released version of Nyquist
(defun set-current-file (cf)
(setf *CURRENT-FILE* cf))
(defun l () (load *CURRENT-FILE*))
;; A comment by Dannenberg on the following function:
;; This function takes an expression for a sound and
;; finds its peak value. This forces a computation of all
;; samples, which are saved in memory (4 bytes per sample).
;; The samples are then normalized and written to a file.
;; This should be fine for short examples, but is not
;; recommended for general use because you may run out
;; of memory. See the manual for more notes on normalization.
;;
(defun ss (m)
(let ((m-max (peak m NY:ALL)))
(s-save (scale (/ 1.0 m-max) m) NY:ALL *default-sound-file*
:play *soundenable*)))
(defun randi1 (fr dur)
(let ((d (get-duration dur)))
(snd-white *rslt* fr d)))
(defun randi2 (fr dur)
(at 0.0 (snd-white 0.0 fr dur)))
(defun randh1 (fr dur)
(let ((d (get-duration dur)))
(snd-compose (noise d) (quantize (ramp d) (round (* fr d))))))
(defun rndh2 (fr dur)
(at 0.0 (snd-compose (noise dur)
(quantize (ramp dur) (round (* fr dur))))))
|