AM Posted January 10, 2022 Posted January 10, 2022 dear all  as so often i try out strange things i switch on midi-entry, read the pitches which i enter from a keyboard. everything clear so far. I am now trying to do this in a 2-second-loop (with sleep-function), so that variable X would always be assigned new values. at the end of the loop sequence, however, X is NIL. only when I evaluate X again are the values assigned. (see video)  (the idea is... to IMPORT live-midi into a "realtime-process")  some ideas?  thanx andré  clip.mov    Quote
JulioHerrlein Posted January 10, 2022 Posted January 10, 2022 I don´t know if I got the whole idea but you can send a bunch of midi notes from any DAW to Opusmodus using a virtual midi cable. Record whatever you like onto reaper, logic, ableton live, etc and set a virtual midi output port to Opusmodus. You can send this midi notes at 3x the speed of original tempo if you like. The length information can be obtained only by import midi, however. Best, Julio  It´s a sort of "mechamical solution" but I like it Quote
AM Posted January 10, 2022 Author Posted January 10, 2022 thanx! but... it's "only a LISP problem"  with LOOP and SLEEP my code should read X (the midi-values) every 2 seconds - (sleep 2). i don't know why "LISP don't safe" variable X inside the loop when i'm doing "midi-entry".... JulioHerrlein 1 Quote
opmo Posted January 11, 2022 Posted January 11, 2022 Nothing to do with MIDI Entry - I wonder if this is possible with in the loop. Quote
AM Posted January 11, 2022 Author Posted January 11, 2022 with OSC - (with the external osc-library i've sended you) - it should work similiar? loop-function which PRINT the revcevied osc-values over and over (it works). i would like to do that with MIDI  but i'm not a lisp pro.... (code not by me)   (defparameter *in-port* 9999) (defparameter *in-socket* (make-socket :type :datagram :local-port *in-port* :format :binary)) (setq *osc-receive* (process-run-function "osc-receive-process" #'(lambda () (loop do (print (osc::decode-message (receive-from *in-socket* 2048)) #.*terminal-io*))))) (process-kill *osc-receive*) ;; Prozess wieder anhalten  Quote
AM Posted January 12, 2022 Author Posted January 12, 2022 I have now found a SOLUTION that might be also interesting for LIVE CODING:  With the APP OSCulator you can convert midi-input (by an external keyboard) into OSC and then read it in real time (via osc-library + code) in OPMO (see video).  Of course, it could also be done directly from OSC (then via an APP such as TouchOSC from the mobile or tablet). you just have to reread the values (by a loop-function) as you can see in the video; in this way, certain parameters of the LIVE-CODING could be controlled / influenced from the outside.  LINKS:  OSC to LISP: GitHub - zzkt/osc: a common lisp implementation of the Open Sound Control protocol aka OSC GITHUB.COM a common lisp implementation of the Open Sound Control protocol aka OSC - GitHub - zzkt/osc: a common lisp implementation of the Open Sound Control protocol aka OSC  OSCulator: Home | OSCulator OSCULATOR.NET Links your controllers to your favorite music and video software. Works with Nintendo Wiimote, iPhone and more.  TouchOSC: TouchOSC | hexler.net HEXLER.NET   VIDEO:  left-  PROTOKOL to see what's MIDI-in right - midi to osc (OSCulator) bottom - OPMO with midi-data PRINT in the listener  midi via osc to opmo.mov  BASIC CODE:  (defparameter *remote-host* "127.0.0.1") (defparameter *in-port* 1234) (defparameter *in-socket* (make-socket :type :datagram :local-port *in-port* :format :binary)) (setq *osc-receive* (process-run-function "osc-receive-process" #'(lambda () (loop do (print (osc::decode-message (receive-from *in-socket* 2048)) #.*terminal-io*))))) ;; instead of PRINT you could use SETF (process-kill *osc-receive*) ;; STOP "listening process" ;;; CODE by philippe kocher   Quote
AM Posted January 12, 2022 Author Posted January 12, 2022 here is a short sketch of how you can integrate a midi keyboard into live coding. evaluate the BASIC SETUP as before but in a LOOP (here 10 times) the LIVE-CODING setup, so a new value X (the PITCH (midi number) from the external keyboard) is always read in (which comes from the keyboard)...   these values can now be used on various parameters. for this sketch only pitch + tempo (see: tempo (list (* x 3))  VIDEO: at the beginnig you see data coming in from midi keyboard  midi keyboard to live-coding.mov   some code/sketch  (defparameter *remote-host* "127.0.0.1") (defparameter *in-port* 1234) (defparameter *in-socket* (make-socket :type :datagram :local-port *in-port* :format :binary)) (setq *osc-receive* (process-run-function "osc-receive-process" #'(lambda () (loop do (print (setf x (second (osc::decode-message (receive-from *in-socket* 2048)))) #.*terminal-io*))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (loop repeat 10 do (progn (def-score test1 (:key-signature '(c maj) :time-signature '(4 4) :tempo (list (* x 3)) :start 1 :end 4) (part1 :omn (make-omn :pitch (list (midi-to-pitch x)) :length (gen-length-cartesian 1 1 'n 'n 'q '(2 3) '(13 4) '(1 2 3 4 5 6)) :span :length) :port 4 :channel 1 :sound 'gm :program 0 :volume 127)) (live-coding-midi (compile-score 'test1))) do (print x) do (sleep 3)) (process-kill *osc-receive*) ;; Prozess wieder anhalten  Quote
opmo Posted January 12, 2022 Posted January 12, 2022 It is no clear how all this work and where is the midi (x) coming from. Quote
AM Posted January 12, 2022 Author Posted January 12, 2022 MIDI KEYBOARD to OSCulator (translates MIDI to OSC) to OPMO (reading pitch (midi number) and set to variable X)  1) evaluate (setq *osc-receive*.......) 2) start/evaluate LOOP-section 3) start LIVE-CODE 4) play your midi-keyboard  => in every cycle of LIVE-CODING the "keyboard-pitch" will be read --- to variable X -> tempo and pitch are changing (by new cycle start)  5) stop all, incl.  evaluate (process-kill *osc-receive*) opmo 1 Quote
JulioHerrlein Posted January 12, 2022 Posted January 12, 2022 It´s also possible (using MAX or Pure Data) to convert audio impulses to length values using a value in milliseconds as reference for beats and then convert the results to OMN syntax.  Nice Solution, Andre ! AM 1 Quote
AM Posted January 12, 2022 Author Posted January 12, 2022 i know, of course, that LISP is not an environment for REALTIME actions (pure data / max would be much more suitable) - so I had to outsmart the system a little to import data (from a modularsynth and other applications) almost "on the fly" to generate a LIVE-SCORE (with the influence of this datas) at the concert/on the stage....  maybe i should learn MAX... for more smart-coded REALTIME things   JulioHerrlein 1 Quote
JulioHerrlein Posted January 12, 2022 Posted January 12, 2022 Dear André,  Here is a project I did some years ago, with PD and Lilypond. Kind of realtime converter of beats to rhythmic notation.   AM 1 Quote
vpolajnar Posted January 2, 2023 Posted January 2, 2023 Hi! The function make-socket doesn't work at me. (defparameter *in-socket* (make-socket :type :datagram :local-port *in-port* :format :binary)) Â Â Is it maybe the problem in 3.0 version? Â Best, Vili Quote
AM Posted January 2, 2023 Author Posted January 2, 2023 it's seems so, at the moment all my OSC projects are not workiing with 3.0 (polytempo/max-player)... the (make-socket) seems to be the problem in lispworks Quote
vpolajnar Posted January 2, 2023 Posted January 2, 2023 Ohh, not so great news... Â Thanks for so fast reply!!!! Quote
opmo Posted January 3, 2023 Posted January 3, 2023 You don't need to use the make-socket function anymore, it was needed only in CCL.  All you need is:  Here we assign a name Reaktor to a remote-host: 127.0.0.1 and remote- port: 10000: (defparameter reaktor '(127.0.0.1 10000)) Here we assign an variable to our OSC thread object, this is important for sending the data with the thread and for ending the thread: (setf thd1 (create-osc-thread "thread1" reaktor)) To send OSC messages with the thread we call the SEND-OSC-DATA function: (send-osc-data thd1 '((0.0 1/2) (0.0 1/2) (0.08238555 2) (0.10876829 1) (0.12127061 11/2)))  Quote
AM Posted January 3, 2023 Author Posted January 3, 2023 but: some other "receiver" then REAKTOR need other DATA-formats, that's the thing, i think...   and with (send-osc-data) i didn't find a solution for that.... see post...  or...        and with (MAKE-SOCKET... ) it was possible Quote
opmo Posted January 3, 2023 Posted January 3, 2023 Possibly we need to make changes to the send-osc-data function. You might need come to Venice in order to find the solution. AM 1 Quote
AM Posted January 3, 2023 Author Posted January 3, 2023 A good idea, actually  But first I ask my colleague at the ICST-ZHDK (Zurich). He programmed me the last OSC setup, maybe he will find a solution without (make-socket)... Quote
opmo Posted January 3, 2023 Posted January 3, 2023 The send-osc-data has only two var: (<value> <time>). I can't see how your data could work before. Quote
AM Posted January 3, 2023 Author Posted January 3, 2023 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))  The Event System — Polytempo Documentation POLYTEMPO.ZHDK.CH  ensembles performed several concerts with it, so it worked  Quote
AM Posted January 3, 2023 Author Posted January 3, 2023 i would like to use the FULL possibilites of OSC, the basic-structure to send data  Quote
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.