Re: [CM] repeating envs

2021-05-12 Thread Juan I Reyes



While on the subject of Lambda functions I think is worth saying that I
updated several Snd examples on the Users@PlanetCCRMA pages [1]. As far
as I can tell none uses a Lambda function and are a bit basic but
hopefully they give an idea of Snd's and s7's functionality. More
complex examples are on the works. However, never take for granted code
on Snd's documentation as well as other examples on embedded in the
source files of the distribution.

Regards,

  --* Juan

[1] https://ccrma.stanford.edu/guides/planetccrma/SND.html


___
Cmdist mailing list
Cmdist@ccrma.stanford.edu
https://cm-mail.stanford.edu/mailman/listinfo/cmdist


Re: [CM] repeating envs

2021-05-11 Thread bil

I think you're close -- this slightly edited version
seems to work:

(define (strum e)
  (if (> (mus-location e) (mus-length e))
  (mus-reset e))
  (env e))

(with-sound (:srate 48000 :channels 1 :play #t)
  (let ((gen (make-polyshape 100.0 :partials (list 1 .5  2 .25  3 .125  
4 .125)))
	(strum-env (make-env '(0 0  .25  0.01  .5  0.2 1  0.0) :scaler 1.0 
:duration 1 :base .53))

)
(do ((i 0 (+ i 1)))
((= i 96000))
  (outa i (* .5 (polyshape gen 0.95 (strum strum-env
  )))

In your code, you had two things named "strum", and
the map-channel wasn't needed.

___
Cmdist mailing list
Cmdist@ccrma.stanford.edu
https://cm-mail.stanford.edu/mailman/listinfo/cmdist


[CM] repeating envs

2021-05-11 Thread James Hearon
Hi,
The lambda function, from the manual, for repeating an env seems like a useful 
thing, but I cannot seem to find the magic to make it repeat.  I'm wondering 
how you would use it for the polyshape gen fm parameter? Or is that not how 
it's supposed to work?
Regards,
Jim

(define (strum e)
  (map-channel (lambda (y)
(if (> (mus-location e) (mus-length e)) ; mus-length = dur
(mus-reset e)) ; start env again (default is to stick at the last value)
(* y (env e)

(with-sound (:srate 48000 :channels 1 :play #t)
  (let ((gen (make-polyshape 100.0 :partials (list 1 .5  2 .25  3 .125  4 
.125)))
(strum (make-env '(0 0  .25  0.01  .5  0.2 1  0.0) :scaler 1.0 :duration 1 
:base .53))
)
(do ((i 0 (+ i 1)))
((= i 96000))
  (outa i (* .5 (polyshape gen 0.95 (env strum
  )))


make-pulsed-env, and pulsed-env work fine, however.

(with-sound (:srate 48000 :channels 1 :play #t)
  (let ((gen (make-polyshape 100.0 :partials (list 1 .5  2 .25  3 .125  4 
.125)))
(jsenvel (make-pulsed-env '(0 0  .25  0.01  .5  0.2 1  0.0)  1.0  1.0))
)
(do ((i 0 (+ i 1)))
((= i 96000))
  (outa i (* .5 (polyshape gen 0.95 (pulsed-env jsenvel
  )))

___
Cmdist mailing list
Cmdist@ccrma.stanford.edu
https://cm-mail.stanford.edu/mailman/listinfo/cmdist