AM Posted February 9 Share Posted February 9 dear all i want to code a simple function for sending midi-cc in an "all-in-one"-function (to external devices like filterbank or microcosm) it works more or less.... but there are two bugs i can't fix. the function: (defun filterbank (&key cc value-range (time-range '(1 127)) (port 7) (channel 16)) (let ((values (loop for i in (rnd-sample 100 (gen-integer (first value-range) (second value-range))) for j in (gen-length (gen-integer (first time-range) (second time-range)) 1/128) collect (list i j)))) (live-coding-midi (compile-score (def-score cc-seq (:title "cc-seq" :key-signature 'chromatic :time-signature '(4 4) :tempo 60) (seq :length '(3) :pitch '(c4) :velocity '(ff) :port port :channel channel :controllers (1 values))))))) (filterbank :cc 1 :value-range '(40 99) :port 1) problem 1: when i evaluate the function and run it ONCE - everything okay. when i like to RUN it a second time there is an error, i don't know why. then i have to evaluate the FUNCTION again... why? problem 2: i would like to "replace" :controllers (1 values) by :controllers (cc values) -> so that i can choose the cc-number by a variable "cc". but it don't work - any hints? thanx for some help andré Quote Link to comment Share on other sites More sharing options...
erka Posted February 10 Share Posted February 10 I think for this kind of tasks it could help to have functions like this: (send-midi-note :note 60 :velocity 20 :chan 0 :dest 0 :dur 'q) (send-controller :num 1 :val 60 :chan 0 :dest 0 :dur 'q :endval 10) Bypassing score, notation, midi-player, live-coding. Just instant MIDI-output on cmd-e or inside of code. Then you could write functions ,loops or just for testing or setting up your devices. What do you think? I assume live-coding-midi is not made to run inside of a functions. Stephane Boussuge 1 Quote Link to comment Share on other sites More sharing options...
AM Posted February 10 Author Share Posted February 10 it's not a problem with live-coding - cc-messages are sended perfectly, but... but, when i try to evaluate a few times, the error comes up - it seems to me to be a problem with "controllers" inside a new function => when i evaluate for the second time it's always: Error: Controllers must be alternating names/numbers and values. i have no idea, why this is a problem when doing more the 1 eval... Quote Link to comment Share on other sites More sharing options...
opmo Posted February 10 Share Posted February 10 Send me the code please. Quote Link to comment Share on other sites More sharing options...
AM Posted February 10 Author Share Posted February 10 that's the code (defun filterbank (&key cc value-range (time-range '(1 127)) (port 7) (channel 16)) (let ((values (loop for i in (rnd-sample 100 (gen-integer (first value-range) (second value-range))) for j in (gen-length (gen-integer (first time-range) (second time-range)) 1/128) collect (list i j)))) (live-coding-midi (compile-score (def-score cc-seq (:title "cc-seq" :key-signature 'chromatic :time-signature '(4 4) :tempo 60) (seq :length '(3) :pitch '(c4) :velocity '(ff) :port port :channel channel :controllers (1 values))))))) (filterbank :cc 1 :value-range '(40 99) :port 1) Quote Link to comment Share on other sites More sharing options...
opmo Posted February 10 Share Posted February 10 You need to eval the function again: (progn (defun filterbank (&key cc value-range (time-range '(1 127)) (port 7) (channel 16)) (let ((values (loop for i in (rnd-sample 100 (gen-integer (first value-range) (second value-range))) for j in (gen-length (gen-integer (first time-range) (second time-range)) 1/128) collect (list i j)))) (live-coding-midi (compile-score (def-score cc-seq (:title "cc-seq" :key-signature 'chromatic :time-signature '(4 4) :tempo 60) (seq :length '(3) :pitch '(c4) :velocity '(ff) :port 1 :channel channel :controllers (1 values))))))) (filterbank :cc 1 :value-range '(40 99) :port 1) ) Quote Link to comment Share on other sites More sharing options...
AM Posted February 10 Author Share Posted February 10 i know. but the question is/was, how it could work without eval each time. i would like to put my function in my library, so "EVAL again" is not a solution - that's the idea of DEFUN Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.