Change list on the fly

74 views
Skip to first unread message

Roberto Arletti

unread,
Jul 30, 2017, 1:30:43 PM7/30/17
to Extempore
Hi , I'm starting with Extempore , and i am playing with the fmsynth example .

(define l1
  (lambda (beat dur cell)
    (play fmsynth (pc:quantize (car cell) (pc:scale root 'aeolian))
          (cosr 90 10 2) (* dur .2) 0.1 10.0)
    (callback (*metro* (+ beat (* dur .5))) 'l1
              (+ beat dur)
              dur
              (rotate cell 1))))

(l1 (*metro* 'get-beat 4) 1/4 '(60 63 62 67 72 65 84 77 65 67))

There is a way to change the list of notes on the fly and obviously run the command (rotate cell 1).
Thanks

Ben Swift

unread,
Jul 30, 2017, 7:52:36 PM7/30/17
to extemp...@googlegroups.com
Hi Roberto

You can do whatever you want with the list - the key part is in that
final line (well, the `callback` function), which re-schedules the `l1`
function in the future with the arguments supplied. So you just need to
change the final argument to callback (which will be passed as the the
`cell` argument to the new `l1` call) to do whatever you like.

Do you want to give us a description of what you want to do? The
Extempore list can help you make it happen :)

Cheers,
Ben

Roberto Arletti

unread,
Jul 31, 2017, 1:36:58 AM7/31/17
to Extempore
Hi , Ben

I just wish play the original example and after a few seconds change the original list

(60 63 62 67 72 65 84 77 65 67) with a new list (48 55 57 55 60 62 50 53 58 64) and so on.

Cheers,

Roberto


Andrew Sorensen

unread,
Jul 31, 2017, 8:58:50 AM7/31/17
to extemp...@googlegroups.com
(sys:load "libs/core/instruments.xtm")

(make-instrument fmsynth2 fmsynth)

(bind-func dsp:DSP
  (lambda (in time chan dat)
    (cond ((< chan 2)
           (fmsynth2 in time chan dat))
          (else 0.0))))

(dsp:set! dsp)

;; first version (redefine *lst* whenever you like)
(define *lst* '(60 63 67))

(define looper
  (lambda (beat dur)
    (set! *lst* (rotate *lst* -1))
    (play fmsynth2 (car *lst*) 60 (* .3 dur))
    (callback (*metro* (+ beat (* .5 dur))) 'looper              
              (+ beat dur)
              dur)))

(looper (*metro* 'get-beat 4) 1/4)

;; second version using playp
;;
;; playp is a world unto itself - explore :)
;;
;; a very short intro to playp at
(define looper2
  (lambda (beat dur)
    (playp 1 0 fmsynth2 0 `(60 63 67) 80 (* .3 dur))
    (callback (*metro* (+ beat (* .5 dur))) 'looper2
              (+ beat dur) dur)))

(looper2 (*metro* 'get-beat 4) 1/4)


--
You received this message because you are subscribed to the Google Groups "Extempore" group.
To unsubscribe from this group and stop receiving emails from it, send an email to extemporelang+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Roberto Arletti

unread,
Jul 31, 2017, 1:11:47 PM7/31/17
to Extempore

Thanks Digego , that's what I was looking for.

Some things ( i use windows 7 and extempore 0.7) :

- the first example the istruction (make-instrument fmsynth2 fmsynth) cause this message "unbound variable: make-instrument
  i've changed with (bind-instrument fmsynth2 fmsynth_note_c fmsynth_fx) , and all is ok

- the second example does not work , the message is : function<string-lenght>: argument 1 must be : string argument values : 2 #<PROC string-lenght>

- i can not understand the difference between DEFINE , LET , and SET! , you know some online resources to learn this language ?

Thanks

Ben Swift

unread,
Jul 31, 2017, 6:14:06 PM7/31/17
to extemp...@googlegroups.com
This is a known issue - I'm in the process of fixing it (requires setting up a windows box at my end). The fix you made is right, though. 

Ben
> --
> You received this message because you are subscribed to the Google Groups
> "Extempore" group.
> To unsubscribe from this group and stop receiving emails from it, send an

Andrew Sorensen

unread,
Aug 4, 2017, 12:55:53 AM8/4/17
to Roberto Arletti, Extempore
Give the new build a shot. Not tested on win7 but might work for you?
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Reply all
Reply to author
Forward
0 new messages