Ooops - apologies for being soooo verbose - I meant to only post the relevant parts of that file.  I guess more info is better than less ;)
b

On 9/26/05, Ben McAllister <benmca@gmail.com> wrote:
Hi there Stephane and Steven -

Writing and recording busily - haven't been active on any lists, blogs, or forums in awhile, but this one caught my eye:

I had this problem, and wrote a little lisp function to write the score generated by Stella to stdout.  As you can see 1) I'm not a very elegant LISP programmer - I'm sure there are more graceful ways of handling this ;) 2) basically, I write the sco to a temp file, then dump the file to stdout using the print-stream function.

Hope that helps:



The code follows:

(in-package :stella)

(defparameter *christmasball.wav_total_length* 24.96)

(defparameter *totaldur* 0)
(defparameter i 0)
(defparameter du 0)
(defparameter idx 0)
(defparameter idxdur 0)
(defparameter *buflen* 4096)
;
(defobject soundin_indx (csound-note)
  ((instr :initform "i") inst mytime dur amp pitch pan dist pct indx origdur)
  (:parameters instr inst mytime dur amp pitch pan dist pct indx origdur))

(defobject revnote (csound-note)
  ((name :initform "i99") mystart dur revtime)
  (:parameters name mystart dur revtime))

(defun strum(st tem pn len)
  (algorithm nil soundin_indx (start st length len)
        (setf inst 2)
        (setf mytime time)

   
    (setf idxdur '((.808 e) (1.246 e) (1.731 e)(2.170 e) (2.586 e) (3.024 e) (3.509 e) (3.902 e) (4.410 e) (4.918 e)
            (5.403 q) (6.234 e) (6.765 e) (7.204 q) (8.081 q) (8.936 e) (9.444 e) (9.859 e) (10.344 e) (10.76 e) (11.198 e)
            (11.637 e) (12.122 e) (12.561 e) (13.161 e) (13.6 e) (14.039 e) (14.547 e) (15.078 e) (15.563 e) (16.071 e)
            (16.625 e) (17.156 e) (17.641 e) (18.149 e) (18.657 e) (19.095 e) (19.65 e) (20.134 e) (20.666 e) (21.150 e)
            (21.682 e) (22.190 e) (22.651 h))); 44 items, for 'christmas_ball.wav

    (setf i
        (item
            (items
                (chord (items 0 1 2 3 4 ))
                (chord (items 5 6 7 8 9 ))
                (chord (items 10 11 12 13 14))
                (chord (items 15 16 17 18 19))
                (chord (items 20 21 22 23 24 ))
                (chord (items 25 26 27 28 29))
                (chord (items 30 31 32 33))
                (chord (items 34 35 36 ))
                (chord (items 37 38 ))
                39 40 41 42 43)
;            (items 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
;            38 39 40 41 42 43 )
    ))    ;index into paired stream
    (setf idx (nth i idxdur))    ;pick i'th pair out of idxdur
    (setf indx (nth 0 idx))        ;set idx to 1st element
    ;(setf rhythm (rhythm (nth 1 idx) tem)) 
    ;
    ; improvement in the loop index method -
    ;   makes sure there is a distinction between duration in orig sample and
    ;   replayed duration.
    ;   You will hear articulations from the following note if the duration of a given fragment is too long
    ;   It follows that for fast tempi, orig dur is ok for replayed duration if using soundin, diskin,
    ;   but for slow tempi you must take care to smooth the end of each fragment.
    ;
    (if (< i 43)
        (setf origdur ( -
                     (nth 0 (nth (+ i 1) idxdur))
                     indx
                  ))
        ;if last element, subtract indx point from total length of file
        (setf origdur (- *christmasball.wav_total_length*  indx))        ;set dur to 2nd element
    )
    (setf rhythm
        (item
            (items
        (rhythms w+w+w )
            )
        )
    )
    (setf dur rhythm)

;    (setf pitch (item (items (pitches [a4 a4 a4 a4 a4] [a4 a4 a4 a4 a4] [a4 a4 a4 a4 a4] [a4 a4 a4 a4 a4] [a4 a4 a4 a4 a4] [a4 a4 a4 a4 a4] [a4 a4 a4 a4] [a4 a4 a4] [a4 a4] a4 a4 a4 a4 a4 in sequence))))
    (setf pitch 1)
    (setf amp .8)
        (setf pan
    (item
    (items     (items (items 0 for 5)
        (items  15 for 5)
        (items 25 for 5)
        (items 35 for 5)
        (items 45 for 5)
        (items 55 for 5) in heap)
        55 55 55 55
        65 65 65
        75 75
        45 55 65 75 90

    )
    )
        )
    (setf dist 2)
    (setf pct .075)
    (setf *totaldur* (max (+ mytime dur) *totaldur*))
))
(defun mrn (&key (revtime 5.))
  (algorithm nil revnote (start 10000 length 1 revtime revtime rhythm 0)
         (setf mystart 0)
         (setf dur (+ revtime *totaldur* 5))
         ))

