File: shape.lsp

package info (click to toggle)
nyquist 3.24%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 58,156 kB
  • sloc: ansic: 74,757; lisp: 18,169; java: 10,942; cpp: 6,688; sh: 175; xml: 58; makefile: 40; python: 15
file content (29 lines) | stat: -rw-r--r-- 888 bytes parent folder | download | duplicates (9)
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
;; there was a reported problem with shape reading 1 beyond the
;; end of the table -- this is a test to check it out

;; 20-Jun-97

; make sample rates low enough to look at by hand
(set-sound-srate 10)
(set-control-srate 10)

; make a table
(setf shape-signal (scale 2 (ramp 2)))
(print (snd-samples shape-signal 25))

; try it out
(setf input (scale 1.2 (stretch 3 (lfo .1))))
;(s-plot input)
(setf result (shape input shape-signal 1.0))
(print (snd-samples result 50))
;(s-plot result)

; conclusion :
; The shape must be defined all the way to the origin + 1.0,
; in this case, the origin is 1, so the shape must go to 2.0.
; Initially, I used (pwl 2 2 2 0) for the shape and had
; problems because this function is zero at 2.0!  I assume
; this is the source of the reported problem.  By using ramp,
; which actually extends to it's duration + 1 sample, we
; get the right result.