-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaudacity_bitcrush_v3.ny.txt
36 lines (32 loc) · 1.05 KB
/
audacity_bitcrush_v3.ny.txt
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
;version 3
(setq sourcerate 4000) ; Source samplerate
(setq multiplier (/ 44100 sourcerate)) ; New samplerate
(defun bad-resample (sig num)
(setq size 1000)
(setf s-array (make-array (* num size)))
(setf end-array
(if (/= (rem (truncate len) size) 0)
(make-array (* num (rem (truncate len) size)))
nil))
(setf output (s-rest 0))
(dotimes (count (truncate (/ len size)))
(fill-array s-array sig num)
(setf output
(sim
output
(at-abs (/ (* count num size) *sound-srate*)
(cue (snd-from-array 0 *sound-srate* s-array))))))
(if end-array
(progn
(fill-array end-array sig num)
(sim
output
(at-abs (/ (* (truncate (/ len size)) (* num size)) *sound-srate*)
(cue (snd-from-array 0 *sound-srate* end-array)))))
output))
(defun fill-array (s-a sig times)
(dotimes (count (/ (length s-a) times))
(let ((next (snd-fetch sig)))
(dotimes (i times)
(setf (aref s-a (+ i (* count times))) next)))))
(multichan-expand #'bad-resample s (truncate multiplier))