Jump to content

Featured Replies

Posted

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é

 

 

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.

 

 

 

  • Author

it's not a problem with live-coding - cc-messages are sended perfectly, but...

 

Bildschirmfoto2023-02-10um09_35_17.thumb.png.20f4ad9ee58332b55f47356f4d937744.png

 

 

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...

 

  • Author

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)

 

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)


  )

  • Author

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 😄

 

Create an account or sign in to comment


Copyright © 2014-2025 Opusmodus™ Ltd. All rights reserved.
Product features, specifications, system requirements and availability are subject to change without notice.
Opusmodus, the Opusmodus logo, and other Opusmodus trademarks are either registered trademarks or trademarks of Opusmodus Ltd.
All other trademarks contained herein are the property of their respective owners.

Powered by Invision Community

Important Information

Terms of Use Privacy Policy