Re: [CM] Cmdist Digest, Vol 154, Issue 3

2021-03-05 Thread bil

It says that because you are remaking the regs vector
on each iteration of the loop, but only setting the
i-th member.  Make the regs vector outside the do loop,
or in the do loop's variables, not in the inner let*:

(begin
   (do ((i 0 (+ i 1))
(regs (make-vector 3)))
   ((= i 3))
   (let* ((g (gaussian-distribution 10.0))
 (mysamples (mus-sound-samples  "myfile.wav"))
 (myran 0.0)
 (regstart 0)
 (regend 0)
 (regdur 1000)
 (myreg 0)
 )
(set! myran (any-random (abs 10.0) g))
(set! regstart (round (* myran mysamples)))
(set! regend (round (+ regstart regdur)))
   (vector-set! regs i (make-region regstart regend 0 1))
   (set! myreg (vector-ref regs 0))
   (insert-region myreg   0 0 1)
   )))

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


Re: [CM] Cmdist Digest, Vol 154, Issue 3

2021-03-05 Thread James Hearon
Here is a rough idea of what I was thinking.  Thank you for the info re:
   (vector-set! regs i (make-region beg end snd chn))) as a way to
increment a variable as region name.

I've got more to do, I know, but I'm also still a bit hung up on
var types at the insert-region line below where it wants a region id
instead of an unspecified object.

;;Open the sound and list samples
(begin
(open-sound "myfile.wav")
(mus-sound-samples  "myfile.wav")
)

(begin
   (do ((i 0 (+ i 1)))
   ((= i 3))
   (let* ((g (gaussian-distribution 10.0))
 (regs (make-vector 3))
 (mysamples (mus-sound-samples  "myfile.wav"))
 (myran 0.0)
 (regstart 0)
 (regend 0)
 (regdur 1000)
 (myreg 0)
 )
(set! myran (any-random (abs 10.0) g))
(set! regstart (round (* myran mysamples)))
(set! regend (round (+ regstart regdur)))
   (vector-set! regs i (make-region regstart regend 0 1))
   (set! myreg (vector-ref regs 0))
   (insert-region myreg   0 0 1)
   )))

Regards,
Jim


From: cmdist-boun...@ccrma.stanford.edu  on 
behalf of cmdist-requ...@ccrma.stanford.edu 
Sent: Wednesday, March 3, 2021 10:00 AM
To: cmdist@ccrma.Stanford.EDU 
Subject: Cmdist Digest, Vol 154, Issue 3

Send Cmdist mailing list submissions to
cmdist@ccrma.stanford.edu

To subscribe or unsubscribe via the World Wide Web, visit
https://cm-mail.stanford.edu/mailman/listinfo/cmdist
or, via email, send a message with subject or body 'help' to
cmdist-requ...@ccrma.stanford.edu

You can reach the person managing the list at
cmdist-ow...@ccrma.stanford.edu

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Cmdist digest..."


Today's Topics:

   1. Re: dynamic variables (b...@ccrma.stanford.edu)


--

Message: 1
Date: Tue, 02 Mar 2021 12:10:45 -0800
From: b...@ccrma.stanford.edu
To: James Hearon 
Cc: "cmdist@ccrma.Stanford.EDU" 
Subject: Re: [CM] dynamic variables
Message-ID: 
Content-Type: text/plain; charset=US-ASCII; format=flowed

I can't tell what you're trying to do.  Is this related to
the region-play-list example in sndscm.html?  Please send
a more detailed description of the problem, or the code you
want to use.



--

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


End of Cmdist Digest, Vol 154, Issue 3
**
___
Cmdist mailing list
Cmdist@ccrma.stanford.edu
https://cm-mail.stanford.edu/mailman/listinfo/cmdist