[CM] map-channel with dsp
James Hearon
j_hearon at hotmail.com
Fri Feb 9 17:43:22 PST 2018
Hi,
I'm really stuck on trying to use map-channel to replace a newly created snd file with a dsp modified version of it. I've been looking at snd-test.scm for examples but still don't have it right yet and not sure how to craft the let/map-channel/lambda to make it work. All I get is a flat line so far.
I'm trying to place values in a float-vector, then modify those values and output to the editor. I know
(float-vector->channel im 0 fsize 0) works,
and I also tried sample (but very slow):
(do ((i 0 (+ i 1)))
((= i fsize))
(set! (sample i) (im i)))
Wondering if there's an example someplace I haven't found yet for how to dsp modify a vector of values and use map-channel to output to the editor?
Thank You,
Jim
I’ve been trying something like below…
but cannot seem to get the map-channel/let/lambda part right.
(let* ((fsize 22050)
(increment (/ (* 440.0 2.0 pi) fsize))
(im (make-float-vector fsize)) ;empy vector
(current-phase 0.0)
(val 0.0) );init var
(new-sound "test.snd" :size fsize) ;creates a new snd in editor
;place values in a vector
(do ((i 0 (+ i 1)))
((= i fsize))
(set! val (* .1 (sin current-phase)))
(set! current-phase (+ current-phase increment))
(set! (im i) val)
;(format #t "~%i: ~F ~0,6F\t " i (im i) )
)
(map-channel (lambda (y)
(do ((i 0 (+ i 1)))
((= i fsize))
(* (amplitude-modulation 0.5) (im i))))0 fsize))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20180210/63ec8d5a/attachment.html>
More information about the Cmdist
mailing list