[CM] Csound sprout question
Ben McAllister
benmca at gmail.com
Sat Apr 16 12:54:57 PDT 2016
Hi List!
I've come up with a solution to the question I posted (below) previously by
creating an OSC router in Csound, passing events over OSC from Scheme to a
running Csound orchestra. I wrote a blog post about it here - maybe someone
will find it useful:
http://listenfaster.tumblr.com/post/142910737568/realtime-csound-from-grace-using-osc-routing
Thanks!
b
On Wed, Mar 16, 2016 at 9:28 PM, Ben McAllister <benmca at gmail.com> wrote:
> Hi all,
>
> I'm stuck with a problem trying to sprout process with Csound. I'm
> trying to do something more complex with a piece I'm working on, but
> managed to boil down the problem I'm having by using the Csound Scheme
> example. If you take a look at that example, you'll see a function
> called ransco:
>
> (define (ransco len rhy lb ub amp)
> (let ((dur (* rhy 2)))
> (process repeat len
> for t = (elapsed #t) ; get true score time
> for k = lb then (between lb ub)
> do
> (cs:i 1 t dur k amp)
> (wait rhy))))
>
>
> A bit further down in the example, there's some instruction on sprout
> this bit multiple time, using :write #f to 'collect' the events
> generated into one score:
>
>
> ; This will generate a score without writing an audio file. execute
> ; the expression several times and use the Audio>Csound>Export... item
> ; to export all the score data in various formats
>
> (sprout (ransco 10 .2 60 72 1000) "test.sco" :write #f)
>
> I was assuming I'd be able to do this same thing from a process, but
> I'm getting an error that Grace is unable to get a file handle to
> "test.sco". Here's the function:
>
> (define (f1)
> (process repeat 3
> do
> (sprout (ransco 10 .2 60 72 1000) "test.sco" :write #f)
> (wait 1)))
>
> ...and I try to execute it like so:
> (sprout (f1))
>
>
> Is this one of those 'not yet implemented' features, or am I missing
> something? Any help is very much appreciated - thanks! Complete
> listing below:
>
> ;------------------------------------------------
> ;
> ;; Csound output
> ;
>
> ; To evaluate code put the cursor after each expression and press
> ; Command-Return, then check the console window for any output.
>
> ; A process that sends csound data
>
> (define (ransco len rhy lb ub amp)
> (let ((dur (* rhy 2)))
> (process repeat len
> for t = (elapsed #t) ; get true score time
> for k = lb then (between lb ub)
> do
> (cs:i 1 t dur k amp)
> (wait rhy))))
>
> ; Write a score file
>
> (sprout (ransco 10 .2 60 72 1000) "test.sco")
>
> ; Options for csound scorefiles are:
> ; play: if #t call csound after writing file
> ; header: header string for scorefile
> ; orchestra: path to .orc file
> ; write: if #t write the scorefile (default #t)
> ; These options are all 'sticky' and except for write: are saved in
> ; your preferences file.
>
> ; This next command will call csound after generating the
> ; file. Before executing it copy the simp.orc code below into your
> ; home directory and use Audio>Csound>Settings... to assign your
> ; Csound app.
>
> (sprout (ransco 10 .2 60 72 1000) "test.sco" :play #t
> :orchestra "simp.orc")
>
> ; This will generate a score without writing an audio file. execute
> ; the expression several times and use the Audio>Csound>Export... item
> ; to export all the score data in various formats
>
> (sprout (ransco 10 .2 60 72 1000) "test.sco" :write #f)
>
> (define (f1)
> (process repeat 3
> do
> (sprout (ransco 10 .2 60 72 1000) "test.sco" :write #f)
> (wait 1)))
>
> (sprout (f1))
>
> Ben
>
--
Ben McAllister | listenfaster.com | @listenfaster | tuktuband.com | c:
206.849.3183
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/mailman/private/cmdist/attachments/20160416/68073eb4/attachment.html>
More information about the Cmdist
mailing list