Jump to content

AM

Members
  • Joined

  • Last visited

Posts posted by AM

  1. here is the solution to send any data by OSC!

    a big thanks to janusz who made it for me/us!! now a wide variety of externals can be controlled via OSC, in any format... (not only reaktor)

     

    (defun osc-send (&rest args)
      (let*
          ((host #(127 0 0 1)) ;; host
           (port 7500) ;; port
           (s (usocket:socket-connect host port
                               :protocol :datagram
                               :element-type '(unsigned-byte 8)))
            (b (apply' osc:encode-message args)))
        (format t "sending to ~a on port ~A~%~%" host port)
        (unwind-protect
             (usocket:socket-send s b (length b))
          (when s (usocket:socket-close s)))))
    
    (osc-send  "/player" "120" 1 1 1)
    (osc-send "/beat" "defer" 0 "duration" 1 "pattern" 12)

     

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

     

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

     

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

     

     

  5. like that?

     

    ;; as lisp-code ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    (setf alist '((s -s s== -s -s== s== -s s -s s -s s -s==) (s== -s s -s s== -s s -s== s== -s s -s s -s==) (s -s== s -s s -s s== -s s -s==)))
    
    (loop for i in alist
          collect (append i (list 'q)))
    
    => ((s -s s== -s -s== s== -s s -s s -s s -s== q) (s== -s s -s s== -s s -s== s== -s s -s s -s== q) (s -s== s -s s -s s== -s s -s== q))
    
    
    ;; as lisp-function ;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    (defun append-value (lists value)
      (loop for i in lists
          collect (append i (list value))))
    
    (append-value alist 'q)
    
    => ((s -s s== -s -s== s== -s s -s s -s s -s== q) (s== -s s -s s== -s s -s== s== -s s -s s -s== q) (s -s== s -s s -s s== -s s -s== q))

     

  6. with send-osc-data it don't work, of course... the code before was exactly this ...

     

    #| 
    1. you need Nik Gaffney's osc package
    2. load it
    |#
    (load (merge-pathnames "osc.lisp" *load-truename*))
    #|
    3. define global variable to hold socket, ip-address and port-no
    |#
    (defparameter *out-socket* (make-socket :type :datagram))
    (defparameter *remote-host* "127.0.0.1")
    (defparameter *remote-port* 47522)
    #|
    4. define a send function
    |#
    (defun udpsend (&rest args)
      (let ((message (apply' osc::encode-message args)))
        (send-to *out-socket* message (length message)
                 :remote-host *remote-host*
                 :remote-port *remote-port*)))
    
    ;; send
    (progn
      (udpsend "/beat" "defer" 0 "duration" 1 "pattern" 12)
      (udpsend "/beat" "defer" 1 "duration" 1 "pattern" 22)
      (udpsend "/beat" "defer" 2 "duration" 1 "pattern" 22)
      (udpsend "/beat" "defer" 3 "duration" 1 "pattern" 21))

     

     

    1605830476_Bildschirmfoto2023-01-03um19_33_59.thumb.png.8ed3848ced5a550a93ad8b0efb67d09d.png

    ensembles performed several concerts with it, so it worked 🙂 

  7. thanx, that's great!!!.... there is only one problem (but you don't have to solve it for me): the port/channel-settings are deleted 🙂  so only the internal midiplayer is playing, and no other midi-destinations via preseted port/channels (in the midi-file) are possible...?

     

    (i'm working on a generative-live-scoring project (open forms) and with OPMO i can generate/simulate different generative-grammars of my "musical material" (organzied/read as/from an array). so your solution would be very practical to develop and test the "form-grammar" of the work - THANX!!)

  8. Posted

    dear all,

     

    i have a basic lisp-question to FORMAT and i did not find a solution...

     

    INPUT

     

    (setf alist '((/player "12" 1.0 1.0 1.0)
                  (/player "23" 1.0 1.0 1.0)
                  (/player "12" 1.0 1.0 1.0)	
                  (/player "23" 1.0 1.0 1.0)))
    
    ;; with FORMAT to
    => /player "12" 1.0 1.0 1.0, /player "23" 1.0 1.0 1.0, /player "12" 1.0 1.0 1.0, /player "23" 1.0 1.0 1.0

     

    by FORMAT 
    => i will save it in a TXT-file on desktop (that works (with-open-file...)), but i have a format-problems with the commatas and the ()

     

    thanx for such basic-lisp-help

    andré


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