[Impromptu] problem using two metres

Pierre-Yves Gérardy pygy79 at gmail.com
Wed Mar 11 16:56:16 GMT 2009


You could create multiple functions that call each other, all based on the
same metre :
(define mel1a
   (lambda (beat)
      (play some music)
      (if (metre beat 4)
          (callback (*metro* (+ beat .4)) 'mel1b (+ beat .5))
          (callback (*metro* (+ beat .4)) 'mel1a (+ beat .5)))))


And so on with mel1b, c ...
_______________________
Pierre-Yves Gérardy, MD
Headache Research Unit
University of Liege
Citadelle Hospital (University dept. of Neurology),
Boulevard du XIIe de Ligne, 1
B4000 Liège, Belgium
Phone : +32 (0) 4 225 71 41
Mobile : +32 (0) 472 543 727
Fax : +32 (0) 4 223 88 07
Department Secretary : Ms Groven : +32 (0) 4 225 63 91


On Wed, Mar 11, 2009 at 12:06, Michele Pasin <michele.pasin at kcl.ac.uk>wrote:

>
> Hi dear Impromptu-fellows,
>
> would you have a go with the code below?
> On my machine the audio constantly disappears after exactly 1 minute
> and 33 seconds (I know, the melody sounds awful, it's because I
> stripped it down to the bare basics for making my point).
>
> If you're wondering what kind of thing I was trying to do... well
> basically I wanted to make a piece by organizing it into various
> 'patches' of 4/4, and call them from a 'master' patch of 8/4 (or 16/4
> or more..).
> It was just an idea, maybe this approach is totally wrong since
> conception! In such case, how would you approach it instead?
>
>
> tx a lot!
>
> mik
>
>
>
>
>
> ===================================================
>
> (au:clear-graph)
>
> (define piano  (au:make-node "aumu" "dls " "appl"))
> (define *mixer* (au:make-node "aumx" "smxr" "appl"))
>
> (au:connect-node piano 0 *mixer* 1)
> (au:connect-node *mixer* 0 *au:output-node* 0)
>
> (au:update-graph)
> (au:print-graph)
>
> ;;; times
>
> (define *metro* (make-metro 120))
> (define metre (make-metre '(4) 1)) ;;  a classic 4/4
> (define metre2 (make-metre '(8) 1))
>
> ;;;;;;;;;
> ;;
> ;;; this crashes the sound output ... I timed it, always after 1:33
>
> (define mel1
>    (lambda (beat)
>       (if (metre beat 1)
>           (play piano 60 60 *second*))
>       (if (metre2 beat 1 )
>           (play piano 48 60 *second*))
>       (if (metre2 beat 1  )
>           (mel2 beat 36))
>       (if (metre2 beat 5  )
>           (mel2 beat 40))
>       (callback (*metro* (+ beat .4)) 'mel1 (+ beat .5))))
>
>
> (define mel2
>    (lambda (beat note)
>       (if #t
>           (play piano note 50 10000))
>       (if (not (metre beat 4))
>           (callback (*metro* (+ beat .4)) 'mel2 (+ beat 1) note))))
>
>
>
> (mel1 (*metro* 'get-beat))
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Impromptu mailing list
> Impromptu at lists.moso.com.au
> http://lists.moso.com.au/mailman/listinfo/impromptu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.moso.com.au/pipermail/impromptu/attachments/20090311/056f9034/attachment.htm 


More information about the Impromptu mailing list