[CM] Csound sprout question

Ben McAllister benmca at gmail.com
Wed Mar 16 21:28:53 PDT 2016


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


More information about the Cmdist mailing list