(defun print-stream (filename)
  (let ((buffer (make-array *buflen*
                           
                            )))
   (with-open-file (f filename :direction :input
                      :if-does-not-exist :error
                      )
     (do ((j 0))((= j (file-length f)))
        (setf myline (read-line f t "eofeof"))
        (if (string-equal myline "eofeof")(return))
        (princ myline)
        (write-char #\Newline)
        (setf j (+ j ))
        )
   ))
)

   
(defun ms (&key (start-time 1.)(my-scorefile "strum.sco"))
  (let* ((myheader (header ""               )))
    (fheader my-scorefile myheader)
    (merge all ()
        (strum 0 10 90 14)
    (mrn)
            )
    (setf mystream (make-string-output-stream))
    (open-cmd my-scorefile)
            (mix-cmd "all 0 play nil")
))
(ms)
(print-stream  "strum.sco")


On 9/12/05, Steven Yi < stevenyi@gmail.com> wrote:
Hi Stephane,

If you are able to print to stdout with Common Music, then I think
this would be the easiest solution.  Otherwise, there is a feature
with the external soundObject to use $outfile, but your script then
would have to take in a filename ($outfile) from the commandline as an
argument, then write your score to that $outfile.  When Common Music
finishes up processing, blue will go and open the $outfile and read in
the generated score.  This was added to work with closed-source
programs like CMask which have no option to generate to stdout, only
to file.  (There is more information about this in the manual entry
for the External SoundObject.)

Hope that helps, and please feel free to ask any questions!
steven


On 9/12/05, stephane boussuge < s_boussuge@yahoo.fr> wrote:
> hi Steven
> in my last mail i said i can make a file who write a
> sco on disk but i miss to precise this file must be
> something like myfile.lisp and contain something like
> :
> (load "/home/stf/bin/cm-2.6.0/src/cm.lisp")
>
> if we write in terminal something like:
> clisp myfile.lisp
> clisp execute myfile.lisp, load cm and write sco on
> disk.
>
> for blue what is the solution ?
> clisp $infile ok but for reimport in blue ?
> may be clisp have a stdout capability ?
> i don't know because i'm a beginner both in clisp and
> common music.
>
> cheers
> stf
>
> --- stephane boussuge < s_boussuge@yahoo.fr > a �crit :
>
> > hi steven
> > thank you for your answer.
> > i know actually how to make a file who write a sco
> > on
> > a file on disk but i don't know how to reimport them
> > in blue.
> > could you give me an exemple for a python script and
> > i
> > will inspire from for make the same with common
> > music.
> >
> > cheers
> > stf
> >
> > --- Steven Yi <stevenyi@gmail.com> a �crit :

> >
> > > Hi Stephane,
> > >
> > > Sorry this is very late to reply.  I don't know
> > what
> > > would be the way
> > > to do it myself, and would like to know as well!
> > I
> > > know it's been
> > > mentioned here before but I do not remember what
> > > came of it.  Perhaps
> > > it is worth asking on the common music mailing
> > list
> > > on how to set up a
> > > file so that it could be called from the
> > commandline
> > > and print out the
> > > results or write them to disk, as that would be
> > what
> > > is required for
> > > blue to capture the output.
> > >
> > > steven
> > >
> > >
> > > On 9/8/05, stephane boussuge < s_boussuge@yahoo.fr>
> > > wrote:
> > > > hi list
> > > > could you give me some example(s) of command
> > line
> > > for
> > > > use common music in blue with external.
> > > > thanks
> > > > stf
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> >
> ___________________________________________________________________________
> > > > Appel audio GRATUIT partout dans le monde avec
> > le
> > > nouveau Yahoo! Messenger
> > > > T�l�chargez cette version sur

> > > http://fr.messenger.yahoo.com
> > > >
> > > >
> > > >
> > >
> >
> -------------------------------------------------------
> > > > SF.Net email is Sponsored by the Better Software
> > > Conference & EXPO
> > > > September 19-22, 2005 * San Francisco, CA *
> > > Development Lifecycle Practices
> > > > Agile & Plan-Driven Development * Managing
> > > Projects & Teams * Testing & QA
> > > > Security * Process Improvement & Measurement *
> > > http://www.sqe.com/bsce5sf
> > > > _______________________________________________
> > > > Bluemusic-users mailing list
> > > > Bluemusic-users@lists.sourceforge.net
> > > >
> > >
> >
> https://lists.sourceforge.net/lists/listinfo/bluemusic-users
> > > >
> > >
> > >
> > >
> >
> -------------------------------------------------------
> > > SF.Net email is Sponsored by the Better Software
> > > Conference & EXPO
> > > September 19-22, 2005 * San Francisco, CA *
> > > Development Lifecycle Practices
> > > Agile & Plan-Driven Development * Managing
> > Projects
> > > & Teams * Testing & QA
> > > Security * Process Improvement & Measurement *
> > > http://www.sqe.com/bsce5sf
> > > _______________________________________________
> > > Bluemusic-users mailing list
> > > Bluemusic-users@lists.sourceforge.net
> > >
> >
> https://lists.sourceforge.net/lists/listinfo/bluemusic-users
> > >
> >
> >
> >
> >
> >
> >
> >
> >
> ___________________________________________________________________________
> >
> > Appel audio GRATUIT partout dans le monde avec le
> > nouveau Yahoo! Messenger
> > T�l�chargez cette version sur
> > http://fr.messenger.yahoo.com
> >
> >
> >
> -------------------------------------------------------
> > SF.Net email is Sponsored by the Better Software
> > Conference & EXPO
> > September 19-22, 2005 * San Francisco, CA *
> > Development Lifecycle Practices
> > Agile & Plan-Driven Development * Managing Projects
> > & Teams * Testing & QA
> > Security * Process Improvement & Measurement *
> > http://www.sqe.com/bsce5sf
> > _______________________________________________
> > Bluemusic-users mailing list
> > Bluemusic-users@lists.sourceforge.net
> >
> https://lists.sourceforge.net/lists/listinfo/bluemusic-users
> >
>
>
>
>
>
>
>
> ___________________________________________________________________________
> Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
> T�l�chargez cette version sur http://fr.messenger.yahoo.com
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Bluemusic-users mailing list
> Bluemusic-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bluemusic-users
>


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Bluemusic-users mailing list
Bluemusic-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluemusic-users