Posted November 1, 2024Nov 1 I am currently learning Max MSP for a project, but I would like to use a part of computing structures that I can generate much easier in Opusmodus. So I write code in OM (sorting algorithms for some clicks), test it (and modify my code), then export it to a library in Max MSP. I can now call up/coordinate the MIDI files in realtime etc ... in Max MSP. (Workflow as a beginner in Max MSP...) Bildschirmaufnahme 2024-11-01 um 11.13.28.mov
November 1, 2024Nov 1 You can also utilise Live Coding here. Opusmodus can control any sound source, with Max serving as the sound source in this instance.
November 1, 2024Nov 1 Author Yes, but I will control/trigger the MIDI files and their change in real time, via audio and filter thresholds (live-electronics). So this can only be done in Max MSP. My greatest wish: OM would be "integrated" in Max MSP. In the past there were some LISP-implementations in Max MSP, unfortunately no longer. I would be happy to expect certain processes in lists within Max (within a real time processes) and LISP/OM is optimal for this - this is much more cumbersome directly in MaxMSP Another way would be to let OM and Max MSP run in parallel and to be able to evaluate a function in OM at a Cue from Max and then be able to use the result again in Max. Can you already do about OSC but is that very complex? Or does someone practice that?
November 2, 2024Nov 2 I totally agree, that would be significant improvement. I have thoughts that maybe it's not possible since computing time is quite long in OM? Andre, have you already done this with OSC?
November 2, 2024Nov 2 Author hi there, i tried it NOW with receiving OSC (sending works fine), but i don't know to do it for RECEIVE... here is a sketch, but don^t work, any help?? i think it could be very very useful!!! janusz? 😄 SENDING - works fine!! you can send ANY messages (data format) via OSC (more open then the original OM-version) (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) RECEIVING - error/crash/don't stop receiving? (i'm a bad programmer for such things :-)) i tried to adapt a function from the NET (defun osc-receive-test (port) (let* ((host #(127 0 0 1)) ;; host (port 7500) ;; port (s (usocket:socket-connect host port :protocol :datagram :element-type '(unsigned-byte 8))) (buffer (make-sequence '(vector (unsigned-byte 8)) 1024))) (format t "listening on localhost port ~A~%~%" host port) (unwind-protect (loop do (usocket:socket-receive s buffer (length buffer)) (format t "received -=> ~S~%" (osc:decode-bundle buffer))) (when s (usocket:socket-close s))))) (osc-receive-test 7500) ;; never closing/stoping here is the MAX-HELP to check this side max-osc-help.maxpat
November 2, 2024Nov 2 Author to receive data from Max MSP to... 1) start/eval functions by MAX in OM 2) to produce "new lists" (and sending it back to Max) based on data received from MAX (could be any data, internal processes , sensor data, whatever)... so you could produce data for future processes in MAX (for realtime) based on incoming data... years ago there were some LISP-inplementations in MAX (don't work anymore), but perhaps the communication via OSC would work too... and could be a simple solution. just having an "INTERFACE" maxlisp -- v0.8 SITES.MUSIC.COLUMBIA.EDU GitHub - thealexgraham/lisper: Lisper is an easy to use interface between Max/MSP and Common Lisp GITHUB.COM Lisper is an easy to use interface between Max/MSP and Common Lisp - thealexgraham/lisper
November 2, 2024Nov 2 What data is required, and how should it be interpreted for evaluation? How would you input new data into a function? To assess this functionality, I need concrete examples, including both input and output.
November 2, 2024Nov 2 Author A convulsive example could be: I have a process running in Max MSP (pulse in constantly changing current values), these are influenced via an audio signal. If a certain value is reached (threshold value), MaxMSP should send the last 20 values to OM. OM then sorts these values in a new sequence, sends them back to Max and reads them again as a current values. Instead of sorting, other complex functions of OM could also be applied to these values and then reinterpreted. I think you could use the specific skills of the platforms and have them interacted. just sending LISTS between the platforms and starting to EVAL in OM MAX send could be a just MESSAGE, receiving too. one MAX-bang should send a "message", like shown in the MAX-patch
November 2, 2024Nov 2 Andre, I need examples, function examples. What data comes in and where. I am talking about imaginery function of course. I am not looking for Max lesson 🙂 Example: (osc-prompt (vector-map '(.4 .5 .3 .2) (osc-receive "values")) "triger-id") or (setf osc-data1 (gen-osc-data 4 (osc-recive "values") :time '(1/2 1/4 1/12 1/12 1/12) :min 0.0 :max 1.0 :bpm 120)) (defparameter max '(127.0.0.1 10000)) (setf thd1 (create-osc-thread "thread1" Max)) (osc-prompt (send-osc-data thd1 osc-data1) "trigger-id") ; nil or t or ? Something like that. Concrete examples of use.
November 2, 2024Nov 2 Author this is the working example for send. very basic, i can send all in my FORMAT, i used i for several pieces... (but just SEND) ;; the function (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))))) ;; the examples - i'm sending the data the receiver needs / open, a non-pretermined ... (osc-send "/player" "120" 1 1 1) (osc-send "/beat" "defer" 0 "duration" 1 "pattern" 12) ;; could also be/new?: (osc-send '(1 2 3 4 5)) RECEIVE VALUES - for me, two main ideas ;;; DATA RECEIVE - with port host ;;;(osc-receive) ;; for example: ;; sended in OSC: "1 4.5 5000 n" => comes in in OM as '(1 4.5 5000 n) or as a string "1 4.5 5000 n" ;;;(setf alist (osc-receive)) ;;; EVAL RECEIVE - with port host ;;; for example when sended in OSC "eval", then the function OM inside evaluates... ;;; (osc-eval (gen-sort '(rnd-order '(3 3 6 5 4 3 1))) ;;; => such a formated datastructure is too restrective to use OSC really "OPEN"... it makes sense for some "reaktor"... it is interesting too keep it open? " ... :time '(1/2 1/4 1/12 1/12 1/12) :min 0.0 :max 1.0 :bpm 120)) ... "
April 9Apr 9 Author at the moment i'm trying other solutions to receive (more or less) live-data from MaxMSP (i can't figure it out in OSC) to do something with it - and do not block through "loops that read the new data" my automated-/live-codingin MaxMSP: i write/store my data as txt-file (by WRITE) - every x secondsi read it by a background-process in OPUSMODUS by the following code;;; THE FUNCTION to read the txt-file (defun read-text () (loop do (setf x (with-open-file (stream "/Users/...../pitch_list.txt" :direction :input) (let ((content (make-string (file-length stream)))) (read-sequence content stream) content))) do (sleep 3))) ;; BACKGROUND PROCESS proceeding the function (mp:process-run-function "Mein-Prozess" nil #'read-text)so i'm generating mini-scores/snippets (with all the possibilities of OPUSMODUS) and send it back or store it as/in a midi-file-library to play them on a specific CUE (bang) in MaxMSP to coordinate and trigger them with other things i only can do in MaxMSP. in this way you could also feed your LIVE-CODING-PERFORMANCE - under the hood - by external datasets. reading the new/other set all x-seconds.the advantage (?) is that you do not have to read the values with a loop or constant new evaluation, which is always updated automatically in the background
April 9Apr 9 Author i'm close to the OSC solution... i can not read the DATA? but start/stop listening :-D any help possible?-> how do i read *empfangene-osc-werte* ? or is there a bug in the code(defvar *empfangene-osc-werte* '()) ;; Liste zur Speicherung der empfangenen OSC-Daten (defvar *stop-osc-empfang* nil) (defun osc-receive-test (&key (port 7500)) (let* ((host #(127 0 0 1)) (s (usocket:socket-connect nil port :protocol :datagram :element-type '(unsigned-byte 8))) (buffer (make-array 1024 :element-type '(unsigned-byte 8)))) (format t "Lausche auf OSC-Port ~A...~%" port) (unwind-protect (loop ;; Hier prüfen wir das Abbruch-Flag until *stop-osc-empfang* do (multiple-value-bind (size from-host from-port) (usocket:socket-receive s buffer (length buffer)) (let* ((message (subseq buffer 0 size)) (decoded (handler-case (osc:decode-message message) (error (e) (format t "Fehler bei der Dekodierung: ~A~%" e) nil)))) (if decoded (progn ;; Wenn dekodiert, speichern wir die Nachricht in der Liste (push decoded *empfangene-osc-werte*) (format t "~&Empfangen: ~S~%" decoded)) (format t "Ungültige Nachricht empfangen: ~S~%" message))))) (when s (usocket:socket-close s))))) (osc-receive-test) ;; start (setf *stop-osc-empfang* t) ;; stop
April 10Apr 10 hello, can-t help you with the code but maybe this could be an alternative to sending data to om:GitHubGitHub - iainctduncan/scheme-for-max: Max/MSP external fo...Max/MSP external for scripting and live coding Max with s7 Scheme Lisp - iainctduncan/scheme-for-max
Create an account or sign in to comment