Jump to content

Featured Replies

Posted

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é

 

 

 

 

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

  • Author

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

  • Author

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

 

  • Author

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:

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:

OSCULATOR.NET

Links your controllers to your favorite music and video software. Works with Nintendo Wiimote, iPhone and more.

 

TouchOSC:

 

 

VIDEO:

 

left-  PROTOKOL to see what's MIDI-in

right - midi to osc (OSCulator)

bottom - OPMO with midi-data PRINT in the listener 

 

 

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

 

 

  • Author

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

 

 

 

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

 

  • Author

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*)

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 !

  • Author

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 😄

 

 

Dear André,

 

Here is a project I did some years ago, with PD and Lilypond. Kind of realtime converter of beats to rhythmic notation.

 

 

  • 11 months later...

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

  • Author

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

Ohh, not so great news...

 

Thanks for so fast reply!!!!

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

 

  • Author

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

Possibly we need to make changes to the send-osc-data function.

You might need come to Venice in order to find the solution. 🙂

  • Author

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

The send-osc-data has only two var: (<value> <time>). I can't see how your data could work before.

  • Author

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 🙂 

  • Author

i would like to use the FULL possibilites of OSC, the basic-structure to send data

 

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